/* Professional Admin Theme - Brand Matched */
/* Matching Awesome Mall Corporate Identity */

:root {
    /* Brand Colors */
    --am-primary: #E8663D;
    /* Main brand orange */
    --am-primary-hover: #d25532;
    /* Darker orange */
    --am-corporate-blue: #00203F;
    /* Corporate Navy Blue (Header/Sidebar) */
    --am-text-primary: #1f2937;
    --am-text-secondary: #6b7280;
    --am-bg-light: #f3f4f6;

    /* Status Colors */
    --am-success: #10b981;
    --am-warning: #f59e0b;
    --am-danger: #ef4444;
    --am-info: #3b82f6;

    /* Design System Tokens */
    --am-radius: 8px;
    --am-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --am-shadow-hover: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 1. Global Reset & Typography */
body {
    background-color: var(--am-bg-light);
    color: var(--am-text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a {
    text-decoration: none !important;
}

a:hover {
    text-decoration: none !important;
}

/* 2. Admin Layout - Sidebar & Navbar (Matching Footer/Brand) */
.sb-topnav {
    background-color: var(--am-corporate-blue) !important;
    /* Navy Blue Header */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sb-topnav .nav-link,
.sb-topnav .navbar-brand,
.sb-topnav #sidebarToggle {
    color: #ffffff !important;
}

.sb-topnav .nav-link:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

.sb-sidenav-dark {
    background-color: var(--am-corporate-blue) !important;
    /* Navy Blue Sidebar (like footer) */
    color: rgba(255, 255, 255, 0.9);
}

.sb-sidenav-dark .sb-sidenav-menu .nav-link {
    color: rgba(255, 255, 255, 0.75);
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.sb-sidenav-dark .sb-sidenav-menu .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.sb-sidenav-dark .sb-sidenav-menu .nav-link.active {
    color: #fff;
    background-color: var(--am-primary);
    /* Active state matches brand orange */
    font-weight: 600;
    border-left-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sb-sidenav-dark .sb-sidenav-menu .nav-link.active .sb-nav-link-icon {
    color: #fff;
}

.sb-sidenav-dark .sb-sidenav-menu-heading {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.sb-sidenav-footer {
    background-color: rgba(0, 0, 0, 0.2) !important;
}

/* Smooth sidebar scrolling */
#layoutSidenav_nav {
    scroll-behavior: smooth;
}

#layoutSidenav_nav .sb-sidenav {
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* 3. Page Headers */
/* 3. Page Headers - Sleek & Modern */
.page-header {
    background: transparent;
    color: var(--am-text-primary);
    padding: 1rem 0 1.5rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--am-corporate-blue);
    /* Navy Blue Headings */
}

.page-header p {
    margin: 4px 0 0 0;
    font-size: 14px;
    color: var(--am-text-secondary);
}

/* 4. Cards & Content Areas */
.table-card,
.form-card,
.card {
    background: white;
    border: none;
    border-radius: var(--am-radius);
    box-shadow: var(--am-shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    color: var(--am-corporate-blue);
    padding: 16px 24px;
}

/* 5. Buttons & Actions */
.add-btn,
.submit-btn,
.btn-primary {
    background-color: var(--am-primary) !important;
    border-color: var(--am-primary) !important;
    color: white !important;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.add-btn:hover,
.submit-btn:hover,
.btn-primary:hover {
    background-color: var(--am-primary-hover) !important;
    border-color: var(--am-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(232, 102, 61, 0.25);
}

.cancel-btn,
.btn-secondary {
    background-color: #f3f4f6;
    color: var(--am-text-secondary);
    border: 1px solid #e5e7eb;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.cancel-btn:hover {
    background-color: #e5e7eb;
    color: var(--am-text-primary);
}

/* Action Icon Buttons */
.action-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    margin: 0 2px;
}

.action-btn.edit {
    color: var(--am-corporate-blue);
    background-color: rgba(0, 58, 112, 0.1);
}

.action-btn.edit:hover {
    background-color: var(--am-corporate-blue);
    color: white;
}

.action-btn.delete {
    color: var(--am-danger);
    background-color: rgba(239, 68, 68, 0.1);
}

.action-btn.delete:hover {
    background-color: var(--am-danger);
    color: white;
}

/* 6. Tables */
.table {
    vertical-align: middle;
}

.table thead th {
    background-color: #f9fafb;
    color: var(--am-corporate-blue);
    font-weight: 600;
    /* text-transform: uppercase; -- REMOVED: Let headers use natural case */
    font-size: 0.75rem;
    letter-spacing: 0.3px;
    border-bottom: 2px solid #e5e7eb;
    padding: 16px;
}

.table tbody td {
    padding: 16px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
}

.table tbody tr:hover {
    background-color: #fdfafa;
    /* Very light orange tint on hover */
}

/* 7. Status Badges */
.status-badge,
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-badge.packed {
    background-color: #e0f2fe;
    color: #075985;
}

.status-badge.dispatched {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-badge.delivered {
    background-color: #d1fae5;
    color: #065f46;
}

.status-badge.cancelled {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-badge.intransit {
    background-color: #f3e8ff;
    color: #6b21a8;
}

.status-badge.outfordelivery {
    background-color: #ffedd5;
    color: #9a3412;
}

/* 8. Dashboard Stats */
.stat-card {
    background: white;
    border-radius: var(--am-radius);
    padding: 24px;
    box-shadow: var(--am-shadow);
    transition: all 0.3s;
    border-top: 4px solid transparent;
    /* Prepare for hover effect */
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--am-shadow-hover);
    border-top-color: var(--am-primary);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
    background-color: rgba(232, 102, 61, 0.1);
    /* Light Orange */
    color: var(--am-primary);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--am-corporate-blue);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--am-text-secondary);
    font-weight: 500;
}

/* 9. Forms & Inputs */
.form-control,
.form-select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--am-primary);
    box-shadow: 0 0 0 3px rgba(232, 102, 61, 0.15);
    outline: none;
}

textarea.form-control {
    min-height: 120px;
}

/* Mini Stats (Orders Page) */
.stat-mini {
    background: white;
    border-radius: var(--am-radius);
    padding: 20px;
    box-shadow: var(--am-shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s;
    border-left: 4px solid var(--am-primary);
}

.stat-mini:hover {
    transform: translateY(-2px);
}

.stat-mini .icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(232, 102, 61, 0.1);
    color: var(--am-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-mini .details {
    flex: 1;
}

.stat-mini .label {
    font-size: 0.85rem;
    color: var(--am-text-secondary);
    font-weight: 600;
}

.stat-mini .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--am-corporate-blue);
    line-height: 1.2;
}

.form-label {
    font-weight: 600;
    color: var(--am-corporate-blue);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.form-section-title {
    color: var(--am-corporate-blue);
    font-weight: 700;
    font-size: 1.1rem;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e0e0e0;
}

.form-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* 10. Responsive Design Utilities & Mobile Fixes */
@media (max-width: 768px) {

    /* Stack Page Header contents */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 1rem 0;
    }

    .page-header>div {
        width: 100%;
    }

    .page-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* Compact layout for mobile */
    .table-card,
    .form-card,
    .card {
        padding: 12px;
        margin-bottom: 16px;
    }

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

    /* Fix table scrolling and wrapping */
    .table-responsive {
        border: 0;
        margin-bottom: 0;
    }

    .table thead th {
        padding: 12px 8px;
        font-size: 0.7rem;
    }

    .table tbody td {
        padding: 12px 8px;
        font-size: 0.85rem;
    }

    /* Dashboard Metrics Refinement */
    .stat-card {
        padding: 16px;
        margin-bottom: 0;
    }

    .stat-value {
        font-size: 20px;
    }

    /* Sidebar and Layout adjustments */
    #layoutSidenav_content {
        padding: 0 4px;
    }

    /* Fix Permission Table for mobile */
    .permission-table-container {
        max-width: 100vw;
        overflow-x: auto;
    }

    /* Brands Mobile Brand adjustment */
    .navbar-brand {
        font-size: 1.1rem !important;
        padding-left: 0.5rem !important;
        width: auto !important;
        max-width: 180px;
    }

    .brand-text-truncate {
        display: inline-block;
        max-width: 130px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: middle;
    }
}

/* Base Truncation (always on) */
.brand-text-truncate {
    display: inline-block;
    max-width: 200px;
    /* Default desktop limit */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* 11. Custom Scrollbar for better UX */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--am-primary);
}

/* Table Actions Alignment */
.table-card td:last-child {
    white-space: nowrap;
    min-width: 80px;
}

.table-card td:last-child .btn {
    margin-right: 4px;
}

.table-card td:last-child .btn:last-child {
    margin-right: 0;
}

/* Fix for long product names in tables */
.product-cell {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 576px) {
    .product-cell {
        max-width: 150px;
    }
}