/* CSS for Admin Dashboards (Retail & Wholesale Portals) */

:root {
    --primary-h: 215;
    --primary-s: 80%;
    --primary-l: 25%;
    
    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-dark: #0f172a; /* Slate 900 */
    --primary-light: hsl(var(--primary-h), var(--primary-s), 45%);
    
    --accent: #d97706; /* Honey Gold */
    --accent-light: #f59e0b;
    
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --success: #10b981; /* Emerald 500 */
    --success-bg: #ecfdf5;
    --error: #ef4444; /* Red 500 */
    --error-bg: #fef2f2;
    --warning: #f59e0b; /* Amber 500 */
    --warning-bg: #fffbeb;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --transition: all 0.25s ease;
    --sidebar-width: 260px;
}

/* Reset and Globals */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

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

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

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-dark);
    color: #94a3b8; /* Slate 400 */
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 10;
}

.sidebar-brand {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
}

.sidebar-brand .logo-image {
    height: 36px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
}

.login-header .logo-image {
    height: 65px;
    width: auto;
    object-fit: contain;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.sidebar-brand .logo-icon {
    font-size: 1.5rem;
    color: var(--accent);
}

.sidebar-brand .logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
}

.sidebar-brand .portal-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    background-color: rgba(255,255,255,0.1);
    color: var(--accent-light);
    border-radius: 4px;
    margin-left: auto;
    font-weight: 600;
    text-transform: uppercase;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex-grow: 1;
}

.sidebar-menu li {
    margin-bottom: 4px;
    padding: 0 16px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.sidebar-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.03);
}

.sidebar-menu li.active .sidebar-link {
    color: #ffffff;
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sidebar-menu li.active .sidebar-link i {
    color: var(--accent-light);
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    margin-bottom: 12px;
    color: #ffffff;
}

.sidebar-user i {
    color: var(--accent);
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #ef4444;
    font-weight: 600;
}

.logout-link:hover {
    color: #f87171;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 70px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.page-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    color: var(--primary-dark);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-admin {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-admin-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-admin-primary:hover {
    background-color: var(--primary-light);
}

.btn-admin-secondary {
    background-color: #e2e8f0;
    color: var(--text-main);
}

.btn-admin-secondary:hover {
    background-color: #cbd5e1;
}

.content-body {
    padding: 32px;
    flex-grow: 1;
}

/* Alerts styling */
.alert {
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
}

.alert-success {
    background-color: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background-color: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
}

/* Dashboard Widgets / Stats Cards */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.widget-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary);
}

.widget-card.widget-accent {
    border-left-color: var(--accent);
}

.widget-card.widget-success {
    border-left-color: var(--success);
}

.widget-card.widget-warning {
    border-left-color: var(--warning);
}

.widget-info h3 {
    font-size: 1.85rem;
    margin-bottom: 4px;
    color: var(--primary-dark);
}

.widget-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.widget-icon {
    width: 48px;
    height: 48px;
    background-color: var(--bg-main);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--primary);
}

.widget-card.widget-accent .widget-icon { color: var(--accent); }
.widget-card.widget-success .widget-icon { color: var(--success); }
.widget-card.widget-warning .widget-icon { color: var(--warning); }

/* Dashboard Columns Layout (e.g. Table + Chart) */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.dashboard-grid-full {
    display: grid;
    grid-template-columns: 1fr;
}

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

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

.panel-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
}

/* Custom Table Styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

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

.admin-table th {
    background-color: var(--bg-main);
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}

.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background-color: #f8fafc;
}

.prod-thumbnail {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-color, #e2e8f0);
    display: block;
}

.thumbnail-fallback {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #f1f5f9;
    color: var(--text-muted, #94a3b8);
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-color, #e2e8f0);
    font-size: 1.25rem;
}

.badge {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background-color: var(--success-bg); color: var(--success); }
.badge-danger { background-color: var(--error-bg); color: var(--error); }
.badge-warning { background-color: var(--warning-bg); color: var(--warning); }
.badge-info { background-color: #eff6ff; color: #3b82f6; }

/* Modals & Forms */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-card {
    background-color: var(--bg-card);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

.modal-card.modal-lg {
    max-width: 700px;
}

@keyframes slideDown {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    background-color: var(--primary);
    color: #ffffff;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #ffffff;
    cursor: pointer;
    opacity: 0.8;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 24px;
}

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

.form-row-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-main);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Login Page Layout */
.login-body {
    background: radial-gradient(circle at 10% 20%, rgba(26, 54, 93, 0.95) 0%, rgba(10, 25, 47, 1) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background-color: #ffffff;
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-header {
    background-color: var(--primary);
    color: #ffffff;
    padding: 32px 24px;
    text-align: center;
}

.login-header .logo-icon {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 12px;
}

.login-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
}

.login-header p {
    color: #93c5fd;
    font-size: 0.85rem;
    margin-top: 4px;
}

.login-body-content {
    padding: 32px 24px;
}

/* Landing CMS specific list */
.cms-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.cms-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    background-color: var(--bg-card);
}

/* Responsive Dashboards & Mobile Drawer */
@media (max-width: 992px) {
    .sidebar {
        width: 70px;
    }
    .sidebar-brand .logo-text,
    .sidebar-brand .portal-badge,
    .sidebar-link span,
    .sidebar-footer .sidebar-user span {
        display: none;
    }
    .sidebar-brand {
        justify-content: center;
        padding: 16px 0;
    }
    .sidebar-link {
        justify-content: center;
        padding: 12px;
    }
    .main-content {
        margin-left: 70px;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        left: -240px;
        width: 240px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.15);
    }
    .sidebar-brand .logo-text,
    .sidebar-brand .portal-badge,
    .sidebar-link span,
    .sidebar-footer .sidebar-user span {
        display: inline-block;
    }
    .sidebar-brand {
        justify-content: flex-start;
        padding: 24px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    .sidebar-link {
        justify-content: flex-start;
        padding: 12px 16px;
    }
    
    /* Active/hover slide out behavior */
    .sidebar:hover, .sidebar:focus-within {
        left: 0;
    }
    
    /* Dynamic Hamburger Button on mobile using pseudo element */
    .sidebar::after {
        content: "\f0c9"; /* FontAwesome bars icon */
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        position: fixed;
        left: 16px;
        top: 12px;
        width: 45px;
        height: 45px;
        background-color: var(--primary-dark);
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-sm);
        cursor: pointer;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        z-index: 100;
        border: 1px solid rgba(255,255,255,0.1);
        font-size: 1.15rem;
    }
    .sidebar:hover::after {
        content: "\f00d"; /* FontAwesome times close icon */
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .topbar {
        padding: 0 16px 0 76px; /* Offset for the floating hamburger */
        height: 70px;
    }
    
    .page-title {
        font-size: 1.2rem;
    }
    
    .content-body {
        padding: 16px;
    }
    
    .topbar-actions {
        gap: 8px;
    }
    
    .btn-admin {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .widgets-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .panel-card {
        padding: 16px;
    }
    
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .form-row-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    /* Billing table mobile spacing */
    .billing-repeater-row td {
        display: block;
        width: 100% !important;
        border: none;
        padding: 6px 0;
    }
    .billing-repeater-row {
        display: block;
        border-bottom: 2px solid var(--border-color);
        padding: 12px 0;
    }
    .billing-repeater-row td:last-child {
        text-align: right !important;
    }
    #repeaterTable thead {
        display: none;
    }
}


/* Page Loader Overlay */
.footwear-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #0f172a; /* Slate 900 */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.footwear-loader-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

.footwear-loader {
    text-align: center;
}

.step-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
}

.step-container i {
    font-size: 2.5rem;
    color: var(--accent, #d97706);
    position: absolute;
    opacity: 0;
}

.step-1 {
    top: 15px;
    left: 20px;
    transform: rotate(-35deg);
    animation: walk-step-1 1.8s infinite;
}

.step-2 {
    top: 45px;
    left: 65px;
    transform: rotate(10deg);
    animation: walk-step-2 1.8s infinite;
}

.step-3 {
    top: 75px;
    left: 25px;
    transform: rotate(-15deg);
    animation: walk-step-3 1.8s infinite;
}

@keyframes walk-step-1 {
    0% { opacity: 0; transform: scale(0.8) rotate(-35deg); }
    15% { opacity: 1; transform: scale(1) rotate(-35deg); }
    45% { opacity: 1; }
    60% { opacity: 0; }
    100% { opacity: 0; }
}

@keyframes walk-step-2 {
    0% { opacity: 0; }
    30% { opacity: 0; transform: scale(0.8) rotate(10deg); }
    45% { opacity: 1; transform: scale(1) rotate(10deg); }
    75% { opacity: 1; }
    90% { opacity: 0; }
    100% { opacity: 0; }
}

@keyframes walk-step-3 {
    0% { opacity: 0; }
    60% { opacity: 0; transform: scale(0.8) rotate(-15deg); }
    75% { opacity: 1; transform: scale(1) rotate(-15deg); }
    95% { opacity: 1; }
    100% { opacity: 0; }
}

.loader-text {
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    animation: loader-pulse 1.5s ease-in-out infinite;
    margin: 0;
}

@keyframes loader-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}
