/* css/reading.css - Core styles for Reading module */

/* Container and Shared */
.reading-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --- LIST VIEW --- */
.reading-list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.story-card {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    gap: 1.5rem;
    box-shadow: 0 4px 12px var(--shadow-color);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    border: 1px solid var(--border-color);
}

.story-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow-color);
    background: var(--card-bg-hover, var(--card-bg));
    border-color: var(--accent-light, var(--accent-color));
}

.story-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-color);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.story-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.5;
    position: absolute;
    top: 0; left: 0;
    z-index: 0;
}

.story-image span {
    position: relative;
    z-index: 1;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.story-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.story-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.story-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

.story-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.meta-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-bar {
    width: 40px;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-color);
}

.story-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* --- DETAIL VIEW (READING INTERFACE) --- */
.reading-detail-layout {
    display: flex;
    gap: 2rem;
    height: calc(100vh - 160px); /* Adjust based on header/footer */
    position: relative;
}

.reading-main-content {
    flex: 1;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 3rem 4rem;
    overflow-y: auto;
    box-shadow: 0 4px 12px var(--shadow-color);
    font-size: 1.2rem;
    line-height: 2;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-behavior: smooth;
}

/* The lines of text */
.reading-paragraph {
    margin: 0;
}

.reading-sentence {
    display: block;
    margin-bottom: 1.5rem;
}

.reading-word {
    cursor: pointer;
    padding: 0.1rem 0.2rem;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    display: inline-block;
}

.reading-word:hover {
    background: rgba(255, 255, 255, 0.1);
}

.reading-word.selected {
    background: var(--accent-color);
    color: white;
    font-weight: 600;
}

/* Note: we simulate the light green LingQ highlight for known words or specific classes if needed, 
but sticking to theme colors is safer. */

/* --- RIGHT SIDEBAR (DICTIONARY) --- */
.reading-sidebar {
    width: 320px;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 0 4px 12px var(--shadow-color);
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-word-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-audio-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: color 0.2s;
    padding: 0;
    display: inline-flex;
}

.sidebar-audio-btn:hover {
    color: var(--accent-color);
}

.sidebar-word-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.5rem;
}

.pos-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.meaning-input {
    width: 100%;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.meaning-input:focus {
    outline: none;
    border-color: var(--accent-light, var(--accent-color));
}

.popular-meanings {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.meaning-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.8rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.meaning-item:hover {
    border-color: var(--accent-light, var(--accent-color));
    background: rgba(255, 255, 255, 0.08);
}

.meaning-item .add-icon {
    color: var(--text-muted);
}

/* Top bar of reading view */
.reading-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.back-to-list-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.back-to-list-btn:hover {
    color: var(--text-color);
}

/* Light Theme overrides for Reading */
[data-theme="light"] .story-card {
    background: #ffffff;
    border-color: #e5e7eb;
}
[data-theme="light"] .story-card:hover {
    border-color: var(--accent-color);
    background: #fafafa;
}
[data-theme="light"] .reading-main-content,
[data-theme="light"] .reading-sidebar {
    background: #ffffff;
    border-color: #e5e7eb;
}
[data-theme="light"] .meaning-item {
    background: #f9fafb;
    border-color: #e5e7eb;
}
[data-theme="light"] .meaning-item:hover {
    background: #f3f4f6;
    border-color: var(--accent-color);
}
[data-theme="light"] .meaning-input {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
}
[data-theme="light"] .reading-word:hover {
    background: #f3f4f6; /* or a light accent color */
}
[data-theme="light"] .pos-badge {
    background: #f3f4f6;
    color: #4b5563;
}
[data-theme="light"] .meta-badge {
    background: #f3f4f6;
    color: #4b5563;
}
[data-theme="light"] .action-btn {
    border-color: #d1d5db;
    color: #4b5563;
}

/* Responsive */
@media (max-width: 900px) {
    .reading-detail-layout {
        flex-direction: column;
        height: auto;
    }
    .reading-sidebar {
        width: 100%;
        max-height: 400px;
    }
    .reading-main-content {
        padding: 2rem 1.5rem;
    }
}
