@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --admin-bg: #0b0f19;
    --admin-sidebar: #111827;
    --admin-card: #1f2937;
    --admin-border: #374151;
    --admin-text: #f9fafb;
    --admin-muted: #9ca3af;
    --admin-accent: #38bdf8;
    --admin-accent-hover: #0284c7;
    --admin-danger: #ef4444;
    --admin-success: #10b981;
    --admin-warning: #f59e0b;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Plus Jakarta Sans', sans-serif; }

body {
    background: var(--admin-bg);
    color: var(--admin-text);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: var(--admin-sidebar);
    border-right: 1px solid var(--admin-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    padding: 24px;
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-nav {
    list-style: none;
    padding: 20px 12px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--admin-muted);
    font-weight: 600;
    font-size: 14px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-item a:hover, .nav-item.active a {
    color: #fff;
    background: rgba(56, 189, 248, 0.12);
    color: var(--admin-accent);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--admin-border);
}

/* Main Container */
.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.admin-title {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
}

/* Cards & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 16px;
    padding: 20px;
}

.stat-number {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    margin: 8px 0;
}

.stat-label {
    color: var(--admin-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Data Tables */
.table-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 30px;
}

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

.admin-table th, .admin-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--admin-border);
}

.admin-table th {
    background: rgba(0, 0, 0, 0.2);
    color: var(--admin-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
}

.admin-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges & Buttons */
.badge {
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #f87171; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--admin-accent);
    color: #fff;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s ease;
}

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

.btn-danger { background: var(--admin-danger); }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--admin-muted);
    margin-bottom: 8px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--admin-accent);
}

.form-textarea { min-height: 140px; resize: vertical; }

/* Modal & Media Selector */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 20px;
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}

.media-item {
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: #000;
}

.media-item.selected, .media-item:hover {
    border-color: var(--admin-accent);
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}/* Custom Confirmation Modal */
.custom-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(9, 13, 22, 0.8);
    backdrop-filter: blur(8px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease-in-out;
}

.custom-modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.custom-modal-box {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    border-radius: 16px;
    padding: 32px;
    width: 90%;
    max-width: 440px;
    text-align: center;
    transform: scale(0.85);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-modal-backdrop.active .custom-modal-box {
    transform: scale(1);
}

.modal-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 16px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.modal-icon-wrapper.danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.modal-text {
    font-size: 14px;
    color: #94a3b8;
    line-height: 1.5;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-actions .btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
}

.btn-secondary {
    background: #334155;
    color: #cbd5e1;
    border: 1px solid #475569;
}

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

/* Toast Notifications System */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 380px;
    width: calc(100% - 48px);
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.warning { border-left: 4px solid #f59e0b; }
.toast.info { border-left: 4px solid #38bdf8; }

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-body {
    flex: 1;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s ease;
}

.toast-close:hover {
    color: #fff;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    animation: toastProgress 4s linear forwards;
}

.toast.success .toast-progress { background: #10b981; }
.toast.error .toast-progress { background: #ef4444; }
.toast.warning .toast-progress { background: #f59e0b; }
.toast.info .toast-progress { background: #38bdf8; }

/* Mobile Toggle Button (Hidden by default on Desktop) */
.mobile-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    color: #fff;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-sidebar-toggle:hover {
    background: #374151;
    color: var(--admin-accent);
}

/* Sidebar Backdrop */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(9, 13, 22, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Table Responsive Wrappers */
.table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-card table {
    width: 100%;
    min-width: 600px;
}

/* ---------------------------------------------------- */
/* RESPONSIVE MEDIA QUERIES                              */
/* ---------------------------------------------------- */

@media (max-width: 992px) {
    .mobile-sidebar-toggle {
        display: inline-flex;
    }

    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.7);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 20px 16px !important;
    }

    .admin-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 24px;
    }

    .admin-title {
        font-size: 22px;
    }

    /* Force 2-column grid forms into single column on tablets & phones */
    div[style*="grid-template-columns: 2.2fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
        gap: 12px !important;
    }

    .stat-card {
        padding: 16px !important;
    }

    .stat-number {
        font-size: 24px !important;
    }
}

@media (max-width: 640px) {
    .admin-header {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-header > div {
        justify-content: space-between;
    }

    .admin-header .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* Filter Form Stack */
    form[method="GET"] {
        flex-direction: column !important;
        width: 100%;
    }

    form[method="GET"] input,
    form[method="GET"] select {
        width: 100% !important;
    }

    .table-card {
        padding: 16px !important;
        border-radius: 12px !important;
    }

    .modal-actions {
        flex-direction: column;
    }
}

