:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --danger: #ef4444;
    --success: #22c55e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg); 
    color: var(--text); 
    line-height: 1.5;
    padding: 2rem;
    min-height: 100vh;
}

h1 { 
    font-family: 'Outfit', sans-serif; 
    font-size: 2.5rem; 
    margin-bottom: 2rem; 
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.container { max-width: 1200px; margin: 0 auto; }

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

.table-container {
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.mobile-cards {
    display: none;
}

.recording-card {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
}

.recording-card:last-child {
    border-bottom: none;
}

.recording-card.favorite {
    background: rgba(99, 102, 241, 0.05);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.card-filename {
    font-weight: 500;
    color: #e2e8f0;
    word-break: break-all;
    flex: 1;
}

.card-checkbox {
    flex-shrink: 0;
}

.card-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
}

th:hover { color: var(--text); }
th.sort-asc::after { content: ' ↑'; }
th.sort-desc::after { content: ' ↓'; }

td {
    padding: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.9375rem;
}

tr:hover td { background: rgba(255, 255, 255, 0.02); }
tr.favorite-row td { background: rgba(99, 102, 241, 0.05); }
tr.favorite-row:hover td { background: rgba(99, 102, 241, 0.08); }

.checkbox-col { width: 40px; text-align: center; }

input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.filename { font-weight: 500; color: #e2e8f0; }
.timestamp { color: var(--text-muted); }
.duration { font-family: monospace; }

.transcript-icon {
    cursor: help;
    color: var(--primary);
    font-size: 1.2rem;
    position: relative;
}

[data-tooltip] { position: relative; }
[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem;
    background: #334155;
    color: white;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    white-space: pre-wrap;
    width: 300px;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    pointer-events: none;
}

[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

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

.action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 0.4rem;
    transition: all 0.2s;
}

.action-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.action-btn.delete:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); }
.action-btn.favorite { color: var(--primary); }
.action-btn.favorite:hover { background: rgba(99, 102, 241, 0.2); }

.player-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    display: none;
    align-items: center;
    gap: 1.5rem;
    z-index: 100;
    width: calc(100% - 4rem);
    max-width: 800px;
}

.player-info { flex-shrink: 0; max-width: 200px; }
.player-info .name { font-weight: 500; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

audio { flex-grow: 1; height: 32px; filter: invert(0.1); }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1.5rem;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 1rem;
    max-width: 900px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.35);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

.modal-body {
    padding: 1.25rem;
    max-height: 70vh;
    overflow: auto;
    color: var(--text);
    font-size: 0.95rem;
    white-space: pre-wrap;
}

/* Custom Dialog Styles */
.dialog-box {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
    text-align: center;
}

.dialog-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.dialog-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.dialog-message {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.dialog-input-container {
    margin-bottom: 1.5rem;
}

.dialog-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
}

.dialog-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dialog-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.dialog-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
    min-width: 100px;
}

.dialog-btn-primary {
    background: var(--primary);
    color: white;
}

.dialog-btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.dialog-btn-danger {
    background: var(--danger);
    color: white;
}

.dialog-btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.dialog-btn-success {
    background: var(--success);
    color: white;
}

.dialog-btn-success:hover {
    background: #16a34a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.dialog-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

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

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
}

.toast {
    background: var(--card-bg);
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    color: var(--text);
    font-size: 0.9rem;
}

.toast-success {
    border-left-color: var(--success);
}

.toast-error {
    border-left-color: var(--danger);
}

.toast-info {
    border-left-color: var(--primary);
}

.toast-warning {
    border-left-color: #f59e0b;
}

.empty-state {
    padding: 4rem;
    text-align: center;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    body { padding: 1rem; }
    .hide-mobile { display: none; }
    
    /* Hide table and show card layout on mobile */
    table {
        display: none !important;
    }
    
    .mobile-cards {
        display: block;
    }
    
    /* Stack controls vertically */
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    #selection-info {
        text-align: center;
    }
    
    /* Smaller buttons on mobile */
    .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.875rem;
    }
    
    .action-btn {
        padding: 0.3rem;
        font-size: 1rem;
    }
    
    /* Reduce header size */
    h1 {
        font-size: 1.75rem;
    }
    
    .header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    /* Make player more compact */
    .player-container {
        width: calc(100% - 2rem);
        max-width: 100%;
        padding: 0.75rem;
        flex-wrap: wrap;
    }
    
    .player-info {
        width: 100%;
        max-width: 100%;
        margin-bottom: 0.5rem;
    }
    
    audio {
        width: 100%;
    }
    
    /* Compact modal on mobile */
    .modal-overlay {
        padding: 0.5rem;
    }
    
    .modal-body {
        max-height: 60vh;
        font-size: 0.875rem;
    }
    
    /* Better pagination on mobile */
    .pagination {
        padding: 1rem 0.5rem;
        gap: 0.5rem;
    }
    
    .page-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8125rem;
    }
    
    .page-num {
        min-width: 2rem;
        height: 2rem;
        font-size: 0.8125rem;
    }
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border);
}

.page-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 0.4rem;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.page-size-select {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem;
    border-radius: 0.4rem;
    font-family: inherit;
    cursor: pointer;
}

.page-numbers {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.page-num {
    min-width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.4rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    font-size: 0.875rem;
}

.page-num:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
}

.page-num.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.page-dots {
    color: var(--text-muted);
    padding: 0 0.25rem;
}

.badge-new {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 1rem;
    margin-left: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
}

.loader {
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

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

.footer {
    margin-top: 4rem;
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

.footer a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.header-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.header-container h1 { margin-bottom: 0; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border);
    color: var(--text);
}

.status-recording {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
    color: #bbf7d0;
}

.status-silence {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.4);
    color: #e2e8f0;
}

/* Logs Section */
.logs-section {
    margin-top: 2rem;
}

.logs-container {
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border);
    margin-top: 1rem;
    overflow: hidden;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.logs-title {
    font-weight: 600;
    color: var(--text);
}

.logs-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.logs-content {
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    background: rgba(0, 0, 0, 0.2);
}

.log-entry {
    padding: 0.25rem 0.5rem;
    border-left: 3px solid transparent;
    margin-bottom: 0.25rem;
    border-radius: 0.25rem;
}

.log-entry:hover {
    background: rgba(255, 255, 255, 0.05);
}

.log-timestamp {
    color: var(--text-muted);
    margin-right: 0.75rem;
}

.log-level {
    display: inline-block;
    width: 60px;
    text-align: center;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.75rem;
    margin-right: 0.75rem;
}

.log-level-info {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-left-color: #3b82f6;
}

.log-level-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border-left-color: #f59e0b;
}

.log-level-error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-left-color: #ef4444;
}

.log-level-success {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
    border-left-color: #22c55e;
}

.log-message {
    color: var(--text);
}

.logs-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .logs-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .logs-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .logs-content {
        font-size: 0.75rem;
        max-height: 300px;
    }
}

/* Dashboard Subtitle */
.subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 400;
}
