/* ==========================================================================
   EMA KIRTASİYE — ADMIN DASHBOARD STYLESHEET (admin.css)
   Pure CSS3 | Corporate Navy Theme (#0F172A / #1E3A8A)
   ========================================================================== */

:root {
    --navy-950: #0F172A;
    --navy-900: #1E293B;
    --navy-800: #1E3A8A;
    --navy-700: #1D4ED8;
    --blue-600: #2563EB;
    --blue-500: #3B82F6;
    --blue-100: #DBEAFE;
    --blue-50:  #EFF6FF;

    --green-600: #059669;
    --green-500: #10B981;
    --green-100: #D1FAE5;
    
    --amber-600: #D97706;
    --amber-500: #F59E0B;
    --amber-100: #FEF3C7;

    --red-600: #DC2626;
    --red-100: #FEE2E2;

    --bg-main: #F1F5F9;
    --bg-card: #FFFFFF;
    --border:  #E2E8F0;

    --text-main: #0F172A;
    --text-muted: #64748B;
    --text-light: #94A3B8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --ease: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    overflow-x: hidden;
}

body {
    font-family: var(--font);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ── Layout Wrapper ── */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
    max-width: 100%;
    overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   1. SIDEBAR NAVIGATION
   -------------------------------------------------------------------------- */
.admin-sidebar {
    width: 260px;
    /* Layered gradient: deep navy with subtle blue tint at bottom */
    background: linear-gradient(180deg, #0D1526 0%, #0F172A 60%, #111827 100%);
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25), inset -1px 0 0 rgba(255, 255, 255, 0.04);
    /* Luminous top accent line */
    border-top: 2px solid transparent;
    border-image: linear-gradient(90deg, #2563EB, #7C3AED, #059669) 1;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand .site-logo-img {
    height: 42px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-icon {
    font-size: 1.75rem;
    background: rgba(255, 255, 255, 0.1);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-title {
    display: block;
    font-weight: 800;
    font-size: 1.1rem;
    color: #FFFFFF;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    display: block;
    font-size: 0.75rem;
    color: var(--blue-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--ease);
}

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

.nav-item.active {
    background: linear-gradient(135deg, var(--blue-600) 0%, #1D4ED8 100%);
    color: #FFFFFF;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.45), inset 0 1px 0 rgba(255,255,255,0.1);
    /* Left-side accent stripe */
    border-left: 3px solid rgba(255, 255, 255, 0.6);
    padding-left: calc(1rem - 3px); /* compensate for border */
}

.nav-icon {
    font-size: 1.15rem;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn-site-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--ease);
}

.btn-site-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--navy-800);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--blue-500);
}

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

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #FFFFFF;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-light);
}


/* --------------------------------------------------------------------------
   2. MAIN CONTENT AREA & HEADER
   -------------------------------------------------------------------------- */
.admin-main {
    margin-left: 260px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-header {
    /* Glassmorphism header */
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 2px 16px rgba(15, 23, 42, 0.06), 0 1px 0 rgba(255,255,255,0.9) inset;
}

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

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--navy-950);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background-color: var(--green-100);
    color: var(--green-600);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    background-color: var(--green-500);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

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

.header-search {
    position: relative;
    width: 240px;
}

.header-search input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.2rem;
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: var(--ease);
}

.header-search input:focus {
    outline: none;
    border-color: var(--blue-600);
    background-color: #FFFFFF;
}

.header-search .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.icon-btn {
    position: relative;
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--ease);
    touch-action: manipulation;
}

.icon-btn:hover {
    background-color: var(--border);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--red-600);
    color: #FFFFFF;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
}

.content-container {
    padding: 2rem;
    flex-grow: 1;
}

/* ── Dynamic Tab Switching ── */
.tab-content {
    display: none;
    animation: fadeIn 0.25s ease-in-out;
}

.tab-content.active {
    display: block;
}

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


/* --------------------------------------------------------------------------
   3. TAB 1: DASHBOARD (KPI CARDS & CHARTS)
   -------------------------------------------------------------------------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.kpi-card {
    /* Glassmorphism KPI card */
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.07), 0 1px 0 rgba(255,255,255,0.9) inset;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease;
    position: relative;
    overflow: hidden;
}

/* Gradient top-accent per card type — applied via extra class on each card */
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--blue-600), #7C3AED);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.kpi-card.kpi-green::before  { background: linear-gradient(90deg, var(--green-500), #34D399); }
.kpi-card.kpi-amber::before  { background: linear-gradient(90deg, var(--amber-500), #FCD34D); }
.kpi-card.kpi-purple::before { background: linear-gradient(90deg, #9333EA, #C084FC); }

.kpi-card:hover {
    transform: translateY(-5px) scale(1.015);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.13), 0 4px 12px rgba(37, 99, 235, 0.1);
}

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.kpi-icon.blue { background-color: var(--blue-50); color: var(--blue-600); }
.kpi-icon.purple { background-color: #F3E8FF; color: #9333EA; }
.kpi-icon.green { background-color: var(--green-100); color: var(--green-600); }
.kpi-icon.amber { background-color: var(--amber-100); color: var(--amber-600); }

.kpi-data {
    display: flex;
    flex-direction: column;
}

.kpi-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--navy-950);
    line-height: 1.2;
}

.kpi-sub {
    font-size: 0.725rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.kpi-sub.green { color: var(--green-600); }
.kpi-sub.amber { color: var(--amber-600); }

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
}

.chart-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy-950);
}

.chart-container {
    position: relative;
    width: 100%;
    height: 280px;
}


/* --------------------------------------------------------------------------
   4. DATA TABLES (PRODUCTS & INQUIRIES)
   -------------------------------------------------------------------------- */
.data-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
}

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

.admin-table th {
    background-color: var(--bg-main);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    vertical-align: middle;
}

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

.admin-table tbody tr {
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.admin-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(37,99,235,0.05) 0%, rgba(37,99,235,0.02) 100%);
    box-shadow: inset 3px 0 0 var(--blue-600);
}

.prod-thumb {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background-color: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 1px solid var(--border);
}

.status-pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.725rem;
    font-weight: 600;
}

.status-success { background-color: var(--green-100); color: var(--green-600); }
.status-warning { background-color: var(--amber-100); color: var(--amber-600); }
.status-danger  { background-color: var(--red-100); color: var(--red-600); }

.table-badge {
    background-color: var(--bg-main);
    color: var(--text-main);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--border);
}

/* Table Toolbar */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-grow: 1;
}

.table-search {
    position: relative;
    min-width: 280px;
}

.table-search input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    font-size: 0.85rem;
}

.table-search input:focus {
    outline: none;
    border-color: var(--blue-600);
}

.table-search .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.table-select {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    font-size: 0.85rem;
    color: var(--text-main);
    cursor: pointer;
}


/* --------------------------------------------------------------------------
   5. BUTTONS & FORMS
   -------------------------------------------------------------------------- */
.btn-primary {
    background: linear-gradient(135deg, var(--blue-600) 0%, #1D4ED8 100%);
    color: #FFFFFF;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 100%);
    border-radius: inherit;
    pointer-events: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1D4ED8 0%, #1E3A8A 100%);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: scale(0.97) translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--navy-950) 0%, #1E293B 100%);
    color: #FFFFFF;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: scale(0.97);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--ease);
}

.btn-outline:hover {
    background-color: var(--bg-main);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background-color: var(--bg-card);
    cursor: pointer;
    font-weight: 600;
    transition: var(--ease);
}

.btn-sm:hover {
    background-color: var(--blue-50);
    border-color: var(--blue-600);
    color: var(--blue-600);
}

.btn-danger-sm {
    background-color: var(--red-100);
    color: var(--red-600);
    border: 1px solid transparent;
}

.btn-danger-sm:hover {
    background-color: var(--red-600);
    color: #FFFFFF;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--navy-950);
    margin-bottom: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background-color: var(--bg-card);
    transition: var(--ease);
}

.form-control:focus {
    outline: none;
    border-color: var(--blue-600);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.divider {
    border: 0;
    height: 1px;
    background: var(--border);
    margin: 1.25rem 0;
}


/* --------------------------------------------------------------------------
   6. TAB 3 & 4 SPECIFIC STYLES
   -------------------------------------------------------------------------- */
.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.category-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    background-color: var(--bg-main);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.875rem;
    font-weight: 600;
}

.banner-card-item {
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.banner-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--navy-950);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.max-width-800 {
    max-width: 800px;
}


/* --------------------------------------------------------------------------
   7. MODAL DIALOG
   -------------------------------------------------------------------------- */
.admin-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.admin-modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 10;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalPop 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--red-600);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}


/* --------------------------------------------------------------------------
   8. RESPONSIVE BREAKPOINTS
   -------------------------------------------------------------------------- */

/* ── Mobile sidebar overlay backdrop ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 99;
    transition: opacity 0.25s ease;
}
.sidebar-overlay.overlay-active {
    display: block;
}

/* ── Hamburger button — hidden on desktop ── */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex-shrink: 0;
    touch-action: manipulation;
    transition: var(--ease);
}
.mobile-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--navy-950);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.mobile-menu-toggle:hover { background: var(--bg-main); }

/* ── Tablet breakpoint ── */
@media (max-width: 1024px) {
    .kpi-grid    { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .grid-2-col  { grid-template-columns: 1fr; }
}

/* ── Mobile landscape / tablets (≤ 768px) ── */
@media (max-width: 768px) {

    /* --- Sidebar: off-canvas drawer --- */
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px !important;
        height: 100vh;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }
    .admin-sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 6px 0 32px rgba(0, 0, 0, 0.35);
    }
    /* Show nav labels (were hidden in old 70px rule) */
    .nav-label,
    .sidebar-brand .brand-text,
    .sidebar-footer .user-info,
    .btn-site-link span { display: flex !important; }

    /* --- Show hamburger on mobile --- */
    .mobile-menu-toggle { display: flex; }

    /* --- Main content: no sidebar margin --- */
    .admin-main { margin-left: 0 !important; }

    /* --- Header: tighten and hide search on small screens --- */
    .admin-header {
        padding: 0.85rem 1rem;
        gap: 0.5rem;
    }
    .header-search {
        display: none; /* collapsed on mobile; global search accessible via tab switching */
    }
    .page-title { font-size: 1.05rem; }
    .status-badge { display: none; }

    /* --- Content container --- */
    .content-container { padding: 1rem; }

    /* --- KPI grid: single column --- */
    .kpi-grid { grid-template-columns: 1fr; gap: 0.85rem; }

    /* --- Chart height cap --- */
    .chart-container { height: 220px !important; }

    /* --- Tables: horizontal scroll, never overflow body --- */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    .admin-table { min-width: 540px; }

    /* --- Toolbar: stack vertically --- */
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }
    .toolbar-left {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .table-search { min-width: unset; width: 100%; }
    .table-select { width: 100%; }
    #btn-open-add-modal { width: 100%; justify-content: center; }

    /* --- Bulk toolbar: stack --- */
    .bulk-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
        padding: 0.85rem;
    }
    .bulk-actions { width: 100%; justify-content: flex-start; }
    .btn-danger-bulk { flex: 1; justify-content: center; }

    /* --- Form grids: single column --- */
    .form-row-2, .grid-2-col { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .form-row input, .form-row button { width: 100%; }

    /* --- Buttons: minimum 44px touch targets --- */
    .btn-primary, .btn-secondary, .btn-outline {
        min-height: 44px;
        touch-action: manipulation;
    }
    .btn-sm { min-height: 36px; padding: 0.4rem 0.7rem; }

    /* --- Modal: full-width on mobile --- */
    .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh;
        overflow-y: auto;
        padding: 1.25rem;
    }
    .modal-content--sm {
        width: 95vw !important;
        max-width: 95vw !important;
    }
    .modal-footer {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }
    .modal-footer button { width: 100%; justify-content: center; min-height: 44px; }

    /* --- Category list actions: always wrap gracefully --- */
    .category-item { flex-wrap: wrap; gap: 0.5rem; }
    .category-item-actions { flex-shrink: 0; }
}

/* ── Mobile portrait (≤ 480px) ── */
@media (max-width: 480px) {
    .content-container { padding: 0.75rem; }

    .page-title { font-size: 0.95rem; }

    .kpi-card { padding: 1rem; }
    .kpi-value { font-size: 1.35rem; }
    .kpi-icon { width: 44px; height: 44px; font-size: 1.2rem; }

    .admin-table { min-width: 480px; }

    /* Ensure no single element overflows the viewport */
    .data-card, .chart-card, .kpi-card {
        max-width: calc(100vw - 1.5rem);
    }

    .header-right { gap: 0.4rem; }
    .icon-btn { width: 40px; height: 40px; min-width: 40px; }

    /* Toast container: full-width on very small screens */
    #toast-container {
        right: 0.5rem;
        left: 0.5rem;
        top: 0.75rem;
        min-width: unset;
    }

    /* ── Chart title: wrap gracefully instead of truncating ── */
    .card-header h3 {
        font-size: 0.95rem;
        white-space: normal;
        line-height: 1.3;
        word-break: break-word;
    }

    /* ── Card header: allow chips/badges to drop to a second line ── */
    .card-header {
        flex-wrap: wrap;
        gap: 0.4rem;
        align-items: flex-start;
    }

    /* ── Tighten chart height further so x-axis label row has room ── */
    .chart-container {
        height: 210px !important;
        padding-bottom: 0.5rem;
    }
}


/* ── Image Upload & Preview Modal Styles ── */
.image-upload-group {
    background-color: var(--bg-main);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-top: 1rem;
}

.image-input-methods {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.file-upload-box { flex-shrink: 0; }

.btn-file-upload {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background-color: var(--navy-800);
    color: #FFFFFF;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ease);
}

.btn-file-upload:hover { background-color: var(--blue-600); }

.text-or {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.url-input-box {
    flex-grow: 1;
    min-width: 200px;
}

.image-presets-wrap { margin-bottom: 0.75rem; }

.presets-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--navy-950);
    margin-bottom: 0.35rem;
}

.presets-list {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.preset-btn {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ease);
}

.preset-btn:hover {
    background-color: var(--blue-50);
    border-color: var(--blue-600);
    color: var(--blue-600);
}

.image-preview-container {
    background-color: var(--bg-card);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-md);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    position: relative;
    overflow: hidden;
}

.preview-placeholder {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.preview-img-wrap {
    position: relative;
    width: 100%;
    max-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-img-wrap img {
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.btn-clear-img {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: rgba(220, 38, 38, 0.9);
    color: #FFFFFF;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.btn-clear-img:hover { background-color: var(--red-600); }

.table-prod-img {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border);
}


/* ── Admin Dark Mode ── */
[data-theme="dark"] {
    --bg-main: #0B132B;
    --bg-card: #1E293B;
    --border: #334155;
    --navy-950: #F8FAFC;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
}
[data-theme="dark"] .admin-header {
    background-color: #1E293B;
    border-color: #334155;
}
[data-theme="dark"] .admin-table th {
    background-color: #0F172A;
    color: #94A3B8;
    border-color: #334155;
}
[data-theme="dark"] .admin-table td {
    border-color: #334155;
}
[data-theme="dark"] .admin-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(37,99,235,0.09) 0%, rgba(37,99,235,0.03) 100%);
    box-shadow: inset 3px 0 0 var(--blue-500);
}
[data-theme="dark"] .form-control {
    background-color: #0F172A;
    border-color: #334155;
    color: #F8FAFC;
}

/* ── Phase 2: Dark-mode overrides for glass/gradient layers ── */
[data-theme="dark"] .admin-header {
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border-bottom-color: rgba(51, 65, 85, 0.8);
    box-shadow: 0 2px 16px rgba(0,0,0,0.3), 0 1px 0 rgba(255,255,255,0.03) inset;
}

[data-theme="dark"] .kpi-card {
    background: rgba(30, 41, 59, 0.82);
    border-color: rgba(51, 65, 85, 0.7);
    box-shadow: 0 4px 20px rgba(0,0,0,0.25), 0 1px 0 rgba(255,255,255,0.04) inset;
}

[data-theme="dark"] .kpi-value {
    color: #F8FAFC;
}

[data-theme="dark"] .btn-primary {
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.5);
}
[data-theme="dark"] .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}
/* Developer Signature */
.developer-signature {
    font-size: 13px;
    color: #94A3B8;
    text-align: center;
    padding: 1rem 0;
    letter-spacing: 0.5px;
    background-color: #0B1120;
}

.developer-signature span {
    color: #38BDF8;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: default;
}

.developer-signature span:hover {
    color: #BAE6FD;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

/* --------------------------------------------------------------------------
   PHASE 1 ADDITIONS: TOAST SYSTEM + SKELETON LOADERS + MISC FIXES
   -------------------------------------------------------------------------- */

/* ── Toast Container & Notifications ── */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: all;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 300px;
    max-width: 420px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
    color: #F8FAFC;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.45;
    border-left: 4px solid transparent;
    animation: toastSlideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.toast-success { border-left-color: #10B981; }
.toast.toast-error   { border-left-color: #EF4444; }
.toast.toast-info    { border-left-color: #3B82F6; }
.toast.toast-warning { border-left-color: #F59E0B; }

.toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-body {
    flex-grow: 1;
}

.toast-title {
    display: block;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
    opacity: 0.7;
}

.toast-msg {
    display: block;
    color: #E2E8F0;
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    transition: color 0.15s ease;
    margin-top: 1px;
}

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

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 4px;
    height: 2px;
    border-radius: 0 0 0 8px;
    animation: toastProgress linear both;
}
.toast.toast-success .toast-progress { background: #10B981; }
.toast.toast-error   .toast-progress { background: #EF4444; }
.toast.toast-info    .toast-progress { background: #3B82F6; }
.toast.toast-warning .toast-progress { background: #F59E0B; }

.toast { position: relative; overflow: hidden; }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(110%) scale(0.92); }
    to   { opacity: 1; transform: translateX(0)   scale(1); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0)   scale(1); }
    to   { opacity: 0; transform: translateX(110%) scale(0.92); }
}

@keyframes toastProgress {
    from { width: calc(100% - 8px); }
    to   { width: 0; }
}

.toast.dismissing {
    animation: toastSlideOut 0.28s cubic-bezier(0.55, 0, 1, 0.45) both;
}


/* ── Skeleton Loader ── */
@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

.skeleton-row td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
}

.skeleton-bar {
    height: 14px;
    border-radius: 6px;
    background: linear-gradient(
        90deg,
        rgba(148, 163, 184, 0.15) 25%,
        rgba(148, 163, 184, 0.35) 50%,
        rgba(148, 163, 184, 0.15) 75%
    );
    background-size: 600px 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-bar.short  { width: 40px; }
.skeleton-bar.medium { width: 80px; }
.skeleton-bar.long   { width: 140px; }
.skeleton-bar.full   { width: 90%; }
.skeleton-bar.round  { width: 42px; height: 42px; border-radius: 8px; }

.skeleton-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

/* ── btn-primary-sm (was missing a class) ── */
.btn-primary-sm {
    background-color: var(--blue-50);
    color: var(--blue-600);
    border: 1px solid var(--blue-100);
}
.btn-primary-sm:hover {
    background-color: var(--blue-600);
    color: #FFFFFF;
    border-color: var(--blue-600);
}

/* ── Global search highlight ── */
.global-search-highlight {
    background: rgba(37, 99, 235, 0.12);
    border-radius: 3px;
    padding: 0 2px;
}

/* ── Dark mode toast adjustments ── */
[data-theme="dark"] .toast {
    background: rgba(30, 41, 59, 0.96);
    border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .skeleton-bar {
    background: linear-gradient(
        90deg,
        rgba(51, 65, 85, 0.4) 25%,
        rgba(71, 85, 105, 0.7) 50%,
        rgba(51, 65, 85, 0.4) 75%
    );
    background-size: 600px 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   PHASE 3 ADDITIONS: BULK ACTIONS + CATEGORY INLINE EDIT + CHECKBOX COLUMN
   -------------------------------------------------------------------------- */

/* ── Checkbox column ── */
.th-checkbox {
    width: 40px;
    text-align: center;
    padding: 0 0.5rem;
}

.th-checkbox input[type="checkbox"],
.td-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--blue-600);
    border-radius: 4px;
}

.td-checkbox {
    text-align: center;
    padding: 0 0.5rem;
}

/* Row selected state */
.admin-table tbody tr.row-selected {
    background: linear-gradient(90deg, rgba(37,99,235,0.10) 0%, rgba(37,99,235,0.04) 100%) !important;
    box-shadow: inset 3px 0 0 var(--blue-600) !important;
}

/* ── Bulk Actions Toolbar ── */
.bulk-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.1rem;
    margin-bottom: 0.85rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(37,99,235,0.08) 0%, rgba(124,58,237,0.06) 100%);
    border: 1px solid rgba(37, 99, 235, 0.22);
    backdrop-filter: blur(8px);
    animation: toastSlideIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.bulk-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--navy-950);
}

.bulk-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 0.5rem;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--blue-600), #7C3AED);
    color: #FFFFFF;
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.btn-danger-bulk {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-danger-bulk:hover {
    background: linear-gradient(135deg, #B91C1C 0%, #991B1B 100%);
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.5);
    transform: translateY(-1px);
}

.btn-danger-bulk:active {
    transform: scale(0.97);
}

/* ── Category list item upgrade ── */
.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 0.45rem;
    transition: box-shadow 0.15s ease, background 0.15s ease;
}

.category-item:hover {
    background: var(--blue-50);
    border-color: rgba(37,99,235,0.2);
    box-shadow: 0 2px 8px rgba(37,99,235,0.08);
}

.category-item-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

/* ── Modal narrow variant for category edit ── */
.modal-content--sm {
    max-width: 480px;
    width: 95%;
}

/* ── Dark mode Phase 3 overrides ── */
[data-theme="dark"] .bulk-toolbar {
    background: linear-gradient(135deg, rgba(37,99,235,0.14) 0%, rgba(124,58,237,0.10) 100%);
    border-color: rgba(37,99,235,0.35);
}

[data-theme="dark"] .bulk-info {
    color: #E2E8F0;
}

[data-theme="dark"] .category-item {
    background: #0F172A;
    border-color: #334155;
}

[data-theme="dark"] .category-item:hover {
    background: #1E293B;
}

[data-theme="dark"] .admin-table tbody tr.row-selected {
    background: linear-gradient(90deg, rgba(37,99,235,0.15) 0%, rgba(37,99,235,0.06) 100%) !important;
}
