/* VINYLCAPTURE — Brand Style (Thunder Child Creative Technologies palette) */

:root {
    /* Primary */
    --thunder-orange: #FF7A00;
    --deep-orange: #FF5500;
    /* Backgrounds */
    --void-black: #0A0A0A;
    --deep-space: #121212;
    --charcoal: #1A1A1A;
    --steel-gray: #2A2A2A;
    /* Text */
    --pure-white: #FFFFFF;
    --silver: #A1A1AA;
    --dim-gray: #71717A;
    /* Semantic */
    --success-green: #22C55E;
    --warning-amber: #F59E0B;
    --error-red: #EF4444;
    --info-blue: #3B82F6;
    /* Aliases for components */
    --primary-color: var(--thunder-orange);
    --primary-dark: var(--deep-orange);
    --secondary-color: var(--steel-gray);
    --success-color: var(--success-green);
    --error-color: var(--error-red);
    --warning-color: var(--warning-amber);
    --bg-color: var(--void-black);
    --card-bg: var(--deep-space);
    --text-color: var(--pure-white);
    --text-muted: var(--silver);
    --border-color: var(--steel-gray);
    --recording-color: var(--error-red);
    --processing-color: var(--warning-amber);
    --idle-color: var(--success-green);
    /* Aliases for template inline styles */
    --primary: var(--thunder-orange);
    --border: var(--steel-gray);
    --bg: var(--void-black);
    --bg-secondary: var(--deep-space);
    --bg-tertiary: var(--charcoal);
    --text: var(--pure-white);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 16px;
    font-weight: 400;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ——— Navbar ——— */
.navbar {
    background: var(--charcoal);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.nav-logo {
    height: 36px;
    width: auto;
    display: block;
}

.nav-brand-text {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--pure-white);
}

.nav-brand-text:hover {
    color: var(--thunder-orange);
}

.nav-links {
    display: flex;
    list-style: none;
    margin-left: 40px;
    gap: 5px;
}

.nav-links a {
    display: block;
    padding: 8px 16px;
    color: var(--silver);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    font-size: 0.9375rem;
}

.nav-links a:hover {
    background: var(--steel-gray);
    color: var(--pure-white);
}

.nav-links a.active {
    background: linear-gradient(135deg, var(--thunder-orange), var(--deep-orange));
    color: var(--pure-white);
    box-shadow: 0 0 15px -5px rgba(255, 122, 0, 0.5);
}

/* ——— Footer ——— */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--dim-gray);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

/* ——— Typography ——— */
h1 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
    color: var(--pure-white);
}

h2 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin: 30px 0 15px;
    color: var(--pure-white);
}

h3 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-bottom: 15px;
    color: var(--pure-white);
}

/* ——— Cards ——— */
.card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* ——— Buttons ——— */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, var(--thunder-orange), var(--deep-orange));
    color: var(--pure-white);
}

.btn-primary:hover {
    box-shadow: 0 0 15px -5px rgba(255, 122, 0, 0.5);
    filter: brightness(1.08);
}

.btn-secondary {
    background: var(--steel-gray);
    color: var(--pure-white);
}

.btn-secondary:hover {
    background: #353535;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-large {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-danger {
    background: var(--error-red);
    color: var(--pure-white);
}

.btn-danger:hover {
    filter: brightness(1.1);
}

/* ——— Alerts ——— */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

/* ——— Tables ——— */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--charcoal);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--silver);
}

.table tr:hover {
    background: rgba(255, 122, 0, 0.05);
}

.table .empty {
    text-align: center;
    color: var(--dim-gray);
    padding: 40px;
}

/* ——— Forms ——— */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--silver);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--charcoal);
    color: var(--pure-white);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--thunder-orange);
    box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.2);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--dim-gray);
    font-size: 0.75rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

/* ——— Status panel ——— */
.status-panel {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.status-light {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.idle .status-light {
    background: var(--idle-color);
}

.status-indicator.recording .status-light {
    background: var(--recording-color);
    animation: pulse 0.5s infinite;
}

.status-indicator.processing .status-light {
    background: var(--processing-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 1.25rem;
    font-weight: 600;
}

/* ——— Level meter ——— */
.level-meter {
    margin-bottom: 20px;
}

.level-meter label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--silver);
}

.meter-bar {
    height: 24px;
    background: var(--charcoal);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 4px;
    position: relative;
}

.meter-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--idle-color), var(--warning-amber), var(--recording-color));
    transition: width 0.1s;
    border-radius: 12px;
}

.threshold-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--thunder-orange);
    z-index: 10;
    transition: left 0.3s;
}

.threshold-marker::after {
    content: '▼';
    position: absolute;
    top: -14px;
    left: -5px;
    font-size: 10px;
    color: var(--thunder-orange);
}

.level-value {
    font-size: 0.875rem;
    color: var(--dim-gray);
}

/* ——— Calibration ——— */
.calibration-info {
    display: flex;
    gap: 20px;
    align-items: center;
    margin: 12px 0;
    font-size: 0.875rem;
}

.calibration-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
}

.calibration-status.calibrated {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.calibration-status.calibrating {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    animation: pulse 1.5s infinite;
}

.noise-floor, .threshold {
    color: var(--dim-gray);
}

.noise-floor span, .threshold span {
    font-weight: 600;
    color: var(--silver);
}

.current-device {
    margin-top: 12px;
    padding: 12px;
    background: var(--charcoal);
    border-radius: 6px;
}

.current-device label {
    font-weight: 500;
    margin-right: 8px;
    color: var(--silver);
}

.current-device #audio-device {
    font-family: monospace;
    color: var(--thunder-orange);
}

.recording-info {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    padding: 16px;
}

/* ——— File list ——— */
.file-list {
    list-style: none;
}

.file-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.file-list li:last-child {
    border-bottom: none;
}

.file-list a {
    color: var(--thunder-orange);
    text-decoration: none;
}

.file-list a:hover {
    text-decoration: underline;
}

.file-list .empty {
    color: var(--dim-gray);
    font-style: italic;
}

/* ——— Breadcrumb ——— */
.breadcrumb {
    margin-bottom: 20px;
    font-size: 0.875rem;
}

.breadcrumb a {
    color: var(--thunder-orange);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: var(--dim-gray);
    margin: 0 8px;
}

/* ——— Toolbar ——— */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.folder {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
}

.folder:hover {
    color: var(--thunder-orange);
}

/* ——— Cover grid ——— */
.cover-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.cover-item {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.cover-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.cover-item img:hover {
    transform: scale(1.05);
}

.cover-info {
    padding: 12px;
}

.cover-info p {
    font-size: 0.875rem;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--silver);
}

.upload-form {
    margin-bottom: 20px;
}

/* ——— Modal ——— */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--deep-space);
    padding: 30px;
    border-radius: 12px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    width: 90%;
    border: 1px solid var(--border-color);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: var(--dim-gray);
}

.modal-close:hover {
    color: var(--pure-white);
}

.modal-content img {
    max-width: 100%;
    margin-bottom: 20px;
    border-radius: 8px;
}

.ocr-data {
    font-size: 0.875rem;
    color: var(--silver);
}

.ocr-data h4 {
    margin: 20px 0 10px;
    color: var(--dim-gray);
}

.raw-text {
    background: var(--charcoal);
    padding: 16px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    color: var(--silver);
}

.settings-form .card {
    margin-bottom: 30px;
}

/* Device table highlighting */
.table tr.active-device {
    background: rgba(255, 122, 0, 0.1);
}

.table tr.active-device td {
    font-weight: 500;
}

.subsection-title {
    font-size: 0.875rem;
    color: var(--dim-gray);
    margin: 16px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ——— Badges ——— */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(34, 197, 94, 0.25);
    color: #86efac;
}

.badge-secondary {
    background: var(--steel-gray);
    color: var(--silver);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.25);
    color: #fcd34d;
}

.text-muted {
    color: var(--text-muted);
}

code {
    background: var(--charcoal);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--thunder-orange);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fcd34d;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 12px 0;
}

.virtual-devices {
    margin-top: 12px;
}

.virtual-devices summary {
    cursor: pointer;
    color: var(--dim-gray);
    font-size: 0.875rem;
    padding: 8px 0;
}

.virtual-devices summary:hover {
    color: var(--silver);
}

.table.small {
    font-size: 0.8rem;
}

.table.small td {
    padding: 6px 10px;
}

@media (max-width: 768px) {
    .nav-links {
        margin-left: auto;
        font-size: 0.875rem;
    }

    .nav-links a {
        padding: 6px 10px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .calibration-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ——— Global mini player (bottom center, site-wide) ——— */
.global-mini-player {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 560px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 0.6rem 1rem;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.25);
    z-index: 999;
    font-family: inherit;
}
.global-player-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.global-player-controls {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}
.global-player-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.95rem;
    min-width: 2rem;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
}
.global-player-btn:hover:not(:disabled) {
    background: var(--border-color);
}
.global-player-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.global-player-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.global-player-track-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    color: var(--text-color);
}
.global-player-seek-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.global-player-seek {
    flex: 1;
    height: 6px;
    accent-color: var(--thunder-orange);
    min-width: 60px;
    cursor: pointer;
}
.global-player-time {
    font-size: 0.75rem;
    color: var(--dim-gray);
    min-width: 4.5rem;
    text-align: right;
}
.global-player-close {
    flex-shrink: 0;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 4px;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
}
.global-player-close:hover {
    color: var(--text-color);
    background: var(--border-color);
}
#global-audio-element {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}
