/* ===== ROOT VARIABLES ===== */
:root {
    --primary: #2c3e50;
    --secondary: #34495e;
    --accent: #3498db;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #17a2b8;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --purple: #9b59b6;
    --teal: #1abc9c;
    --orange: #e67e22;
}

/* ===== BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* ===== HEADER STYLES ===== */
.header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 70px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* ===== COLORFUL SIDEBAR STYLES ===== */
.sidebar {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    width: 280px;
    height: calc(100vh - 70px);
    position: fixed;
    top: 70px;
    left: 0;
    box-shadow: 2px 0 15px rgba(0,0,0,0.3);
    overflow-y: auto;
    z-index: 999;
}

.sidebar-menu {
    padding: 1rem 0;
}

/* Menu Sections with Gradient Backgrounds */
.menu-section {
    margin-bottom: 0.8rem;
    border-radius: 0 15px 15px 0;
    overflow: hidden;
    margin-right: 10px;
}

.menu-section-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-left: 4px solid #f1c40f;
}

.menu-section:nth-child(2) .menu-section-header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-left-color: #2ecc71;
}

.menu-section:nth-child(3) .menu-section-header {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    border-left-color: #e67e22;
}

.menu-section:nth-child(4) .menu-section-header {
    background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%);
    border-left-color: #f39c12;
}

.menu-section:nth-child(5) .menu-section-header {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    border-left-color: #3498db;
}

.menu-section:nth-child(6) .menu-section-header {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-left-color: #9b59b6;
}

.menu-section:nth-child(7) .menu-section-header {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    border-left-color: #bdc3c7;
}

.menu-section-items {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

/* Menu Items with Hover Effects */
.menu-item {
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    color: #ecf0f1;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.menu-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.menu-item:hover::before {
    left: 100%;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: #f1c40f;
    color: #ffffff;
    transform: translateX(5px);
}

.menu-item.active {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.3) 0%, rgba(41, 128, 185, 0.3) 100%);
    border-left-color: #3498db;
    color: #ffffff;
    font-weight: 600;
    box-shadow: inset 0 0 20px rgba(52, 152, 219, 0.2);
}

.menu-section-items .menu-item {
    padding-left: 2.5rem;
    font-size: 0.9rem;
    border-left: 2px solid transparent;
}

.menu-section-items .menu-item:hover {
    border-left-color: #2ecc71;
    background: rgba(46, 204, 113, 0.1);
}

.menu-section-items .menu-item.active {
    border-left-color: #2ecc71;
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.2) 0%, rgba(39, 174, 96, 0.2) 100%);
}

/* Icons with Colors */
.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.menu-item:hover i {
    transform: scale(1.2);
}

/* Specific icon colors */
.menu-item i.fa-tachometer-alt { color: #f1c40f; }
.menu-item i.fa-warehouse { color: #3498db; }
.menu-item i.fa-boxes { color: #2ecc71; }
.menu-item i.fa-exchange-alt { color: #9b59b6; }
.menu-item i.fa-shopping-cart { color: #e74c3c; }
.menu-item i.fa-users { color: #1abc9c; }
.menu-item i.fa-file-estimate { color: #f39c12; }
.menu-item i.fa-file-invoice { color: #3498db; }
.menu-item i.fa-money-bill-wave { color: #27ae60; }
.menu-item i.fa-credit-card { color: #2ecc71; }
.menu-item i.fa-receipt { color: #e67e22; }
.menu-item i.fa-chart-bar { color: #9b59b6; }
.menu-item i.fa-chart-pie { color: #e74c3c; }
.menu-item i.fa-chart-line { color: #3498db; }
.menu-item i.fa-box-open { color: #f39c12; }
.menu-item i.fa-user-chart { color: #1abc9c; }
.menu-item i.fa-bolt { color: #f1c40f; }
.menu-item i.fa-plus-circle { color: #2ecc71; }
.menu-item i.fa-user-plus { color: #3498db; }
.menu-item i.fa-money-bill { color: #27ae60; }
.menu-item i.fa-cog { color: #bdc3c7; }
.menu-item i.fa-home { color: #e67e22; }
.menu-item i.fa-sign-out-alt { color: #e74c3c; }

/* Badge Styles for Menu Items */
.menu-badge {
    background: #e74c3c;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: auto;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2980b9, #1f618d);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 280px;
    padding: 2rem;
    min-height: calc(100vh - 70px);
    margin-top: 70px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.page-title {
    font-size: 1.8rem;
    color: var(--primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* ===== CARD STYLES ===== */
.card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    overflow: hidden;
    border: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 35px rgba(0,0,0,0.15);
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: between;
    align-items: center;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.card-body {
    padding: 1.5rem;
}

/* ===== TABLE STYLES ===== */
.table-responsive {
    overflow-x: auto;
    border-radius: 10px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.table th {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    font-weight: 600;
    border: none;
    font-size: 0.9rem;
}

.table tr:hover {
    background-color: #f8f9fa;
}

.table tr:last-child td {
    border-bottom: none;
}

/* ===== FORM STYLES ===== */
.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-2px);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

/* ===== BUTTON STYLES ===== */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    justify-content: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #2980b9);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #1f618d);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #219652);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #219652, #1e8449);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #e67e22);
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #c0392b);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
}

.btn-info {
    background: linear-gradient(135deg, var(--info), #138496);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #138496, #117a8b);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268, #495057);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* ===== ALERT STYLES ===== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-left: 4px solid var(--success);
}

.alert-error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border-left: 4px solid var(--info);
}

/* ===== STATS & METRICS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    color: white;
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255,255,255,0.3);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 500;
}

/* ===== BADGE STYLES ===== */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

.badge-success {
    background: linear-gradient(135deg, var(--success), #219652);
    color: white;
}

.badge-warning {
    background: linear-gradient(135deg, var(--warning), #e67e22);
    color: white;
}

.badge-danger {
    background: linear-gradient(135deg, var(--danger), #c0392b);
    color: white;
}

.badge-info {
    background: linear-gradient(135deg, var(--info), #138496);
    color: white;
}

.badge-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
}

.badge-primary {
    background: linear-gradient(135deg, var(--accent), #2980b9);
    color: white;
}

/* ===== UTILITY CLASSES ===== */
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-success { color: var(--success) !important; }
.text-info { color: var(--info) !important; }
.text-primary { color: var(--accent) !important; }
.text-muted { color: #6c757d !important; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mb-4 { margin-bottom: 2rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mt-4 { margin-top: 2rem !important; }

/* ===== PRINT STYLES ===== */
@media print {
    .no-print {
        display: none !important;
    }
    
    .sidebar {
        display: none !important;
    }
    
    .header {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        margin-top: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .btn {
        display: none !important;
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .main-content {
        margin-left: 280px;
    }
}

@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
        margin-top: 70px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        padding: 0 1rem;
    }
    
    .content-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .card-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .card-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 576px) {
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
}

/* ===== MOBILE MENU TOGGLE ===== */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    border-radius: 50%;
    padding: 0.8rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
}

/* ===== MOBILE OVERLAY ===== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(44, 62, 80, 0.9), rgba(52, 73, 94, 0.9));
    z-index: 998;
    display: none;
    backdrop-filter: blur(5px);
}

.sidebar-overlay.active {
    display: block;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* ===== RECEIPT PRINT STYLES ===== */
.receipt-print {
    width: 80mm;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 10px;
    background: white;
    margin: 0 auto;
}

.receipt-header {
    text-align: center;
    margin-bottom: 10px;
    border-bottom: 1px dashed #000;
    padding-bottom: 10px;
}

.receipt-items {
    margin: 10px 0;
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.receipt-total {
    border-top: 1px dashed #000;
    padding-top: 10px;
    margin-top: 10px;
    font-weight: bold;
}

.receipt-footer {
    text-align: center;
    margin-top: 15px;
    font-size: 10px;
    color: #666;
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2980b9, #1f618d);
}

/* Add to your style.css */
.badge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.badge-warning {
    color: #000;
    background-color: #ffc107;
}

.menu-item {
    position: relative;
}

.menu-item .badge {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* Footer Styles */
.footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 1rem 0;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
}

.footer-text {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.footer-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.footer-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Ensure main content takes full height */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
}