/* ============================================
   Global Styles & Variables
   ============================================ */
:root {
    --sidebar-width: 260px;
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-color: #1f2937;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --border-color: #e5e7eb;
    --text-muted: #6b7280;
    --sidebar-gradient: linear-gradient(180deg, #6a4c93 0%, #8b5cf6 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* ============================================
   Sidebar Styles
   ============================================ */
.sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--sidebar-gradient);
    color: var(--white);
    transition: all 0.3s ease-in-out;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    overflow-y: auto;
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.1);
}

.sidebar.active {
    margin-left: calc(-1 * var(--sidebar-width));
}

/* Sidebar Header */
.sidebar-header {
    padding: 25px 20px;
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--white);
    letter-spacing: 0.5px;
}

/* Sidebar Navigation */
.sidebar ul.components {
    padding: 15px 0;
    list-style: none;
}

.sidebar ul li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.sidebar ul li a {
    padding: 15px 20px;
    font-size: 15px;
    display: block;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
}

.sidebar ul li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    padding-left: 25px;
}

.sidebar ul li.active > a {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    font-weight: 600;
    border-left: 4px solid #fbbf24;
    padding-left: 21px;
}

.sidebar ul li a i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 16px;
}

/* Dropdown/Collapse Menu Styles */
.sidebar ul ul {
    background: rgba(0, 0, 0, 0.15);
    padding: 0;
    margin: 0;
    list-style: none;
}

.sidebar ul ul li {
    border-bottom: none;
}

.sidebar ul ul li a {
    padding: 12px 20px 12px 50px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 400;
}

.sidebar ul ul li a:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
    padding-left: 55px;
}

.sidebar ul ul li a i {
    font-size: 13px;
    margin-right: 10px;
    width: 16px;
}

/* Chevron Icon Animation for Dropdowns */
.sidebar a[data-bs-toggle="collapse"] .fa-chevron-down {
    transition: transform 0.3s ease;
    font-size: 12px;
    opacity: 0.7;
}

.sidebar a[data-bs-toggle="collapse"][aria-expanded="true"] .fa-chevron-down,
.sidebar a[data-bs-toggle="collapse"]:not(.collapsed) .fa-chevron-down {
    transform: rotate(180deg);
    opacity: 1;
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ============================================
   Content Area
   ============================================ */
#content {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: all 0.3s ease-in-out;
    position: relative;
    margin-left: var(--sidebar-width);
    background-color: #f5f7fa;
}

.sidebar.active ~ #content {
    margin-left: 0;
    width: 100%;
}

/* ============================================
   Top Navbar
   ============================================ */
.navbar {
    padding: 15px 25px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
}

#sidebarCollapse {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    color: var(--white);
    transition: all 0.3s ease;
}

#sidebarCollapse:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* User Info in Navbar */
.navbar .badge {
    font-size: 11px;
    padding: 4px 10px;
    font-weight: 500;
    border-radius: 12px;
}

/* Dropdown Menu */
.dropdown-menu {
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    padding: 10px 0;
    margin-top: 10px;
}

.dropdown-item {
    padding: 10px 20px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.dropdown-item:hover {
    background: #f3f4f6;
    padding-left: 25px;
}

.dropdown-item i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
}

.dropdown-divider {
    margin: 8px 0;
}

/* ============================================
   Statistics Cards
   ============================================ */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.stat-icon.bg-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.bg-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-icon.bg-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-icon.bg-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.stat-icon.bg-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* ============================================
   Cards
   ============================================ */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.card-header {
    background: var(--white);
    border-bottom: 2px solid var(--border-color);
    padding: 18px 25px;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-body {
    padding: 25px;
}

/* ============================================
   Table Styles
   ============================================ */
.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 15px 12px;
    background: #f9fafb;
}

.table tbody td {
    padding: 15px 12px;
    vertical-align: middle;
    border-bottom: 1px solid #f3f4f6;
}

.table-hover tbody tr {
    transition: all 0.2s ease;
}

.table-hover tbody tr:hover {
    background-color: #f9fafb;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* ============================================
   Badges
   ============================================ */
.badge {
    padding: 6px 12px;
    font-weight: 500;
    border-radius: 8px;
    font-size: 0.85rem;
}

.badge i {
    margin-right: 4px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: var(--white);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn-outline-primary,
.btn-outline-success,
.btn-outline-danger,
.btn-outline-warning {
    transition: all 0.3s ease;
}

.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-danger:hover,
.btn-outline-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
}

.btn-group .btn {
    margin: 0 2px;
}

/* ============================================
   Forms
   ============================================ */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

.form-label {
    font-weight: 500;
    margin-bottom: 8px;
    color: #374151;
}

.form-check-input {
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    border-radius: 10px;
    border: none;
    padding: 15px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.alert i {
    margin-right: 8px;
}

/* ============================================
   Product Image Gallery
   ============================================ */
.gallery-item {
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-item img {
    transition: all 0.3s ease;
}

.gallery-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

#mainProductImage {
    transition: opacity 0.3s ease;
    border-radius: 12px;
}

.gallery-item .badge {
    font-size: 0.65rem;
    padding: 3px 8px;
}

/* ============================================
   Permission Cards (User Management)
   ============================================ */
.perm-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    height: 100%;
    background: var(--white);
    transition: all 0.3s ease;
}

.perm-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.perm-card-header {
    padding: 12px 15px;
    color: var(--white);
    font-weight: 600;
    font-size: 14px;
}

.perm-card-body {
    padding: 15px;
}

.perm-item {
    padding: 10px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.perm-item:last-child {
    border-bottom: none;
}

.perm-item:hover {
    background: #f9fafb;
}

.perm-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
}

.perm-item label {
    margin: 0;
    cursor: pointer;
    flex: 1;
    font-size: 14px;
}

/* ============================================
   Form Sections (User Create/Edit)
   ============================================ */
.form-section {
    margin-bottom: 30px;
    padding: 25px;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.section-title i {
    margin-right: 10px;
    color: var(--primary-color);
}

.required:after {
    content: " *";
    color: var(--danger-color);
    font-weight: bold;
}

/* ============================================
   Gradients for Headers
   ============================================ */
.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.bg-gradient-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 992px) {
    .stat-card {
        margin-bottom: 15px;
    }
    
    .perm-card {
        margin-bottom: 15px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    
    .sidebar.active {
        margin-left: 0;
    }
    
    #content {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar.active ~ #content {
        margin-left: var(--sidebar-width);
    }
    
    .navbar {
        padding: 12px 15px;
    }
    
    .card-body {
        padding: 20px 15px;
    }
    
    .form-section {
        padding: 20px 15px;
    }
}

@media (max-width: 576px) {
    .sidebar-header h3 {
        font-size: 1.2rem;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .btn-lg {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .table {
        font-size: 13px;
    }
    
    .table thead th,
    .table tbody td {
        padding: 10px 8px;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    display: inline-block;
}

.shadow-sm {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
}

.shadow {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.shadow-lg {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

.border-0 {
    border: none !important;
}

/* ============================================
   Animation Classes
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .dropdown {
        display: none !important;
    }
    
    #content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}
