/* ============================================================
   双语影视管理后台 - 现代深色主题 v2.0
   ============================================================ */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b27;
    --bg-tertiary: #1c2333;
    --bg-card: #161d2e;
    --bg-hover: #1e2840;
    --bg-input: #12161f;
    --border-color: #262d42;
    --border-light: #303a56;
    --text-primary: #e8eaf0;
    --text-secondary: #94a0b8;
    --text-muted: #5a6478;
    --accent: #5e6ad2;
    --accent-hover: #4f5ac8;
    --accent-light: rgba(94, 106, 210, 0.12);
    --accent-glow: rgba(94, 106, 210, 0.25);
    --success: #34d399;
    --success-light: rgba(52, 211, 153, 0.12);
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.12);
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.12);
    --info: #60a5fa;
    --info-light: rgba(96, 165, 250, 0.12);
    --purple: #a78bfa;
    --purple-light: rgba(167, 139, 250, 0.12);
    --cyan: #22d3ee;
    --pink: #f472b6;
    --radius: 14px;
    --radius-sm: 8px;
    --radius-lg: 18px;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.35);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ====== Layout ====== */
.admin-layout { display: flex; min-height: 100vh; }

/* ====== Sidebar ====== */
.sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}
.sidebar.collapsed { width: 0; overflow: hidden; }

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--purple), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}
.logo-sub { font-size: 11px; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; }

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    transition: var(--transition);
    font-size: 13.5px;
    position: relative;
}
.nav-item::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 0;
    background: var(--accent);
    border-radius: 2px;
    transition: height 0.2s;
}
.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 500;
}
.nav-item.active::before { height: 60%; }

.nav-icon { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; opacity: 0.8; }
.nav-item.active .nav-icon { opacity: 1; }

/* ====== Main Content ====== */
.main-content {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}
.sidebar.collapsed + .main-content { margin-left: 0; }

/* ====== Topbar ====== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
    display: flex; align-items: center;
}
.menu-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

.page-title { font-size: 17px; font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.admin-name { color: var(--text-secondary); font-size: 13px; }
.btn-logout {
    color: var(--danger);
    text-decoration: none;
    padding: 5px 14px;
    border: 1px solid var(--danger);
    border-radius: 6px;
    transition: var(--transition);
    font-size: 12px;
    opacity: 0.8;
}
.btn-logout:hover { background: var(--danger); color: #fff; opacity: 1; }

/* ====== Content ====== */
.content { flex: 1; padding: 28px; max-width: 1400px; }

/* ====== Page Header ====== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.page-heading { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-desc { color: var(--text-muted); font-size: 13px; }

/* ====== Cards ====== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.card:hover { border-color: var(--border-light); }

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}
.card-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: linear-gradient(180deg, var(--accent), var(--purple));
    border-radius: 2px;
}

/* ====== Dashboard ====== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-md); }

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 100px; height: 100px;
    border-radius: 50%;
    opacity: 0.06;
    transform: translate(30%, -30%);
}
.stat-card.blue::before { background: var(--info); }
.stat-card.green::before { background: var(--success); }
.stat-card.purple::before { background: var(--purple); }
.stat-card.orange::before { background: var(--warning); }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    font-size: 22px;
}
.stat-card.blue .stat-icon { background: var(--info-light); }
.stat-card.green .stat-icon { background: var(--success-light); }
.stat-card.purple .stat-icon { background: var(--purple-light); }
.stat-card.orange .stat-icon { background: var(--warning-light); }

.stat-label { color: var(--text-secondary); font-size: 12px; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-trend { font-size: 12px; margin-top: 6px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.chart-container { height: 300px; }

/* ====== Tables ====== */
.table-wrap { overflow-x: auto; margin: -8px; padding: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

.table-img {
    width: 100px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }

.actions { white-space: nowrap; }
.actions .btn { margin-right: 4px; }

.empty-state {
    text-align: center;
    padding: 48px 20px !important;
    color: var(--text-muted);
    font-size: 14px;
}

/* ====== Forms ====== */
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 6px; color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.required { color: var(--danger); }

.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { min-height: 100px; resize: vertical; }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2394a0b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ====== Buttons ====== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }

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

.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { opacity: 0.9; }

.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ====== Badges ====== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-purple { background: var(--purple-light); color: var(--purple); }

/* ====== Filters Bar ====== */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar .form-input, .filter-bar .form-select { width: auto; min-width: 160px; }

/* ====== Pagination ====== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: var(--transition);
}
.pagination a:hover { background: var(--bg-hover); color: var(--text-primary); }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ====== Modal ====== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.2s ease;
}
.modal-overlay.active { display: flex; }

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 90%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.25s ease;
}

.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 24px; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-color); }

/* ====== Login Page ====== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    opacity: 0.08;
    top: -200px; right: -100px;
    border-radius: 50%;
}
.login-page::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, var(--purple) 0%, transparent 70%);
    opacity: 0.08;
    bottom: -150px; left: -50px;
    border-radius: 50%;
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 44px;
    width: 90%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--accent), var(--purple), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 32px; font-size: 13px; }
.login-box .form-group { margin-bottom: 20px; }
.login-box .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

/* ====== Grid ====== */
.row { display: flex; gap: 20px; flex-wrap: wrap; }
.col { flex: 1; min-width: 200px; }

/* ====== Switch ====== */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border-color); transition: var(--transition); border-radius: 24px;
}
.slider:before {
    position: absolute; content: ''; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: #fff; transition: var(--transition); border-radius: 50%;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(18px); }

.switch-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }

/* ====== Image Preview ====== */
.image-preview { max-width: 200px; max-height: 200px; border-radius: var(--radius-sm); margin-top: 8px; }

/* ====== Config Progress ====== */
.config-progress { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.progress-bar-wrap {
    flex: 1; height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden;
}
.progress-bar { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.progress-text { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }

.config-check-list { display: flex; flex-direction: column; gap: 10px; }
.config-check-item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.check-icon {
    width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.check-icon.success { background: var(--success-light); color: var(--success); }
.check-icon.danger { background: var(--danger-light); color: var(--danger); }
.config-value { font-size: 12px; margin-left: auto; }

/* ====== Callback Info ====== */
.callback-info { }
.callback-item { }
.callback-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.callback-url {
    display: block; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); font-size: 13px; word-break: break-all; color: var(--cyan);
}
.callback-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ====== Test Result ====== */
.test-status { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; margin-bottom: 16px; }
.test-status.success { background: var(--success-light); color: var(--success); }
.test-status.danger { background: var(--danger-light); color: var(--danger); }

.test-table { width: 100%; font-size: 13px; margin-bottom: 16px; }
.test-table td { padding: 8px 12px; border: none; }
.test-table td:first-child { color: var(--text-muted); width: 100px; white-space: nowrap; }

.test-url-box {
    padding: 12px 14px; background: var(--bg-input); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); font-size: 12px; word-break: break-all; color: var(--cyan);
    font-family: 'SF Mono', Monaco, Menlo, monospace;
}

.test-warning {
    margin-top: 12px; padding: 10px 14px; background: var(--warning-light); border-radius: var(--radius-sm);
    color: var(--warning); font-size: 13px;
}

.loading-text { color: var(--text-muted); padding: 20px; text-align: center; }

/* ====== Flash Messages ====== */
.flash-msg {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}
.flash-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(52,211,153,0.2); }
.flash-error { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(248,113,113,0.2); }

@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ====== Responsive ====== */
@media (max-width: 1024px) {
    .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .sidebar .logo-text, .sidebar .logo-sub, .nav-item span { display: none; }
    .main-content { margin-left: 64px; }
    .content { padding: 16px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
    .row { flex-direction: column; }
}
