@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-width: 260px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --glass: rgba(255, 255, 255, 0.7);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    color: #94a3b8;
    position: fixed;
    height: 100vh;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar>div:nth-child(2) {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    font-weight: 800;
}

.nav-links a {
    color: #94a3b8;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    border-radius: 10px;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.nav-links a i {
    opacity: 0.7;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(3px);
}

.nav-links a.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-links a.active i {
    opacity: 1;
}

/* ── Alert / Flash Messages ─────────────────────────── */
.alert {
    padding: 14px 20px 14px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left-width: 4px;
    border-left-style: solid;
    animation: alertSlideIn 0.3s ease;
}

.alert::before {
    font-size: 16px;
    flex-shrink: 0;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #10b981;
    border-left-color: #10b981;
}

.alert-success::before {
    content: "✓";
    color: #10b981;
    font-weight: 900;
}

.alert-danger,
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #ef4444;
    border-left-color: #ef4444;
}

.alert-danger::before,
.alert-error::before {
    content: "✕";
    color: #ef4444;
    font-weight: 900;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: #f59e0b;
    border-left-color: #f59e0b;
}

.alert-warning::before {
    content: "⚠";
    color: #f59e0b;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #3b82f6;
    border-left-color: #3b82f6;
}

.alert-info::before {
    content: "ℹ";
    color: #3b82f6;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 0 30px 30px 30px;
    background: var(--bg-main);
}

/* Cards & Sections */
.stat-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    border-color: var(--primary);
}

/* Fix sidebar bullet points */
.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Modal Overlay - Icon Picker & others */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    font-size: 11px;
    color: #64748b;
    text-align: center;
}

.icon-item:hover {
    background: #f1f5f9;
    border-color: var(--primary);
    color: var(--primary);
}

.color-item {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-block;
    margin: 4px;
    border: 2px solid transparent;
    transition: transform 0.15s;
}

.color-item:hover {
    transform: scale(1.2);
    border-color: #fff;
    outline: 2px solid #94a3b8;
}

/* Danger button */
.btn-danger {
    background: #fef2f2;
    color: #ef4444;
    border-color: #fecaca;
}

.btn-danger:hover {
    background: #ef4444;
    color: white;
}


/* Responsive Overrides */
@media (max-width: 1024px) {
    .sidebar {
        left: -300px;
        width: 280px !important;
    }

    .sidebar.mobile-active {
        left: 0;
        box-shadow: 25px 0 80px rgba(0, 0, 0, 0.5);
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 15px 15px 15px;
    }

    .mobile-toggle {
        display: flex !important;
    }
}

@media (max-width: 640px) {
    .header-quick-actions {
        display: none !important;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Base UI Components (Restored & Enhanced) */
.btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
}

.content-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
}

.content-table th {
    background: #f8fafc;
    padding: 15px 20px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #f1f5f9;
}

.content-table td {
    padding: 18px 20px;
    background: white;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    vertical-align: middle;
}

.content-table tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-published {
    background: #ecfdf5;
    color: #10b981;
}

.badge-draft {
    background: #fffbeb;
    color: #f59e0b;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}