/* ============================================================
   ICTONE Admin CMS Dashboard - Compact Modern SaaS CSS Design System
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
    --admin-navy: #181F3A;
    --admin-navy-dark: #0F1426;
    --admin-navy-light: #242E52;
    --admin-blue: #2563EB;
    --admin-blue-hover: #1D4ED8;
    --admin-blue-light: rgba(37, 99, 235, 0.08);
    --admin-cyan: #0EA5E9;
    --admin-bg: #F7F9FC;
    --admin-surface: #FFFFFF;
    --admin-border: rgba(24, 31, 58, 0.08);
    --admin-border-strong: rgba(24, 31, 58, 0.14);
    --admin-text-primary: #181F3A;
    --admin-text-muted: #64748B;
    --admin-text-light: #94A3B8;

    /* Semantic Colors */
    --admin-success: #10B981;
    --admin-success-bg: rgba(16, 185, 129, 0.1);
    --admin-warning: #F59E0B;
    --admin-warning-bg: rgba(245, 158, 11, 0.1);
    --admin-danger: #EF4444;
    --admin-danger-bg: rgba(239, 68, 68, 0.1);
    --admin-purple: #8B5CF6;
    --admin-purple-bg: rgba(139, 92, 246, 0.1);

    /* Shadows & Radii */
    --admin-shadow-sm: 0 1px 2px rgba(24, 31, 58, 0.04);
    --admin-shadow-card: 0 2px 8px rgba(24, 31, 58, 0.05);
    --admin-shadow-elevated: 0 10px 25px rgba(24, 31, 58, 0.1);

    --admin-radius-sm: 6px;
    --admin-radius-md: 10px;
    --admin-radius-lg: 14px;
    --admin-radius-pill: 9999px;

    /* Sizing Specs */
    --admin-sidebar-width: 240px;
    --admin-header-height: 62px;
}

/* ── Reset & Global ────────────────────────────────────────── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.admin-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--admin-bg);
    color: var(--admin-text-primary);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    overflow-x: hidden;
}

/* ── Login Overlay Screen ─────────────────────────────────── */
.admin-login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--admin-navy) 0%, #11172A 100%);
    padding: 1.25rem;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--admin-surface);
    border-radius: var(--admin-radius-lg);
    padding: 2.25rem 1.75rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.login-logo {
    height: 36px;
    margin-bottom: 1.25rem;
}

.login-box h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--admin-navy);
    margin-bottom: 0.35rem;
}

.login-box p {
    font-size: 0.85rem;
    color: var(--admin-text-muted);
    margin-bottom: 1.5rem;
}

/* ── Admin Dashboard Layout ────────────────────────────────── */
.admin-app {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar Redesign ──────────────────────────────────────── */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    background-color: var(--admin-navy);
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
    height: var(--admin-header-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-logo img {
    height: 28px;
    filter: brightness(0) invert(1);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.65rem;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748B;
    margin: 0.9rem 0.6rem 0.35rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    color: #94A3B8;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--admin-radius-sm);
    transition: all 0.18s ease;
    cursor: pointer;
    margin-bottom: 0.15rem;
    height: 42px;
}

.sidebar-nav-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    flex-shrink: 0;
}

.sidebar-nav-item:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-nav-item.active {
    color: #FFFFFF;
    background: var(--admin-blue);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.sidebar-footer {
    padding: 0.75rem 0.65rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* ── Main Area ─────────────────────────────────────────────── */
.admin-main {
    flex: 1;
    margin-left: var(--admin-sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Compact Top Header ────────────────────────────────────── */
.admin-header {
    height: var(--admin-header-height);
    background: var(--admin-surface);
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--admin-shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.mobile-sidebar-btn {
    display: none;
    background: none;
    border: none;
    color: var(--admin-text-primary);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: var(--admin-radius-sm);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--admin-text-muted);
}

.breadcrumbs span.current {
    color: var(--admin-text-primary);
    font-weight: 600;
}

.header-center {
    flex: 1;
    max-width: 380px;
    margin: 0 1.5rem;
}

.global-search-wrapper {
    position: relative;
    width: 100%;
}

.global-search-wrapper input {
    width: 100%;
    padding: 0.45rem 0.85rem 0.45rem 2.2rem;
    border: 1px solid var(--admin-border-strong);
    border-radius: var(--admin-radius-sm);
    font-size: 0.82rem;
    font-family: inherit;
    background: var(--admin-bg);
    outline: none;
    transition: all 0.18s ease;
}

.global-search-wrapper input:focus {
    background: var(--admin-surface);
    border-color: var(--admin-blue);
    box-shadow: 0 0 0 3px var(--admin-blue-light);
}

.global-search-wrapper .search-icon {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--admin-text-muted);
    pointer-events: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-icon-btn {
    position: relative;
    background: none;
    border: 1px solid var(--admin-border);
    color: var(--admin-text-muted);
    width: 36px;
    height: 36px;
    border-radius: var(--admin-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
}

.header-icon-btn:hover {
    background: var(--admin-bg);
    color: var(--admin-text-primary);
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    background: var(--admin-blue);
    border-radius: 50%;
    border: 1.5px solid var(--admin-surface);
}

.admin-profile-badge {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--admin-radius-sm);
    transition: background 0.18s ease;
    cursor: pointer;
}

.admin-profile-badge:hover {
    background: var(--admin-bg);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--admin-navy);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--admin-text-primary);
    line-height: 1.2;
}

.profile-role {
    font-size: 0.72rem;
    color: var(--admin-text-muted);
}

/* ── Dashboard Content Container ──────────────────────────── */
.admin-content {
    padding: 1.5rem 1.75rem;
    flex: 1;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

.dashboard-view {
    display: none;
}

.dashboard-view.active {
    display: block;
    animation: viewFadeIn 0.2s ease;
}

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

/* ── Compact Welcome Row (Header Replacement) ─────────────── */
.compact-welcome-row {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-md);
    padding: 1.1rem 1.35rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--admin-shadow-sm);
}

.welcome-text h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--admin-navy);
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.welcome-text p {
    font-size: 0.83rem;
    color: var(--admin-text-muted);
    margin-top: 0.15rem;
}

.page-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.page-header-compact h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--admin-navy);
}

.page-header-compact p {
    font-size: 0.83rem;
    color: var(--admin-text-muted);
    margin-top: 0.15rem;
}

/* ── Compact KPI Cards ─────────────────────────────────────── */
.stats-grid-compact {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card-compact {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-md);
    padding: 1rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    box-shadow: var(--admin-shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    height: 96px;
}

.stat-card-compact:hover {
    transform: translateY(-1px);
    box-shadow: var(--admin-shadow-card);
}

.stat-icon-compact {
    width: 40px;
    height: 40px;
    border-radius: var(--admin-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-blue { background: var(--admin-blue-light); color: var(--admin-blue); }
.stat-icon-green { background: var(--admin-success-bg); color: var(--admin-success); }
.stat-icon-orange { background: var(--admin-warning-bg); color: var(--admin-warning); }
.stat-icon-purple { background: var(--admin-purple-bg); color: var(--admin-purple); }

.stat-info-compact {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.stat-label-compact {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--admin-text-muted);
}

.stat-value-compact {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--admin-navy);
    line-height: 1.15;
    margin-top: 0.1rem;
}

.stat-trend {
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 0.2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.stat-trend.positive { color: var(--admin-success); }
.stat-trend.neutral { color: var(--admin-text-muted); }

/* ── Compact Quick Actions ─────────────────────────────────── */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.quick-action-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: var(--admin-text-primary);
    cursor: pointer;
    box-shadow: var(--admin-shadow-sm);
    transition: all 0.18s ease;
}

.quick-action-card:hover {
    border-color: var(--admin-blue);
    transform: translateY(-1px);
    box-shadow: var(--admin-shadow-card);
    background: var(--admin-surface);
}

.quick-action-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.quick-action-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--admin-radius-sm);
    background: var(--admin-bg);
    color: var(--admin-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quick-action-info {
    display: flex;
    flex-direction: column;
}

.quick-action-title {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--admin-navy);
}

.quick-action-subtitle {
    font-size: 0.72rem;
    color: var(--admin-text-muted);
}

.quick-action-arrow {
    color: var(--admin-text-light);
    transition: transform 0.18s ease, color 0.18s ease;
}

.quick-action-card:hover .quick-action-arrow {
    color: var(--admin-blue);
    transform: translateX(2px);
}

/* ── Dashboard Split Grid (65% Papers / 35% Activity) ───────── */
.dashboard-split-grid {
    display: grid;
    grid-template-columns: 1.75fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* Auto-collapse when only one child element is displayed in split grid */
.dashboard-split-grid > .card-panel-compact:only-of-type,
.dashboard-split-grid > [style*="display: none"] ~ .card-panel-compact:last-child {
    grid-column: 1 / -1;
}

/* ── Data Panels ───────────────────────────────────────────── */
.card-panel-compact {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-md);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--admin-shadow-sm);
    margin-bottom: 1.25rem;
}

.panel-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.panel-header-compact h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--admin-navy);
}

/* ── Recent Activity Vertical Timeline ────────────────────── */
.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.82rem;
}

.timeline-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--admin-bg);
    color: var(--admin-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.timeline-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.timeline-title {
    font-weight: 600;
    color: var(--admin-navy);
    font-size: 0.82rem;
}

.timeline-detail {
    color: var(--admin-text-muted);
    font-size: 0.76rem;
    margin-top: 0.05rem;
}

.timeline-time {
    font-size: 0.7rem;
    color: var(--admin-text-light);
    margin-top: 0.15rem;
}

/* ── Toolbar & Filters Grid ────────────────────────────────── */
.toolbar-grid-compact {
    display: grid;
    grid-template-columns: 1.5fr repeat(4, 1fr);
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.search-input-wrapper-compact {
    position: relative;
}

.search-input-wrapper-compact input {
    width: 100%;
    padding: 0.45rem 0.85rem 0.45rem 2.2rem;
    border: 1px solid var(--admin-border-strong);
    border-radius: var(--admin-radius-sm);
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.18s;
}

.search-input-wrapper-compact input:focus {
    border-color: var(--admin-blue);
    box-shadow: 0 0 0 3px var(--admin-blue-light);
}

.search-input-wrapper-compact .search-icon {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--admin-text-muted);
    pointer-events: none;
}

.admin-select-compact {
    width: 100%;
    padding: 0.45rem 1.8rem 0.45rem 0.75rem;
    border: 1px solid var(--admin-border-strong);
    border-radius: var(--admin-radius-sm);
    font-size: 0.82rem;
    font-family: inherit;
    background-color: var(--admin-surface);
    color: var(--admin-text-primary);
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 0.85rem;
}

.admin-select-compact:focus {
    border-color: var(--admin-blue);
}

/* ── Data Tables ───────────────────────────────────────────── */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

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

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

.admin-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--admin-border);
    color: var(--admin-text-primary);
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: background-color 0.15s ease;
}

.admin-table tbody tr:hover {
    background-color: #F1F5F9;
}

/* Status Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--admin-radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-published {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.badge-unpublished {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
}

.dot-indicator {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

/* Action Icon Buttons */
.table-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-icon-sm {
    background: none;
    border: 1px solid var(--admin-border);
    color: var(--admin-text-muted);
    width: 28px;
    height: 28px;
    border-radius: var(--admin-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
}

.btn-icon-sm:hover {
    color: var(--admin-blue);
    border-color: var(--admin-blue);
    background: var(--admin-blue-light);
}

.btn-icon-sm.danger:hover {
    color: var(--admin-danger);
    border-color: var(--admin-danger);
    background: var(--admin-danger-bg);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn-admin {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.82rem;
    border-radius: var(--admin-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.18s ease;
    text-decoration: none;
    font-family: inherit;
    height: 36px;
    white-space: nowrap;
}

.btn-admin-primary {
    background: var(--admin-blue);
    color: #FFFFFF;
}

.btn-admin-primary:hover {
    background: var(--admin-blue-hover);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-admin-secondary {
    background: var(--admin-surface);
    border-color: var(--admin-border-strong);
    color: var(--admin-text-primary);
}

.btn-admin-secondary:hover {
    background: var(--admin-bg);
}

.btn-admin-danger {
    background: var(--admin-danger);
    color: #FFFFFF;
}

.btn-admin-danger:hover {
    background: #DC2626;
}

/* ── Compact 2-Column Form Layout ──────────────────────────── */
.admin-form-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.form-group-full {
    grid-column: span 2;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--admin-navy);
}

.form-field input[type="text"],
.form-field input[type="url"],
.form-field input[type="password"],
.form-field select {
    width: 100%;
    height: 42px;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--admin-border-strong);
    border-radius: var(--admin-radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.18s;
    background: var(--admin-surface);
}

.form-field input:focus,
.form-field select:focus {
    border-color: var(--admin-blue);
    box-shadow: 0 0 0 3px var(--admin-blue-light);
}

/* ── XML Stepper UI ────────────────────────────────────────── */
.xml-workflow-steps-compact {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    position: relative;
}

.xml-workflow-steps-compact::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--admin-border-strong);
    z-index: 0;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    gap: 0.25rem;
}

.step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #E2E8F0;
    color: var(--admin-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
}

.step-item.active .step-num {
    background: var(--admin-blue);
    color: #FFFFFF;
}

.step-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--admin-text-muted);
}

.file-dropzone-compact {
    border: 2px dashed var(--admin-border-strong);
    border-radius: var(--admin-radius-md);
    padding: 1.75rem 1.25rem;
    text-align: center;
    background: #F8FAFC;
    cursor: pointer;
    transition: all 0.18s ease;
}

.file-dropzone-compact:hover {
    border-color: var(--admin-blue);
    background: var(--admin-blue-light);
}

/* ── Modal Component ───────────────────────────────────────── */
.admin-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 38, 0.45);
    backdrop-filter: blur(2px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.admin-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.admin-modal {
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--admin-surface);
    border-radius: var(--admin-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--admin-shadow-elevated);
    transform: translateY(8px);
    transition: transform 0.18s ease;
}

.admin-modal-overlay.active .admin-modal {
    transform: translateY(0);
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--admin-navy);
}

.modal-body {
    margin: 0.85rem 0 1.25rem;
    color: var(--admin-text-muted);
    font-size: 0.85rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ── Popup Windows (Review Modal, Unlock Confirmation & Reset History) ───── */
.admin-popup-overlay,
#adminReviewModal,
#adminUnlockConfirmModal,
#adminResetHistoryConfirmModal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.72) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    z-index: 99999 !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem !important;
    box-sizing: border-box !important;
}

#adminReviewModal .modal-container,
.admin-popup-overlay .modal-container {
    background: #FFFFFF !important;
    border-radius: 16px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(226, 232, 240, 0.8) !important;
    max-width: 1100px !important;
    width: 95% !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    animation: adminPopupScaleIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

#adminUnlockConfirmModal .modal-container,
#adminResetHistoryConfirmModal .modal-container {
    background: #FFFFFF !important;
    border-radius: 16px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(226, 232, 240, 0.8) !important;
    max-width: 520px !important;
    width: 92% !important;
    animation: adminPopupScaleIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes adminPopupScaleIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ── Toast Notifications ───────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-toast {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 1rem;
    background: var(--admin-navy);
    color: #FFFFFF;
    border-radius: var(--admin-radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    font-size: 0.82rem;
    font-weight: 500;
    animation: toastIn 0.22s ease;
}

.admin-toast.success { border-left: 3px solid var(--admin-success); }
.admin-toast.error { border-left: 3px solid var(--admin-danger); }
.admin-toast.info { border-left: 3px solid var(--admin-cyan); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ── Responsive Breakpoints ────────────────────────────────── */
@media (max-width: 1200px) {
    .stats-grid-compact,
    .quick-actions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .dashboard-split-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .toolbar-grid-compact {
        grid-template-columns: 1fr 1fr;
    }
    .header-center {
        display: none;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
    }
    .mobile-sidebar-btn {
        display: block;
    }
    .stats-grid-compact,
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
    .toolbar-grid-compact,
    .admin-form-grid-compact {
        grid-template-columns: 1fr;
    }
    .form-group-full {
        grid-column: span 1;
    }
    .compact-welcome-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* ── Switch Toggle Component ───────────────────────────────── */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: 0.25s ease;
    border-radius: 24px;
}
.switch-toggle .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.25s ease;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.switch-toggle input:checked + .slider {
    background-color: #0284c7;
}
.switch-toggle input:checked + .slider:before {
    transform: translateX(20px);
}

/* ── Verify Student Modal & QR Scanner Styles (Phase 3) ───── */
.verify-tabs {
    background: #F1F5F9;
    padding: 4px;
    border-radius: 10px;
}
.verify-tab-btn {
    background: transparent;
    color: #64748B;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}
.verify-tab-btn:hover {
    color: #0F172A;
}
.verify-tab-btn.active {
    background: #FFFFFF;
    color: #0284C7;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

#adminQrScannerVideoBox {
    position: relative;
    background: #0F172A;
    border-radius: 12px;
    overflow: hidden;
}
#adminQrScannerVideoBox video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 10px;
}
#adminQrScannerVideoBox #qr-shaded-region {
    border-color: rgba(2, 132, 199, 0.4) !important;
}

.verified-badge {
    background: #ECFDF5;
    color: #059669;
    border: 1px solid #A7F3D0;
    font-weight: 800;
    font-size: 0.74rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.academic-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
}

@media (max-width: 640px) {
    .academic-summary-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Admin Analytics Charts & Visuals (Step 10) ────────────── */
.analytics-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 900px) {
    .analytics-charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-container-wrapper {
    position: relative;
    width: 100%;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-loading-overlay,
.chart-empty-overlay {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    font-weight: 500;
}

@keyframes spinIcon {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinning {
    animation: spinIcon 0.85s linear infinite;
}

/* ============================================================
   HOMEPAGE CONTENT MANAGER (ADVERTISEMENTS & VIDEOS)
   ============================================================ */

.hpc-main-tabs {
    display: flex;
    gap: 0.5rem;
}

.hpc-main-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.15rem;
    border: none;
    background: transparent;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--admin-text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.18s ease;
    border-radius: 6px 6px 0 0;
}

.hpc-main-tab-btn:hover {
    color: var(--admin-navy);
    background: rgba(241, 245, 249, 0.6);
}

.hpc-main-tab-btn.active {
    color: var(--admin-blue);
    border-bottom-color: var(--admin-blue);
    background: transparent;
    font-weight: 700;
}

.hpc-badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 18px;
    padding: 0 0.35rem;
    border-radius: 9999px;
    background: #E2E8F0;
    color: #475569;
}

.hpc-main-tab-btn.active .hpc-badge-count {
    background: var(--admin-blue-light);
    color: var(--admin-blue);
}

.hpc-subtabs {
    display: flex;
    gap: 0.4rem;
}

.hpc-subtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    border: 1px solid #E2E8F0;
    background: #F8FAFC;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748B;
    cursor: pointer;
    transition: all 0.18s ease;
}

.hpc-subtab-btn:hover {
    border-color: #CBD5E1;
    color: var(--admin-navy);
}

.hpc-subtab-btn.active {
    background: var(--admin-navy);
    border-color: var(--admin-navy);
    color: #FFFFFF;
}

.hpc-subtab-count {
    font-size: 0.68rem;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
}

.hpc-subtab-btn.active .hpc-subtab-count {
    background: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
}

/* ── Placement Radio Card Selector ── */
.hpc-placement-radio-card {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem 0.9rem;
    border: 1.5px solid #E2E8F0;
    border-radius: 10px;
    cursor: pointer;
    background: #F8FAFC;
    transition: all 0.18s ease;
}

.hpc-placement-radio-card:hover {
    border-color: #93C5FD;
    background: #EFF6FF;
}

.hpc-placement-radio-card input[type="radio"] {
    margin-top: 0.2rem;
    accent-color: #0284C7;
    cursor: pointer;
}

.hpc-placement-radio-card.selected {
    border-color: #0284C7;
    background: #F0F9FF;
}

.hpc-radio-content strong {
    display: block;
    font-size: 0.82rem;
    color: #0F172A;
}

.hpc-radio-content span {
    display: block;
    font-size: 0.72rem;
    color: #64748B;
    margin-top: 0.1rem;
}

/* ── Drag and Drop Zone ── */
.hpc-dropzone {
    border: 2px dashed #CBD5E1;
    border-radius: 12px;
    background: #F8FAFC;
    transition: all 0.2s ease;
    overflow: hidden;
}

.hpc-dropzone.dragover {
    border-color: #0284C7;
    background: #F0F9FF;
}

/* ── Ad Item Card ── */
.hpc-ad-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 0.9rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 1.1rem;
    transition: all 0.18s ease;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.hpc-ad-card:hover {
    border-color: #CBD5E1;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.hpc-ad-card.inactive {
    opacity: 0.75;
    background: #FAFAFA;
}

.hpc-ad-thumb {
    width: 140px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    background: #0F172A;
    flex-shrink: 0;
    border: 1px solid #E2E8F0;
}

.hpc-ad-thumb.portrait {
    width: 60px;
    height: 84px;
}

.hpc-ad-details {
    flex: 1;
    min-width: 0;
}

.hpc-ad-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.hpc-ad-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0F172A;
    margin: 0;
}

.hpc-ad-meta {
    font-size: 0.76rem;
    color: #64748B;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.hpc-ad-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

/* ── Video Card ── */
.hpc-video-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: all 0.18s ease;
}

.hpc-video-card:hover {
    border-color: #CBD5E1;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.hpc-video-card.inactive {
    opacity: 0.75;
}

.hpc-video-thumb-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0F172A;
    overflow: hidden;
}

.hpc-video-thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hpc-video-play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.25);
    color: #FFFFFF;
    transition: background 0.18s;
}

.hpc-video-card:hover .hpc-video-play-icon {
    background: rgba(15, 23, 42, 0.1);
}

.hpc-video-body {
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.hpc-video-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0F172A;
    margin: 0 0 0.35rem 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hpc-video-meta {
    font-size: 0.74rem;
    color: #64748B;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hpc-video-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.65rem;
    border-top: 1px solid #F1F5F9;
}

/* ── Badges ── */
.hpc-badge-type {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: #F1F5F9;
    color: #475569;
}

.hpc-badge-type.class {
    background: #E0F2FE;
    color: #0369A1;
}

.hpc-badge-type.sponsored {
    background: #FEF3C7;
    color: #B45309;
}

.hpc-badge-type.announcement {
    background: #F3E8FF;
    color: #7E22CE;
}

.hpc-badge-status {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.hpc-badge-status.active {
    background: #DCFCE7;
    color: #15803D;
}

.hpc-badge-status.inactive {
    background: #F1F5F9;
    color: #64748B;
}

.hpc-badge-schedule {
    font-size: 0.68rem;
    font-weight: 600;
    color: #6366F1;
    background: #EEF2FF;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

/* ── Empty State ── */
.hpc-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    background: #FFFFFF;
    border-radius: 12px;
    border: 1px dashed #CBD5E1;
    color: #64748B;
}

.hpc-empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #F1F5F9;
    color: #94A3B8;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem auto;
}

/* ── Responsive Refinements ── */
@media (max-width: 768px) {
    .hpc-ad-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .hpc-ad-thumb {
        width: 100%;
        height: 140px;
    }
    .hpc-ad-thumb.portrait {
        width: 100%;
        height: 160px;
    }
    .hpc-ad-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: 0.5rem;
        border-top: 1px solid #F1F5F9;
    }
    .hpc-nav-tabs-bar {
        padding: 0.75rem 1rem 0;
    }
    .hpc-modal-body {
        padding: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hpc-main-tab-btn,
    .hpc-subtab-btn,
    .hpc-ad-card,
    .hpc-video-card,
    .hpc-dropzone {
        transition: none !important;
    }
}


