* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    height: 100vh;
}

.screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    width: 100%;
    padding: 1rem 2rem;
    background: #16213e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.select {
    padding: 0.5rem;
    background: #0f3460;
    color: white;
    border: 1px solid #e94560;
    border-radius: 5px;
    font-size: 0.9rem;
}

.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    height: calc(100vh - 60px); /* added height to fill screen */
}

.sidebar {
    width: 250px;
    background: #16213e;
    padding: 1rem;
    overflow-y: auto;
}

.sidebar h2 {
    margin-bottom: 0.5rem;
    color: #e94560;
}

.book-list {
    list-style: none;
    margin-top: 1rem;
}

.book-item {
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: #0f3460;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.book-item:hover {
    background: #e94560;
}

.book-item small {
    display: block;
    color: #aaa;
    font-size: 0.8rem;
}

.reader {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chapter-nav span {
    font-weight: bold;
    font-size: 1.1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
}

.btn-nav {
    background: #16213e;
    color: white;
}

.btn-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Audio section */
.audio-section {
    background: #0f3460;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.audio-label {
    font-size: 0.9rem;
    color: #e94560;
    font-weight: bold;
    white-space: nowrap;
}

audio {
    flex: 1;
    height: 35px;
}

.text-content {
    background: #16213e;
    padding: 2rem;
    border-radius: 10px;
    min-height: 300px;
}

.placeholder {
    text-align: center;
    color: #aaa;
    font-style: italic;
}

.translated-text {
    white-space: pre-wrap;
    line-height: 1.8;
    font-size: 1.05rem;
}

.cached-badge {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.25rem 0.5rem;
    background: #0f3460;
    border-radius: 3px;
    font-size: 0.8rem;
    color: #aaa;
}

.error {
    color: #e94560;
}

/* Admin panel styles */
.admin-panel {
    width: 300px;
    background: #16213e;
    padding: 1rem;
    border-left: 1px solid #e94560;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.toggle-admin {
    background: #e94560;
    color: white;
    border: none;
    padding: 0.6rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
    margin-bottom: 1rem;
}

.admin-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-section h3 {
    color: #e94560;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.input-field {
    width: 100%;
    padding: 0.5rem;
    margin: 0.25rem 0;
    background: #0f3460;
    border: 1px solid #e94560;
    border-radius: 5px;
    color: white;
    font-size: 0.9rem;
}

.textarea-field {
    resize: vertical;
    min-height: 100px;
}

.btn-primary {
    background: #e94560;
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 0.5rem;
    width: 100%;
}

.btn-primary:hover {
    background: #ff6b81;
}

/* Adjust main-content to fit the new panel */
.main-content {
    display: flex;
    height: calc(100vh - 60px); /* header height */
}

.sidebar {
    width: 200px;
}

.reader {
    flex: 1;
    overflow-y: auto;
}

.admin-panel {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
}

@media (max-width: 1000px) {
    .main-content {
        flex-direction: column;
    }
    .admin-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e94560;
    }
}

/* Correction UI */
.correction-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.btn-correction {
    background: #0f3460;
    color: #e94560;
    border: 1px solid #e94560;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
}

.btn-correction:hover {
    background: #e94560;
    color: white;
}

.correction-textarea {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    background: #0f3460;
    border: 1px solid #e94560;
    border-radius: 5px;
    color: white;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 0.5rem;
}

.correction-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Task 5: Progress bar and streaming */
.progress-bar-container {
    width: 100%;
    background: #0f3460;
    border-radius: 5px;
    margin: 0.5rem 0;
    height: 20px;
}
.progress-bar {
    height: 100%;
    background: #e94560;
    border-radius: 5px;
    width: 0%;
    transition: width 0.3s;
}
.streaming-indicator {
    margin-top: 0.5rem;
    color: #ff9800;
    font-size: 0.9rem;
}