/* ============================================
   ADMIN THEME SYSTEM - PROFESSIONAL E-COMMERCE
   Based on DealDash style but modernized
   ============================================ */

:root {
    /* COMMON VARS */
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    /* Requested shadow */
    --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.12);
    --theme-transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
}

/* ============================================
   LIGHT THEME (Default)
   ============================================ */
.admin-theme-light {
    --color-bg: #FFFFFF;
    --color-bg-muted: #F7FAFF;
    /* Very light cool gray/blue */
    --color-surface: #FFFFFF;
    --color-surface-hover: #F8FAFC;

    --color-border: #E2E8F0;
    /* Slate 200 */

    --color-text: #0F172A;
    /* Slate 900 */
    --color-text-secondary: #475569;
    /* Slate 600 */
    --color-text-muted: #64748B;
    /* Slate 500 */

    --color-primary: #1D4ED8;
    /* Blue 700 */
    --color-primary-hover: #1E40AF;
    /* Blue 800 */
    --color-primary-light: #EFF6FF;
    /* Blue 50 */

    --color-accent: #FACC15;
    /* Yellow 400 */
    --color-accent-hover: #EAB308;
    /* Yellow 500 */
    --color-accent-text: #422006;

    --color-success: #16A34A;
    --color-success-bg: #DCFCE7;

    --color-danger: #DC2626;
    --color-danger-bg: #FEE2E2;

    --color-warning: #D97706;
    --color-warning-bg: #FEF3C7;

    --color-info: #0284C7;
    --color-info-bg: #E0F2FE;

    /* Legacy Mappings for MudBlazor overrides if needed */
    --admin-bg: var(--color-bg-muted);
    --admin-surface: var(--color-surface);
    --admin-border: var(--color-border);
    --admin-text: var(--color-text);
    --admin-primary: var(--color-primary);
    --admin-accent: var(--color-accent);
}

/* ============================================
   DARK THEME
   ============================================ */
.admin-theme-dark {
    --color-bg: #0B1220;
    /* Deep blue-black */
    --color-bg-muted: #0F1B2E;
    /* Slightly lighter */
    --color-surface: #111C30;
    /* Surface Card Color */
    --color-surface-hover: #1E293B;

    --color-border: #23314A;
    /* Slate 800 adapted */

    --color-text: #F8FAFC;
    /* Slate 50 */
    --color-text-secondary: #CBD5E1;
    /* Slate 300 */
    --color-text-muted: #94A3B8;
    /* Slate 400 */

    --color-primary: #3B82F6;
    /* Blue 500 - brighter on dark */
    --color-primary-hover: #2563EB;
    /* Blue 600 */
    --color-primary-light: #172554;
    /* Blue 950 */

    --color-accent: #FACC15;
    /* Yellow 400 */
    --color-accent-hover: #EAB308;
    --color-accent-text: #000000;

    --color-success: #22C55E;
    /* Green 500 */
    --color-success-bg: #14532D;

    --color-danger: #EF4444;
    /* Red 500 */
    --color-danger-bg: #7F1D1D;

    --color-warning: #F59E0B;
    --color-warning-bg: #78350F;

    --color-info: #0EA5E9;
    --color-info-bg: #0C4A6E;

    /* Legacy Mappings */
    --admin-bg: var(--color-bg);
    --admin-surface: var(--color-surface);
    --admin-border: var(--color-border);
    --admin-text: var(--color-text);
    --admin-primary: var(--color-primary);
    --admin-accent: var(--color-accent);
}


/* ============================================
   GLOBAL UTILITIES
   ============================================ */
/* Scoped to admin layout */
.admin-layout-root {
    background-color: var(--color-bg-muted);
    color: var(--color-text);
    font-family: var(--font-body);
    transition: var(--theme-transition);
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.admin-sidebar {
    width: 280px;
    background-color: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: width 0.3s ease;
    z-index: 50;
}

.admin-sidebar.collapsed {
    width: 80px;
}

.admin-brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.admin-brand-icon {
    font-size: 1.5rem;
    color: var(--color-primary);
}

.admin-brand-text {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--color-text);
    font-family: var(--font-heading);
    white-space: nowrap;
}

.admin-sidebar.collapsed .admin-brand-text,
.admin-sidebar.collapsed .logo-text {
    display: none;
}

.admin-nav-group {
    padding: 1.5rem 1rem 0.5rem;
}

.admin-nav-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 700;
    padding: 0 0.75rem;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

.admin-sidebar.collapsed .admin-nav-header {
    display: none;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.75rem;
    color: var(--color-text-secondary);
    border-radius: 8px;
    transition: all 0.2s;
    text-decoration: none;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.admin-nav-item:hover {
    background-color: var(--color-bg-muted);
    color: var(--color-text);
}

.admin-nav-item.active {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}

.admin-nav-item i {
    font-size: 1.25rem;
    width: 1.5rem;
    text-align: center;
}

.admin-sidebar.collapsed .admin-nav-item span {
    display: none;
}

/* ============================================
   MAIN CONTENT WRAPPER
   ============================================ */
.admin-main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--color-bg-muted);
    min-width: 0;
    /* Prevent flex overflow */
}

/* ============================================
   TOPBAR
   ============================================ */
.admin-topbar {
    height: 72px;
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.admin-topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle-sidebar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--color-text-secondary);
    cursor: pointer;
    background: transparent;
    border: none;
}

.toggle-sidebar-btn:hover {
    background-color: var(--color-bg-muted);
    color: var(--color-text);
}

.admin-topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* ============================================
   THEME TOGGLE SWITCH
   ============================================ */
.theme-switch {
    display: flex;
    align-items: center;
    background: var(--color-bg-muted);
    border-radius: 20px;
    padding: 2px;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--color-border);
    width: 64px;
    height: 32px;
}

.theme-switch-thumb {
    width: 26px;
    height: 26px;
    background: var(--color-surface);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    color: var(--color-accent);
}

/* Use parent .admin-theme-dark to trigger switch state */
.admin-theme-dark .theme-switch-thumb {
    transform: translateX(32px);
    color: var(--color-primary);
}

/* ============================================
   CONTENT AREA
   ============================================ */
.admin-content-area {
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* ============================================
   COMPONENTS
   ============================================ */
/* CARD */
.admin-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.admin-card-header {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
}

/* BADGE */
.bg-tag {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.bg-tag-success {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.bg-tag-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.bg-tag-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.bg-tag-info {
    background: var(--color-info-bg);
    color: var(--color-info);
}

/* ACTIONS ROW */
.actions-row {
    display: flex;
    gap: 0.5rem;
}

/* TABLE OVERRIDES handled via mudblazor-admin-overrides.css mostly, 
   but specific styles here for custom tables */
table.custom-admin-table {
    width: 100%;
    border-collapse: collapse;
}

table.custom-admin-table th {
    background: var(--color-surface-hover);
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

table.custom-admin-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}