/* Reset and base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #e0e0e0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: #888;
    margin-top: 0.5rem;
}

/* Top bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    color: #888;
}

.btn {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

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

.btn-primary {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(58, 123, 213, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

.btn-logout {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.3);
}

.btn-logout:hover {
    background: rgba(255, 107, 107, 0.1);
}

/* Stats bar */
.stats-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 140px;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filters */
.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #3a7bd5;
}

.search-input::placeholder {
    color: #666;
}

.filter-select {
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

.filter-select option {
    background: #1a1a2e;
    color: #e0e0e0;
}

/* Table */
.table-wrapper {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    color: #888;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th:hover {
    color: #fff;
}

th.sorted {
    color: #3a7bd5;
}

td {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.9rem;
    vertical-align: middle;
}

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

/* File name link */
td a {
    color: #7db4ff;
    text-decoration: none;
}

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

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-not_in_meta {
    background: rgba(0, 210, 255, 0.15);
    color: #00d2ff;
}

.status-in_meta_never_active {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.status-previously_active {
    background: rgba(255, 152, 0, 0.15);
    color: #ff9800;
}

.status-currently_active {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
}

/* Usable toggle */
.usable-toggle {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: #555;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
    outline: none;
}

.usable-toggle.active {
    background: #4caf50;
}

.usable-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.usable-toggle.active::after {
    transform: translateX(16px);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 0;
}

.pagination .page-info {
    color: #888;
    font-size: 0.875rem;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.login-card header {
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #aaa;
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #3a7bd5;
}

.login-btn {
    width: 100%;
    padding: 0.85rem;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(58, 123, 213, 0.4);
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.login-error {
    color: #ff6b6b;
    font-size: 0.875rem;
    min-height: 1.5rem;
    display: none;
}

.login-error.visible {
    display: block;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

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

/* Scan banner */
.scan-banner {
    display: none;
    padding: 0.75rem 1rem;
    background: rgba(0, 210, 255, 0.1);
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-radius: 8px;
    margin-bottom: 1rem;
    color: #00d2ff;
    font-size: 0.875rem;
    align-items: center;
    gap: 0.5rem;
}

.scan-banner.visible {
    display: flex;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.empty-state p {
    margin-bottom: 1rem;
}

/* Duration formatting */
.duration {
    color: #888;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .stats-bar {
        gap: 0.5rem;
    }

    .stat-card {
        min-width: 100px;
        padding: 0.75rem;
    }

    .stat-card .stat-value {
        font-size: 1.2rem;
    }

    .filters-bar {
        flex-direction: column;
    }

    table {
        font-size: 0.8rem;
    }

    th, td {
        padding: 0.5rem 0.6rem;
    }
}
