/* ── AudioX Admin Dashboard Styles ── */

:root {
    --brand-orange: #FF7A1A;
    --brand-pink: #FF4081;
    --brand-purple: #7C4DFF;
    --brand-deep-purple: #5C2DC9;
    --accent-gold: #FFAB40;
    --coral: #FF6B6B;

    --dark-900: #08080D;
    --dark-800: #101016;
    --dark-700: #18182A;
    --dark-600: #1E1E30;
    --dark-500: #2A2A40;
    --dark-400: #3A3A52;

    --light-100: #F8F8FA;
    --light-200: #E8E8F0;
    --light-300: #B0B0C4;
    --light-400: #8888A4;
    --light-500: #666684;

    --sidebar-width: 240px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--dark-900);
    color: var(--light-100);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--dark-800); }
::-webkit-scrollbar-thumb { background: var(--dark-500); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--dark-400); }

/* ── Login Screen ── */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark-900) 0%, var(--brand-deep-purple) 50%, var(--dark-900) 100%);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.login-card {
    background: var(--dark-700);
    border: 1px solid var(--dark-500);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-logo .logo-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-pink), var(--brand-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.login-logo .logo-icon .material-icons-round { font-size: 36px; color: #fff; }
.login-logo h1 { font-size: 32px; font-weight: 800; margin-bottom: 4px; }
.login-logo p { color: var(--light-400); font-size: 14px; margin-bottom: 32px; }

.input-group {
    position: relative;
    margin-bottom: 16px;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--light-500);
    font-size: 20px;
}

.input-group input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    background: var(--dark-600);
    border: 1px solid var(--dark-500);
    border-radius: var(--radius);
    color: var(--light-100);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--brand-orange);
}

.input-group input::placeholder { color: var(--light-500); }

.error-msg {
    color: var(--coral);
    font-size: 13px;
    margin-bottom: 12px;
    text-align: left;
}

/* ── Buttons ── */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-pink));
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.1s;
    margin-top: 8px;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    padding: 10px 20px;
    background: var(--dark-600);
    border: 1px solid var(--dark-500);
    border-radius: var(--radius);
    color: var(--light-200);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover { background: var(--dark-500); }

.btn-danger {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--coral);
    border-radius: 8px;
    color: var(--coral);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover { background: rgba(255, 107, 107, 0.1); }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--light-400);
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
}

.btn-icon:hover { background: var(--dark-500); color: var(--light-100); }
.btn-icon.danger:hover { color: var(--coral); }

/* ── Dashboard Layout ── */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark-800);
    border-right: 1px solid var(--dark-600);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--dark-600);
}

.logo-sm {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-pink));
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-sm .material-icons-round { font-size: 20px; color: #fff; }

.brand-name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    color: var(--light-400);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover { background: var(--dark-600); color: var(--light-200); }

.nav-item.active {
    background: linear-gradient(135deg, rgba(255, 122, 26, 0.15), rgba(255, 64, 129, 0.1));
    color: var(--brand-orange);
}

.nav-item .material-icons-round { font-size: 20px; }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--dark-600);
}

.btn-signout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: none;
    border: none;
    color: var(--light-400);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-signout:hover { background: rgba(255, 107, 107, 0.1); color: var(--coral); }

/* ── Main Content ── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 0;
    min-height: 100vh;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--dark-700);
    background: var(--dark-800);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h2 { font-size: 22px; font-weight: 700; }

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-email { color: var(--light-400); font-size: 13px; }

.avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

/* ── Pages ── */
.page {
    display: none;
    padding: 28px 32px;
}

.page.active { display: block; }

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--dark-700);
    border: 1px solid var(--dark-600);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon .material-icons-round { font-size: 24px; color: #fff; }
.stat-icon.orange { background: rgba(255, 122, 26, 0.15); }
.stat-icon.orange .material-icons-round { color: var(--brand-orange); }
.stat-icon.pink { background: rgba(255, 64, 129, 0.15); }
.stat-icon.pink .material-icons-round { color: var(--brand-pink); }
.stat-icon.purple { background: rgba(124, 77, 255, 0.15); }
.stat-icon.purple .material-icons-round { color: var(--brand-purple); }
.stat-icon.gold { background: rgba(255, 171, 64, 0.15); }
.stat-icon.gold .material-icons-round { color: var(--accent-gold); }

.stat-value { font-size: 28px; font-weight: 800; display: block; }
.stat-label { font-size: 13px; color: var(--light-400); }

/* ── Section Cards ── */
.section-card {
    background: var(--dark-700);
    border: 1px solid var(--dark-600);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.section-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--light-200);
}

/* ── Data Tables ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--light-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--dark-600);
}

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--light-200);
    border-bottom: 1px solid var(--dark-600);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--dark-600); }

.data-table .cover-thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--dark-500);
}

.data-table .banner-thumb {
    width: 120px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--dark-500);
}

.data-table .actions {
    display: flex;
    gap: 4px;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.badge.active { background: rgba(78, 205, 196, 0.15); color: #4ECDC4; }
.badge.inactive { background: rgba(255, 107, 107, 0.15); color: var(--coral); }
.badge.featured { background: rgba(255, 171, 64, 0.15); color: var(--accent-gold); }
.badge.premium { background: rgba(124, 77, 255, 0.15); color: var(--brand-purple); }
.badge.scheduled { background: rgba(255, 122, 26, 0.15); color: var(--brand-orange); }

.color-dot {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    display: inline-block;
    vertical-align: middle;
}

/* ── Activity List ── */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--dark-600);
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-orange);
    flex-shrink: 0;
}

.activity-text {
    flex: 1;
    font-size: 13px;
    color: var(--light-200);
}

.activity-time {
    font-size: 12px;
    color: var(--light-500);
    white-space: nowrap;
}

.empty-text {
    text-align: center;
    color: var(--light-500);
    padding: 40px 0;
    font-size: 14px;
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--dark-700);
    border: 1px solid var(--dark-500);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
}

.modal .form-group {
    margin-bottom: 16px;
}

.modal label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--light-300);
    margin-bottom: 6px;
}

.modal input,
.modal select,
.modal textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--dark-600);
    border: 1px solid var(--dark-500);
    border-radius: 10px;
    color: var(--light-100);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
    border-color: var(--brand-orange);
}

.modal textarea { resize: vertical; min-height: 80px; }

.modal select { appearance: none; cursor: pointer; }

.modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal .form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal .form-actions .btn-primary { flex: 1; }
.modal .form-actions .btn-secondary { flex: 0; min-width: 100px; }

.file-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-input-wrapper input[type="file"] {
    display: none;
}

.file-input-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--dark-500);
    border: 1px dashed var(--dark-400);
    border-radius: 10px;
    color: var(--light-300);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s;
    flex: 1;
}

.file-input-btn:hover { border-color: var(--brand-orange); }

.file-name {
    font-size: 12px;
    color: var(--light-400);
    margin-top: 4px;
}

.upload-progress {
    margin-top: 8px;
    height: 4px;
    background: var(--dark-500);
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-orange), var(--brand-pink));
    border-radius: 2px;
    transition: width 0.3s;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-orange);
}

.checkbox-group label {
    margin-bottom: 0;
    font-size: 14px;
    color: var(--light-200);
    cursor: pointer;
}

/* ── Breadcrumb ── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--light-400);
}

.breadcrumb a {
    color: var(--brand-orange);
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}

.breadcrumb a:hover { text-decoration: underline; }

.breadcrumb .separator {
    color: var(--light-500);
    font-size: 12px;
}

.breadcrumb .current {
    color: var(--light-200);
    font-weight: 600;
}

/* ── Story Info Card ── */
.story-info-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.story-info-header img {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--dark-500);
}

.story-info-details h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.story-info-details p {
    font-size: 13px;
    color: var(--light-400);
    margin-bottom: 2px;
}

.story-info-meta {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.story-info-meta span {
    font-size: 12px;
    color: var(--light-500);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Category Card Grid (clickable) ── */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.category-card {
    background: var(--dark-600);
    border: 1px solid var(--dark-500);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.1s;
    position: relative;
}

.category-card:hover {
    border-color: var(--brand-orange);
    transform: translateY(-2px);
}

.category-card .cat-color-bar {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    margin-bottom: 12px;
}

.category-card .cat-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.category-card .cat-count {
    font-size: 13px;
    color: var(--light-400);
}

.category-card .cat-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.category-card:hover .cat-actions { opacity: 1; }

/* ── Episode list ── */
.btn-episodes {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255, 122, 26, 0.15);
    border: 1px solid rgba(255, 122, 26, 0.3);
    border-radius: 6px;
    color: var(--brand-orange);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-episodes:hover {
    background: rgba(255, 122, 26, 0.25);
    border-color: var(--brand-orange);
}

.episode-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--dark-600);
    transition: background 0.15s;
}

.episode-row:last-child { border-bottom: none; }
.episode-row:hover { background: var(--dark-600); }

.episode-num {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-pink));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.episode-thumb-wrap {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.episode-thumb-wrap .episode-num {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 22px;
    height: 22px;
    font-size: 11px;
    border-radius: 50%;
    z-index: 1;
}

.episode-thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
}

.episode-info { flex: 1; }

.episode-info .ep-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--light-100);
    margin-bottom: 2px;
}

.episode-info .ep-meta {
    font-size: 12px;
    color: var(--light-500);
}

.episode-actions {
    display: flex;
    gap: 4px;
}

/* Episode section in story form */
.episode-section {
    border: 1px solid var(--dark-500);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.episode-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.episode-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--brand-orange);
}

/* Page actions layout */
.page-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 20px;
}

.page-actions .btn-secondary {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    padding: 14px 24px;
    background: var(--dark-600);
    border: 1px solid var(--dark-500);
    border-radius: var(--radius);
    color: var(--light-100);
    font-size: 14px;
    font-weight: 500;
    z-index: 300;
    animation: toastIn 0.3s ease;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.toast.success { border-left: 3px solid #4ECDC4; }
.toast.error { border-left: 3px solid var(--coral); }

@keyframes toastIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ── Analytics ── */
.analytics-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--dark-600);
}
.analytics-row:last-child { border-bottom: none; }
.analytics-rank {
    width: 24px;
    font-weight: 700;
    color: var(--light-400);
    text-align: center;
    font-size: 13px;
}
.analytics-title {
    flex: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.analytics-bar-wrap {
    width: 120px;
    height: 6px;
    background: var(--dark-600);
    border-radius: 3px;
    overflow: hidden;
}
.analytics-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-orange), var(--brand-pink));
    border-radius: 3px;
    transition: width 0.5s ease;
}
.analytics-value {
    font-weight: 600;
    font-size: 13px;
    min-width: 60px;
    text-align: right;
    color: var(--light-200);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .top-bar { padding: 16px; }
    .page { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .modal { margin: 16px; max-width: calc(100% - 32px); }
    .modal .form-row { grid-template-columns: 1fr; }
    .data-table-container { overflow-x: auto; }
}
