* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 2rem;
    background: #f8f9fa;
    color: #212529;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

header a {
    color: #0d6efd;
    text-decoration: none;
}

header a:hover {
    text-decoration: underline;
}

h1 {
    margin-top: 0;
    font-size: 1.5rem;
}

form input[type="password"],
form input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1rem;
}

button,
input[type="submit"] {
    padding: 0.75rem 1.25rem;
    background: #0d6efd;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
}

button:hover {
    background: #0b5ed7;
}

.error {
    color: #dc3545;
    margin-top: 0.75rem;
}

.dropzone {
    border: 2px dashed #adb5bd;
    border-radius: 8px;
    padding: 3rem 1.5rem;
    text-align: center;
    background: #f1f3f5;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.dropzone.dragover {
    border-color: #0d6efd;
    background: #e7f1ff;
}

.dropzone p {
    margin: 0;
    color: #6c757d;
}

#uploads {
    margin-top: 1.5rem;
}

.hidden {
    display: none !important;
}

.progress-area {
    margin-bottom: 1.5rem;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: #0d6efd;
    transition: width 0.15s;
}

.progress-fill.error {
    background: #dc3545;
}

#progress-text {
    margin: 0;
    color: #6c757d;
    font-size: 0.95rem;
}

h2 {
    font-size: 1.25rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.recording-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: #fff;
}

.recording-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.recording-info strong {
    font-weight: 600;
}

.recording-date {
    font-size: 0.85rem;
    color: #6c757d;
}

.recording-status {
    font-size: 0.85rem;
    font-weight: 500;
}

.status-pending { color: #6c757d; }
.status-processing { color: #0d6efd; }
.status-done { color: #198754; }
.status-error { color: #dc3545; }

.recording-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.recording-actions a {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
}

.recording-actions a:hover {
    text-decoration: underline;
}

.delete-recording {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.15s, background-color 0.15s;
}

.delete-recording:hover {
    color: #dc3545;
    background-color: #f8d7da;
}

/* Transcript page */
.transcript-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem 160px;
}

.player-sticky {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    z-index: 100;
    background: #f8f9fa;
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.player-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.player-bar audio {
    flex: 1;
    min-width: 260px;
}

.phrase-btn {
    padding: 0.45rem 0.9rem;
    background: #e9ecef;
    color: #212529;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.phrase-btn:hover {
    background: #dee2e6;
}

.player-bar a {
    color: #0d6efd;
    text-decoration: none;
    white-space: nowrap;
}

.player-bar .download-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    background: #0d6efd;
    color: #fff;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background-color 0.15s, opacity 0.15s;
}

.player-bar .download-link:hover:not(.loading) {
    background: #0b5ed7;
}

.player-bar .download-link.loading {
    opacity: 0.8;
    pointer-events: none;
    cursor: wait;
}

.player-bar .download-link .loader {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.player-meta {
    margin-top: 0.5rem;
    color: #6c757d;
    font-size: 0.9rem;
}

.transcript-container {
    font-size: 1.15rem;
    line-height: 1.7;
    color: #212529;
}

.transcript-paragraph {
    margin-bottom: 1.2rem;
}

.sentence-line {
    cursor: pointer;
    padding: 0.15rem 0.25rem;
    border-radius: 4px;
    transition: background 0.15s;
    margin: 0.1rem 0;
}

.sentence-line:hover {
    background: #e9ecef;
}

.sentence-line.active {
    background: #fff3cd;
    color: #000;
}

.status-text {
    color: #6c757d;
    font-style: italic;
}

@media (max-width: 600px) {
    body {
        padding: 1rem;
    }

    .transcript-page {
        padding: 1rem 0.75rem 200px;
    }

    .player-sticky {
        padding: 0.75rem;
    }

    .player-bar {
        gap: 0.5rem;
    }

    .player-bar audio {
        flex: 1 1 100%;
        min-width: 0;
    }

    .phrase-btn,
    .player-bar a {
        flex: 1 1 auto;
        text-align: center;
    }
}
