/* ==========================================================
   BDShoping - Modern Professional Admin CSS
   ========================================================== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #008a45;
    --primary-hover: #007038;
    --primary-light: #ecfdf5;
    --primary-border: #a7f3d0;
    --secondary: #e30613;
    --secondary-hover: #c4040f;
    --dark: #0f172a;
    --dark-surface: #1e293b;
    --sidebar-bg: #0f172a;
    --sidebar-active: #1e293b;
    --light-bg: #f8fafc;
    --card-bg: #ffffff;
    --white: #ffffff;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-text: #92400e;
    --info: #3b82f6;
    --info-bg: #eff6ff;
    --info-text: #1e40af;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --purple: #8b5cf6;
    --purple-bg: #f5f3ff;
    --purple-text: #6d28d9;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--light-bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--white);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
    z-index: 50;
}
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}
.sidebar-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: #10b981;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.sidebar-header span {
    font-size: 11px;
    color: var(--text-subtle);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    display: block;
    margin-top: 6px;
}
.sidebar-menu {
    list-style: none;
    padding: 16px 12px;
    margin: 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}
.sidebar-menu a:hover {
    color: var(--white);
    background-color: rgba(255, 255, 255, 0.06);
}
.sidebar-menu li.active a {
    color: var(--white);
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 138, 69, 0.3);
}
.sidebar-menu a i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 13px;
    color: var(--text-subtle);
}
.sidebar-footer a {
    color: #f87171;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: color 0.2s;
}
.sidebar-footer a:hover {
    color: #ef4444;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}
.main-header {
    background-color: var(--white);
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}
.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), #10b981);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0, 138, 69, 0.25);
}

.content-body {
    padding: 28px 32px;
    flex-grow: 1;
}
.page-title {
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 22px;
    font-weight: 800;
    color: var(--dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* ---------------------------------------------------------
   KPI / Dashboard Stat Cards
   --------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background-color: var(--white);
    border-radius: var(--radius-md);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-info {
    display: flex;
    flex-direction: column;
}
.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.2;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-card:nth-child(1) .stat-icon { background-color: #ecfdf5; color: var(--success); }
.stat-card:nth-child(2) .stat-icon { background-color: #eff6ff; color: var(--info); }
.stat-card:nth-child(3) .stat-icon { background-color: #fffbeb; color: var(--warning); }
.stat-card:nth-child(4) .stat-icon { background-color: #f5f3ff; color: var(--purple); }

/* ---------------------------------------------------------
   Cards & Panels
   --------------------------------------------------------- */
.card-panel {
    background-color: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 15px;
    color: var(--dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfc;
}
.card-body {
    padding: 24px;
}

.form-section-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.form-section-header {
    margin-top: 0;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-section-header i {
    color: var(--primary);
}

/* ---------------------------------------------------------
   Admin Tables
   --------------------------------------------------------- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.admin-table th {
    padding: 13px 16px;
    background: #f8fafc;
    border-bottom: 1.5px solid var(--border);
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
}
.admin-table tr:last-child td {
    border-bottom: none;
}
.admin-table tr:hover {
    background-color: #f8fafc;
}
.table-img {
    width: 44px;
    height: 44px;
    max-width: 44px;
    max-height: 44px;
    object-fit: cover;
    background-color: #f1f5f9;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: block;
}

/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: inherit;
}
.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    box-shadow: 0 2px 6px rgba(0, 138, 69, 0.2);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 138, 69, 0.3);
}
.btn-secondary {
    background-color: #475569;
    color: var(--white);
}
.btn-secondary:hover {
    background-color: #334155;
}
.btn-light {
    background-color: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}
.btn-light:hover {
    background-color: #e2e8f0;
}
.btn-danger {
    background-color: var(--danger);
    color: var(--white);
}
.btn-danger:hover {
    background-color: #dc2626;
}
.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
}

/* ---------------------------------------------------------
   Badges
   --------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.badge-success { background-color: var(--success-bg); color: var(--success-text); border: 1px solid #a7f3d0; }
.badge-warning { background-color: var(--warning-bg); color: var(--warning-text); border: 1px solid #fde68a; }
.badge-danger { background-color: var(--danger-bg); color: var(--danger-text); border: 1px solid #fecaca; }
.badge-info { background-color: var(--info-bg); color: var(--info-text); border: 1px solid #bfdbfe; }

/* Status Badges for Orders */
.badge-pending { background-color: #fef3c7; color: #d97706; border: 1px solid #fde68a; }
.badge-processing { background-color: #dbeafe; color: #2563eb; border: 1px solid #bfdbfe; }
.badge-shipped { background-color: #ede9fe; color: #7c3aed; border: 1px solid #ddd6fe; }
.badge-completed { background-color: #d1fae5; color: #059669; border: 1px solid #a7f3d0; }
.badge-cancelled { background-color: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }

/* ---------------------------------------------------------
   Form Controls
   --------------------------------------------------------- */
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background-color: #ffffff;
    outline: none;
    transition: all 0.2s;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 138, 69, 0.15);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ---------------------------------------------------------
   VARIATION & SWATCHES MANAGER
   --------------------------------------------------------- */
.variation-panel {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.variation-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}
.variation-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.variation-tools {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.variation-toolbar {
    background: #f8fafc;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.variation-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #ffffff;
}

.variation-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    table-layout: fixed;
    background: #ffffff;
}
.variation-table th {
    background: #f8fafc;
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    border-bottom: 1.5px solid var(--border);
    text-align: left;
    white-space: nowrap;
}
.variation-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 13px;
}
.variation-table tr:last-child td {
    border-bottom: none;
}
.variation-table tr:hover {
    background: #fcfdfd;
}

/* Swatch Preview Element */
.var-color-preview {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    border-radius: 50% !important;
    border: 2px solid #cbd5e1 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) !important;
    flex-shrink: 0;
}

/* CRITICAL: Constrain Variation Image Previews */
.var-img-preview {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
    object-fit: cover !important;
    border-radius: 6px !important;
    border: 1px solid #cbd5e1 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    background-color: #f8fafc !important;
    flex-shrink: 0;
}

.var-input {
    width: 100%;
    padding: 7px 10px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    outline: none;
    transition: border-color 0.2s;
    background: #ffffff;
}
.var-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 138, 69, 0.12);
}

.var-color-picker {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    border: 1px solid #cbd5e1 !important;
    cursor: pointer !important;
    border-radius: 5px !important;
    background: transparent !important;
    flex-shrink: 0;
}

.stock-badge-live {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    display: inline-block;
    white-space: nowrap;
    text-align: center;
}

/* ---------------------------------------------------------
   Alerts & Notifications
   --------------------------------------------------------- */
.alert {
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-danger {
    background-color: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid #fecaca;
}
.alert-success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border: 1px solid #a7f3d0;
}
.alert-info {
    background-color: var(--info-bg);
    color: var(--info-text);
    border: 1px solid #bfdbfe;
}

/* ---------------------------------------------------------
   Login Page Styles
   --------------------------------------------------------- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #0f172a;
    background-image: radial-gradient(at 0% 0%, rgba(0, 138, 69, 0.15) 0px, transparent 50%), radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
}
.login-box {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-top: 5px solid var(--primary);
}
.login-logo {
    text-align: center;
    margin-bottom: 25px;
}
.login-logo h1 {
    margin: 0;
    color: var(--primary);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.5px;
}
.login-title {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 22px;
    color: var(--dark);
}

/* ---------------------------------------------------------
   Responsive Breakpoints
   --------------------------------------------------------- */
@media (max-width: 1024px) {
    .content-body {
        padding: 20px;
    }
}
@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .main-header {
        padding: 12px 20px;
    }
}
