/* ==========================================================================
   Admin Panel Stylesheet
   Modern, Clean, Responsive Dashboard
   ========================================================================== */

:root {
    --adm-bg: #0f172a;
    --adm-card: #1e293b;
    --adm-card-border: #334155;
    --adm-primary: #3b82f6;
    --adm-primary-hover: #2563eb;
    --adm-danger: #ef4444;
    --adm-danger-hover: #dc2626;
    --adm-success: #10b981;
    --adm-amber: #f59e0b;
    --adm-purple: #8b5cf6;
    --adm-text: #f8fafc;
    --adm-text-muted: #94a3b8;
    --adm-input-bg: #0f172a;
    --adm-radius: 10px;
    --adm-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body.admin-body {
    font-family: var(--adm-font);
    background-color: var(--adm-bg);
    color: var(--adm-text);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Admin Login Screen
   ========================================================================== */

body.admin-login-body {
    font-family: var(--adm-font);
    background-color: #0b0f19;
    color: var(--adm-text);
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: #151d2f;
    border: 1px solid #232f48;
    border-radius: 16px;
    padding: 2.25rem 1.75rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo-badge {
    display: inline-block;
    background: rgba(59, 130, 246, 0.15);
    color: var(--adm-primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    margin-bottom: 0.75rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.25rem;
}

.login-header p {
    font-size: 0.85rem;
    color: var(--adm-text-muted);
}

.login-tip {
    background: #0f172a;
    border: 1px dashed #334155;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.login-tip code {
    color: #60a5fa;
    font-weight: bold;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--adm-text-muted);
}

.login-footer a {
    color: #94a3b8;
    text-decoration: none;
}

.login-footer a:hover {
    color: #fff;
}

/* ==========================================================================
   Admin Navigation Bar
   ========================================================================== */

.admin-navbar {
    background-color: #151d2f;
    border-bottom: 1px solid #232f48;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.navbar-brand .brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
}

.brand-badge {
    background: #e11d48;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.admin-label {
    background: #232f48;
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    color: #94a3b8;
}

.navbar-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.nav-link {
    color: var(--adm-text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    color: #fff;
    background: #232f48;
}

.btn-nav-upload {
    background: var(--adm-primary) !important;
    color: #fff !important;
}

.btn-nav-upload:hover {
    background: var(--adm-primary-hover) !important;
}

.nav-link-logout {
    color: #f87171 !important;
}

.nav-link-logout:hover {
    background: rgba(239, 68, 68, 0.15) !important;
}

/* ==========================================================================
   Admin Container & Stats
   ========================================================================== */

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    flex: 1;
    width: 100%;
}

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

.page-title-row h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--adm-text-muted);
    margin-top: 0.2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--adm-card);
    border: 1px solid var(--adm-card-border);
    border-radius: var(--adm-radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.stat-icon-green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-icon-purple { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.stat-icon-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.stat-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--adm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
}

.stat-subtext {
    font-size: 0.75rem;
    color: #cbd5e1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   Content Cards & Tables
   ========================================================================== */

.content-card {
    background: var(--adm-card);
    border: 1px solid var(--adm-card-border);
    border-radius: var(--adm-radius);
    padding: 1.5rem;
    margin-bottom: 1.75rem;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--adm-card-border);
    padding-bottom: 0.75rem;
}

.card-header-row h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
}

.table-toolbar {
    margin-bottom: 1rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    max-width: 450px;
}

.search-input-wrap {
    position: relative;
    flex: 1;
}

.btn-clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--adm-text-muted);
    font-size: 0.8rem;
    text-decoration: none;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.admin-table th {
    background: #141d2e;
    color: var(--adm-text-muted);
    padding: 0.75rem 0.85rem;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--adm-card-border);
    white-space: nowrap;
}

.admin-table td {
    padding: 0.85rem;
    border-bottom: 1px solid #28354c;
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: #232f48;
}

.col-thumb {
    width: 60px;
}

.table-thumb-img {
    width: 54px;
    height: 38px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
    background: #000;
}

.table-thumb-placeholder {
    width: 54px;
    height: 38px;
    background: #0f172a;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.table-video-title-box {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 160px;
}

.code-id {
    background: #0f172a;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: #60a5fa;
    font-family: monospace;
    font-weight: bold;
}

.badge-count {
    background: #0f172a;
    color: #94a3b8;
    padding: 0.2rem 0.5rem;
    border-radius: 50px;
    font-weight: bold;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 700;
}

.status-active { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.status-missing { background: rgba(239, 68, 68, 0.15); color: #f87171; }

.url-copy-box {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 200px;
}

.input-url-readonly {
    background: #0f172a;
    border: 1px solid #334155;
    color: #cbd5e1;
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    width: 140px;
    outline: none;
}

.actions-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   Buttons, Forms & Controls
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary { background: var(--adm-primary); color: #fff; }
.btn-primary:hover { background: var(--adm-primary-hover); }

.btn-secondary { background: #334155; color: #fff; }
.btn-secondary:hover { background: #475569; }

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

.btn-outline { background: transparent; border: 1px solid #475569; color: #cbd5e1; }
.btn-outline:hover { background: #334155; color: #fff; }

.btn-xs { padding: 0.25rem 0.55rem; font-size: 0.75rem; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }

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

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 0.4rem;
}

.form-label.required::after {
    content: " *";
    color: var(--adm-danger);
}

.form-input {
    width: 100%;
    background-color: var(--adm-input-bg);
    border: 1px solid var(--adm-card-border);
    color: #fff;
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-input:focus {
    border-color: var(--adm-primary);
}

.form-help {
    display: block;
    font-size: 0.75rem;
    color: var(--adm-text-muted);
    margin-top: 0.3rem;
}

/* File Drop Zone */
.file-drop-zone {
    border: 2px dashed #475569;
    background: #141d2e;
    border-radius: 10px;
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-drop-zone:hover, .file-drop-zone.dragover {
    border-color: var(--adm-primary);
    background: #19243a;
}

.file-input-hidden {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #94a3b8;
}

.drop-zone-title {
    font-weight: 700;
    color: #fff;
    font-size: 0.95rem;
}

.drop-zone-hint {
    font-size: 0.78rem;
}

.file-name-preview {
    font-size: 0.85rem;
    color: #38bdf8;
    font-weight: 700;
}

/* Upload Progress */
.upload-progress-container {
    margin: 1.25rem 0;
}

.progress-bar-track {
    background: #0f172a;
    border-radius: 50px;
    height: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    background: linear-gradient(90deg, #3b82f6, #10b981);
    height: 100%;
    transition: width 0.2s ease;
}

.progress-text-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--adm-text-muted);
    margin-top: 0.4rem;
}

/* Alerts & Toasts */
.alert {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.15rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.alert-success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.alert-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

.toast-popup {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: #10b981;
    color: #0b141a;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast-popup.show {
    opacity: 1;
    transform: translateY(0);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}
