:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.35);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-glow: rgba(239, 68, 68, 0.4);
    --success: #10b981;
    --warning: #f59e0b;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background: radial-gradient(circle at 50% 10%, #1e1b4b 0%, var(--bg-primary) 70%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
}

.brand-icon {
    font-size: 1.4rem;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    header {
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .brand {
        font-size: 1.05rem;
    }
    .nav-actions {
        gap: 8px;
    }
    .btn-sm {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

.container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 16px;
    flex: 1;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
    margin-bottom: 24px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.login-card {
    max-width: 440px;
    margin: 40px auto 0 auto;
}

.login-note {
    margin-top: 18px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 14px;
}

.config-card {
    border-left: 4px solid var(--accent);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 650px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 14px;
}

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Recorder Controller */
.recorder-card {
    border-top: 4px solid var(--accent);
    transition: all 0.3s ease;
}

.recorder-card.is-recording {
    border-top-color: var(--danger);
    box-shadow: 0 12px 40px rgba(239, 68, 68, 0.2);
}

.recorder-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.timer-area {
    text-align: center;
    padding: 20px 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.timer {
    font-size: 3.2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.chunk-status-text {
    font-size: 0.95rem;
    color: #38bdf8;
    margin-top: 6px;
    font-weight: 600;
}

.rec-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-record-start {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-size: 1.05rem;
    padding: 14px 32px;
    border-radius: 30px;
    box-shadow: 0 6px 20px var(--danger-glow);
}

.btn-record-start:hover {
    transform: scale(1.03);
}

.btn-record-stop {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 14px 32px;
    border-radius: 30px;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
    70% { box-shadow: 0 0 0 16px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-info {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.badge-recording {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

/* Table */
.table-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

th {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    vertical-align: middle;
}

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
    display: none;
}

.alert-success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.player-card {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--accent);
}

.arch-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px dashed rgba(99, 102, 241, 0.4);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 24px;
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.6;
}

.arch-box h4 {
    color: #818cf8;
    margin-bottom: 8px;
}

/* FLOATING NOTIFICATION TOAST (HIGH Z-INDEX) */
.floating-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 999999;
    width: 440px;
    max-width: calc(100vw - 40px);
    background: rgba(17, 24, 39, 0.96);
    border: 1px solid rgba(99, 102, 241, 0.6);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(99, 102, 241, 0.25);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 18px 20px;
    color: var(--text-main);
    display: none;
    animation: toastSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.toast-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-icon {
    font-size: 1.3rem;
}

.toast-title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    line-height: 1;
}

.toast-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.toast-body {
    font-size: 0.88rem;
    color: #cbd5e1;
    line-height: 1.5;
}

.toast-progress-wrapper {
    margin-top: 14px;
}

.toast-progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.toast-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #38bdf8);
    border-radius: 6px;
    transition: width 0.25s ease;
}

.toast-progress-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
    font-family: monospace;
}

.toast-instructions {
    margin-top: 12px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.82rem;
    color: #a7f3d0;
    line-height: 1.45;
}
