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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    background: #22389b !important;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    flex-shrink: 0;
}

.search-bar {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

.actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.add-order-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
    white-space: nowrap;
}

.add-order-btn:hover {
    background: #45a049;
}

/* User Menu Styling */
.user-menu {
    position: relative;
    display: inline-block;
}

.user-icon {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.2rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.user-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.user-popup {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.5rem 0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 1000;
    min-width: 140px;
}

.user-popup::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 15px;
    width: 12px;
    height: 12px;
    background: white;
    border-left: 1px solid #e0e0e0;
    border-top: 1px solid #e0e0e0;
    transform: rotate(45deg);
}

.user-popup ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.user-popup li {
    padding: 0;
}

.user-popup a {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s;
}

.user-popup a:hover {
    background-color: #f8f9fa;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-actions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #14277c !important;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-direction: column;
    gap: 1rem;
    z-index: 999;
}

.mobile-actions.show {
    display: flex;
}

/* Navigation Tabs */
.nav-tabs {
    background: white;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.nav-tabs ul {
    list-style: none;
    display: flex;
    overflow-x: auto;
}

.nav-tabs li {
    flex: 1;
    min-width: 120px;
}

.nav-tabs a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: #666;
    text-align: center;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-tabs a.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: #f8f9ff;
}

/* Main Content */
.main-content {
    padding: 20px 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    color: #666;
    margin-top: 5px;
}

/* Orders Grid */
.orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.order-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.order-card.overdue {
    border-left: 4px solid #f44336;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.customer-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

.order-status {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-progress {
    background: #d1ecf1;
    color: #0c5460;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-delivered {
    background: #e2e3e5;
    color: #383d41;
}

.order-details {
    margin: 15px 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    font-size: 0.9rem;
}

.detail-label {
    color: #666;
}

.detail-value {
    font-weight: 500;
}

.payment-info {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
}

.balance-amount {
    color: #f44336;
    font-weight: bold;
}

.paid-amount {
    color: #4CAF50;
    font-weight: bold;
}

/* Forms */
.form-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.file-upload {
    border: 2px dashed #ddd;
    border-radius: 5px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s;
}

.file-upload:hover {
    border-color: #667eea;
}

.file-upload input {
    display: none;
}

.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 30px;
}

/* Filters */
.filters {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    align-items: end;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state img,
.empty-state-icon {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
}

.nav-tabs .tab-link.active {
    border-bottom: 3px solid #667eea !important;
    background: #f8f9ff;
    color: #667eea;
}

/* IMPROVED RESPONSIVE DESIGN */

/* Large tablets and small desktops */
@media (max-width: 992px) {
    .container {
        padding: 0 15px;
    }
    
    .search-bar {
        max-width: 300px;
    }
    
    .logo {
        font-size: 1.6rem;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .header-content {
        gap: 1rem;
    }
    
    .search-bar {
        max-width: 250px;
        flex: 0 1 250px;
    }
    
    .search-bar input {
        padding: 8px 35px 8px 12px;
        font-size: 13px;
        
    }
    
    .logo {
        font-size: 1.4rem;
    }
    
    .add-order-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .user-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .actions {
        gap: 0.8rem;
    }
    
    /* Form adjustments */
    .form-row {
        grid-template-columns: 1fr;
    }

    .orders-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-buttons {
        flex-direction: column;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
    }

    .filters-row {
        grid-template-columns: 1fr;
    }
}

/* Small tablets and large phones */
@media (max-width: 640px) {
    .header {
        position: relative;
        padding: 0.8rem 0;
    }
    
    .header-content {
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .search-bar {
        flex: 1;
        max-width: none;
        margin: 0 0.5rem;
    }
    
    .search-bar input {
        padding: 8px 30px 8px 12px;
        font-size: 13px;
    }
    
    .actions {
        gap: 0.5rem;
    }
    
    .add-order-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .user-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Mobile actions dropdown */
.mobile-actions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #14277c !important;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-direction: column;
    gap: 1rem;
    z-index: 999;
}

/* Show mobile actions when active */
.mobile-actions.show {
    display: flex !important;
}


/* Mobile phones */
@media (max-width: 480px) {
    .header {
        position: relative;
        padding: 0.75rem 0;
    }
    
    .header-content {
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
    }
    
    .logo {
        font-size: 1.2rem;
        flex-shrink: 0;
    }
    
    /* Hide search bar in header, show in mobile menu */
    .search-bar {
        display: none;
    }
    
    /* Hide desktop actions, show in mobile menu */
    .actions {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
        flex-shrink: 0;
    }
    
    /* Mobile actions dropdown - UPDATED */
    .mobile-actions {
        padding: 1rem;
        gap: 1rem;
    }
    
    /* Show search in mobile menu */
    .mobile-actions .search-bar {
        display: block;
        max-width: none;
        flex: none;
    }
    
    .mobile-actions .search-bar input {
        padding: 10px 35px 10px 15px;
        font-size: 14px;
    }
    
    /* Show actions in mobile menu */
    .mobile-actions .actions {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 1rem;
    }
    
    /* Ensure mobile add-order button is visible */
    .mobile-actions .add-order-btn {
        display: block;
        flex: 1;
        text-align: center;
        white-space: nowrap;
    }
    
    /* Ensure user icon is visible in mobile menu */
    .mobile-actions .user-menu {
        display: block;
        flex-shrink: 0;
    }
    
    /* Other mobile adjustments */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 10px;
    }
}
/* Very small screens */
@media (max-width: 360px) {
    .logo {
        font-size: 1.1rem;
    }
    
    .mobile-menu-toggle {
        font-size: 1.3rem;
        padding: 0.3rem;
    }
    
    .container {
        padding: 0 8px;
    }
}

/* Compact Footer Styles */
.footer {
    background: #22389b;
    color: white;
    padding: 1rem 0;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.footer-logo {
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
}

.footer-copyright {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.footer-right a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-right a:hover {
    color: white;
}

/* Responsive Footer */
@media (max-width: 768px) {
    .footer-content {
        justify-content: center;
        text-align: center;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .footer-left {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .footer-right {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .footer {
        padding: 0.8rem 0;
    }
    
    .footer-logo {
        font-size: 1rem;
    }
    
    .footer-copyright {
        font-size: 0.8rem;
    }
    
    .footer-right a {
        font-size: 0.85rem;
    }
}

/* Body layout adjustment to make footer stick to bottom */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@media (max-width: 480px) {
  .search-bar,
  .actions {
    display: flex !important;
  }
  .mobile-menu-toggle {
    display: none !important;
  }
}
