/* ========================================
   MARBLETECH INVOICE MANAGEMENT
   ADVANCED MOBILE-FIRST RESPONSIVE CSS
   ======================================== */

/* ========== BASE & RESET ========== */
@media screen and (max-width: 768px) {
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        -webkit-tap-highlight-color: transparent;
    }

    body {
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
        background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2c 100%);
        min-height: 100vh;
        overflow-x: hidden;
        padding-bottom: 20px;
    }

    /* ========== ADVANCED NAVIGATION ========== */
    .advanced-navbar {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        position: sticky;
        top: 0;
        z-index: 1000;
        border-bottom: 2px solid rgba(244, 208, 63, 0.3);
    }

    .navbar-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 15px;
        height: auto;
        min-height: 60px;
        flex-wrap: nowrap;
    }

    /* Logo Section */
    .navbar-logo {
        display: flex;
        align-items: center;
        gap: 10px;
        text-decoration: none;
        flex: 1;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
        background: linear-gradient(135deg, #f4d03f, #f1c40f);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #1a1a1a;
        font-size: 18px;
        font-weight: 700;
        box-shadow: 0 4px 15px rgba(244, 208, 63, 0.4);
    }

    .logo-text {
        color: #2c2c2c;
        font-size: 18px;
        font-weight: 800;
        letter-spacing: -0.3px;
    }

    .logo-subtitle {
        display: none;
    }

    /* Mobile Menu Toggle Button */
    .mobile-menu-toggle {
        display: flex;
        background: linear-gradient(135deg, #2c2c2c, #1a1a1a);
        color: #f4d03f;
        border: none;
        padding: 10px;
        border-radius: 10px;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        margin-right: 10px;
    }

    .mobile-menu-toggle i {
        font-size: 20px;
    }

    /* Logout Button Mobile - Always Visible */
    .logout-btn {
        background: linear-gradient(135deg, #e74c3c, #c0392b);
        color: white;
        border: none;
        padding: 8px 12px;
        border-radius: 10px;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 5px;
        box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    }

    .logout-btn i {
        font-size: 14px;
    }

    /* Navigation Menu Mobile - Hidden by default */
    .navbar-nav {
        display: none;
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: linear-gradient(135deg, #2c2c2c, #1a1a1a);
        flex-direction: column;
        list-style: none;
        gap: 0;
        padding: 80px 20px 20px 20px;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
        transition: left 0.3s ease;
        z-index: 9999;
        overflow-y: auto;
    }

    /* Sidebar Open State */
    .navbar-nav.sidebar-open {
        display: flex;
        left: 0;
    }

    /* Sidebar Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(5px);
        z-index: 9998;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Close Button in Sidebar */
    .sidebar-close {
        position: absolute;
        top: 15px;
        right: 15px;
        background: rgba(231, 76, 60, 0.2);
        color: #e74c3c;
        border: none;
        padding: 8px;
        border-radius: 50%;
        cursor: pointer;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
    }

    /* Hide all navigation items except Dashboard */
    .nav-item {
        display: none;
        width: 100%;
    }

    /* Show only Dashboard */
    .nav-item:first-child {
        display: block;
    }

    .nav-link {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 15px 20px;
        color: #f4d03f;
        text-decoration: none;
        font-weight: 600;
        font-size: 16px;
        border-radius: 12px;
        transition: all 0.3s ease;
        background: rgba(255, 255, 255, 0.05);
        width: 100%;
        margin-bottom: 10px;
    }

    .nav-link i {
        font-size: 20px;
    }

    .nav-link.active {
        background: linear-gradient(135deg, #f4d03f, #f1c40f);
        color: #1a1a1a;
        box-shadow: 0 4px 12px rgba(244, 208, 63, 0.4);
    }

    .nav-link:hover {
        background: rgba(244, 208, 63, 0.1);
        transform: translateX(5px);
    }

    /* Logout in Sidebar */
    .navbar-nav .logout-btn {
        width: 100%;
        padding: 15px 20px;
        font-size: 16px;
        margin-top: auto;
        justify-content: center;
    }

    /* Notification Bell Mobile */
    .notification-container {
        position: relative;
        margin-right: 10px;
    }

    .notification-btn {
        background: linear-gradient(135deg, #f39c12, #e67e22);
        color: white;
        border: none;
        padding: 10px;
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .notification-badge {
        position: absolute;
        top: -4px;
        right: -4px;
        background: #e74c3c;
        color: white;
        border-radius: 50%;
        width: 20px;
        height: 20px;
        font-size: 10px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid white;
    }

    .notification-dropdown {
        position: fixed;
        top: 70px;
        left: 10px;
        right: 10px;
        background: white;
        border-radius: 15px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
        max-height: 70vh;
        overflow-y: auto;
        z-index: 9999;
    }

    /* ========== MAIN CONTAINER ========== */
    .main-container {
        max-width: 100%;
        padding: 15px;
        margin: 0;
    }

    /* ========== PAGE HEADER ========== */
    .page-header {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border-radius: 15px;
        padding: 20px 15px;
        margin-bottom: 20px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    }

    .header-content {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .header-title {
        display: flex;
        align-items: center;
        gap: 12px;
        justify-content: center;
    }

    .header-title h1 {
        color: #2c2c2c;
        font-size: 22px;
        font-weight: 700;
        margin: 0;
    }

    .header-title i {
        color: #f4d03f;
        font-size: 28px;
    }

    /* Statistics Cards Mobile */
    .header-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card,
    .net-revenue {
        background: linear-gradient(135deg, #f4d03f, #f1c40f);
        color: #1a1a1a;
        padding: 15px;
        border-radius: 12px;
        text-align: center;
        box-shadow: 0 4px 15px rgba(244, 208, 63, 0.3);
    }

    .stat-card:hover,
    .net-revenue:hover {
        transform: translateY(-2px);
    }

    .stat-number {
        font-size: 18px;
        font-weight: 700;
        margin-bottom: 5px;
    }

    .stat-label {
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        line-height: 1.2;
    }

    /* ========== EXPENDITURE SECTION ========== */
    .expenditure-section {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border-radius: 15px;
        padding: 15px;
        margin-bottom: 20px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .expenditure-btn,
    .view-exp-btn {
        background: linear-gradient(135deg, #e74c3c, #c0392b);
        color: white;
        border: none;
        padding: 12px 20px;
        border-radius: 12px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
        width: 100%;
    }

    .view-exp-btn {
        background: linear-gradient(135deg, #27ae60, #2ecc71);
        box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    }

    /* ========== DOWNLOAD SECTION ========== */
    .download-section {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border-radius: 15px;
        padding: 15px;
        margin-bottom: 20px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    }

    .download-section h3 {
        text-align: center;
        color: #2c2c2c;
        margin-bottom: 15px;
        font-size: 16px;
        font-weight: 600;
    }

    .download-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .download-btn {
        background: linear-gradient(135deg, #27ae60, #2ecc71);
        color: white;
        border: none;
        padding: 12px 15px;
        border-radius: 12px;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
        box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    }

    .download-btn i {
        font-size: 18px;
    }

    /* ========== SEARCH & FILTER BAR ========== */
    .search-filter-bar {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border-radius: 15px;
        padding: 15px;
        margin-bottom: 20px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    }

    .search-filter-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .search-group {
        position: relative;
        width: 100%;
    }

    .search-input {
        width: 100%;
        padding: 12px 40px 12px 15px;
        border: 2px solid #e1e5e9;
        border-radius: 10px;
        font-size: 14px;
        background: white;
    }

    .search-icon {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: #666;
        font-size: 16px;
    }

    .filter-select {
        width: 100%;
        padding: 12px 35px 12px 15px;
        border: 2px solid #e1e5e9;
        border-radius: 10px;
        font-size: 14px;
        background: white;
        appearance: none;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
        background-position: right 10px center;
        background-repeat: no-repeat;
        background-size: 14px;
    }

    .refresh-btn {
        background: linear-gradient(135deg, #2c2c2c, #1a1a1a);
        color: #f4d03f;
        border: none;
        padding: 12px 20px;
        border-radius: 10px;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        box-shadow: 0 4px 15px rgba(244, 208, 63, 0.3);
    }

    /* ========== INVOICE TABLE ========== */
    .invoice-table-container {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border-radius: 15px;
        padding: 15px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
        overflow: hidden;
    }

    .table-wrapper {
        overflow-x: auto;
        border-radius: 12px;
        -webkit-overflow-scrolling: touch;
    }

    .invoice-table {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        background: white;
        border-radius: 12px;
        overflow: hidden;
        min-width: 600px;
    }

    .invoice-table thead th {
        background: linear-gradient(135deg, #2c2c2c, #1a1a1a);
        color: white;
        padding: 12px 8px;
        text-align: left;
        font-weight: 600;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .invoice-table tbody td {
        padding: 12px 8px;
        border-bottom: 1px solid #f0f0f0;
        font-size: 12px;
        vertical-align: middle;
    }

    .invoice-table tbody tr:hover {
        background: linear-gradient(135deg, rgba(244, 208, 63, 0.05), rgba(241, 196, 15, 0.05));
    }

    .invoice-id {
        font-weight: 600;
        color: #2c2c2c;
        font-size: 11px;
    }

    .customer-info {
        display: flex;
        flex-direction: column;
        gap: 3px;
    }

    .customer-name {
        font-weight: 600;
        color: #2c2c2c;
        font-size: 12px;
    }

    .customer-mobile {
        color: #666;
        font-size: 10px;
    }

    .amount-cell {
        font-weight: 700;
        font-size: 13px;
        color: #27ae60;
    }

    .date-cell {
        color: #666;
        font-weight: 500;
        font-size: 11px;
    }

    /* Action Buttons Mobile */
    .actions-cell {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .action-btn {
        padding: 6px 10px;
        border: none;
        border-radius: 6px;
        font-size: 10px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        white-space: nowrap;
    }

    .btn-view {
        background: linear-gradient(135deg, #3498db, #2980b9);
        color: white;
        box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
    }

    .btn-edit {
        background: linear-gradient(135deg, #f39c12, #e67e22);
        color: white;
        box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
    }

    .btn-delete {
        background: linear-gradient(135deg, #e74c3c, #c0392b);
        color: white;
        box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    }

    /* ========== MODALS ========== */
    .modal,
    .expenditure-modal,
    .pdf-preview-modal {
        display: none;
        position: fixed;
        z-index: 2000;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(5px);
        overflow-y: auto;
    }

    .modal-content,
    .expenditure-modal-content {
        background: white;
        margin: 10px;
        padding: 20px;
        border-radius: 15px;
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
        overflow-y: auto;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    }

    .modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 2px solid #f0f0f0;
    }

    .modal-header h2 {
        color: #2c2c2c;
        font-size: 18px;
        font-weight: 700;
        margin: 0;
    }

    .close-btn {
        background: none;
        border: none;
        font-size: 28px;
        cursor: pointer;
        color: #666;
        padding: 0;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Invoice Details in Modal */
    .invoice-details {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }

    .detail-group {
        background: #f8fafc;
        padding: 12px;
        border-radius: 10px;
        border-left: 4px solid #f4d03f;
    }

    .detail-label {
        font-weight: 600;
        color: #374151;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        margin-bottom: 5px;
    }

    .detail-value {
        color: #1f2937;
        font-size: 14px;
        font-weight: 500;
    }

    /* Form Inputs Mobile */
    .form-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 15px;
    }

    .form-label {
        font-weight: 600;
        color: #2c2c2c;
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    .form-input,
    .form-textarea {
        padding: 12px;
        border: 2px solid #e1e5e9;
        border-radius: 10px;
        font-size: 14px;
        font-family: inherit;
        width: 100%;
    }

    .form-textarea {
        min-height: 80px;
        resize: vertical;
    }

    .form-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
    }

    .save-btn,
    .cancel-btn {
        padding: 12px 20px;
        border: none;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        width: 100%;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    .save-btn {
        background: linear-gradient(135deg, #27ae60, #2ecc71);
        color: white;
    }

    .cancel-btn {
        background: linear-gradient(135deg, #95a5a6, #7f8c8d);
        color: white;
    }

    /* ========== PDF PREVIEW MODAL ========== */
    .pdf-preview-content {
        background: white;
        margin: 10px;
        padding: 0;
        border-radius: 15px;
        width: calc(100% - 20px);
        height: calc(100vh - 20px);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .pdf-preview-header {
        background: linear-gradient(135deg, #2c2c2c, #1a1a1a);
        color: white;
        padding: 15px;
        border-radius: 15px 15px 0 0;
    }

    .pdf-preview-header h2 {
        margin: 0;
        font-size: 16px;
        color: #f4d03f;
    }

    .pdf-preview-controls {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 15px;
        background: #f8fafc;
        border-bottom: 2px solid #e1e5e9;
    }

    .date-selector {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .date-selector label {
        font-weight: 600;
        color: #2c2c2c;
        font-size: 12px;
    }

    .date-selector input[type="date"],
    .date-selector select {
        padding: 10px;
        border: 2px solid #e1e5e9;
        border-radius: 8px;
        font-size: 13px;
        width: 100%;
    }

    .preview-btn,
    .download-pdf-btn {
        padding: 10px 15px;
        border: none;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        width: 100%;
    }

    .preview-btn {
        background: linear-gradient(135deg, #3498db, #2980b9);
        color: white;
    }

    .download-pdf-btn {
        background: linear-gradient(135deg, #27ae60, #2ecc71);
        color: white;
    }

    .pdf-preview-body {
        flex: 1;
        overflow-y: auto;
        padding: 15px;
        background: #f8fafc;
    }

    .preview-container {
        background: white;
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }

    .preview-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 11px;
        overflow-x: auto;
    }

    .preview-table thead th {
        background: linear-gradient(135deg, #2c2c2c, #1a1a1a);
        color: #f4d03f;
        padding: 10px 6px;
        text-align: left;
        font-weight: 600;
        font-size: 10px;
        text-transform: uppercase;
    }

    .preview-table tbody td {
        padding: 8px 6px;
        border-bottom: 1px solid #e1e5e9;
        font-size: 10px;
    }

    /* ========== LOADING & EMPTY STATES ========== */
    .loading-container {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 40px;
        flex-direction: column;
        gap: 15px;
    }

    .loading-spinner {
        width: 40px;
        height: 40px;
        border: 4px solid #f0f0f0;
        border-top: 4px solid #f4d03f;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

    .loading-text {
        color: #666;
        font-size: 14px;
        font-weight: 500;
    }

    .empty-state {
        text-align: center;
        padding: 40px 15px;
        color: #666;
    }

    .empty-state i {
        font-size: 48px;
        color: #ddd;
        margin-bottom: 15px;
    }

    .empty-state h3 {
        font-size: 18px;
        font-weight: 600;
        margin-bottom: 10px;
        color: #333;
    }

    .empty-state p {
        font-size: 13px;
        line-height: 1.6;
    }

    /* ========== NOTIFICATION ITEMS ========== */
    .notification-item {
        padding: 12px;
        border-radius: 10px;
        margin-bottom: 8px;
        background: linear-gradient(135deg, #fff3cd, #ffeaa7);
        border-left: 4px solid #f39c12;
        cursor: pointer;
        font-size: 12px;
    }

    .notification-item-urgent {
        background: linear-gradient(135deg, #ffe8e8, #ffcccc);
        border-left-color: #e74c3c;
    }

    /* ========== FOOTER ========== */
    footer {
        background-color: #f1f1f1;
        padding: 20px 15px;
        text-align: center;
        margin-top: 30px;
        border-top: 1px solid #ccc;
    }

    footer div {
        font-size: 13px;
        color: #333;
        margin-bottom: 10px;
    }

    /* ========== ANIMATIONS ========== */
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }

    @keyframes modalSlideIn {
        from {
            opacity: 0;
            transform: translateY(-30px) scale(0.95);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }

    /* ========== UTILITY CLASSES ========== */
    .text-center {
        text-align: center;
    }

    .mt-20 {
        margin-top: 20px;
    }

    .mb-20 {
        margin-bottom: 20px;
    }

    .p-15 {
        padding: 15px;
    }

    /* ========== BALANCE SECTIONS ========== */
    .balance-section {
        background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
        padding: 15px;
        border-radius: 12px;
        margin-bottom: 20px;
        border-left: 4px solid #27ae60;
    }

    .balance-section h3 {
        color: #2c2c2c;
        font-size: 16px;
        margin-bottom: 12px;
    }

    .balance-row {
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
        font-size: 13px;
    }

    .balance-label {
        font-weight: 600;
        color: #555;
    }

    .balance-value {
        font-weight: 700;
        color: #27ae60;
    }

    /* ========== DISCOUNT MODAL ========== */
    #discountModal .modal-content {
        max-height: 80vh;
    }

    #discountModalContent {
        max-height: 50vh;
        overflow-y: auto;
    }

    /* ========== DELIVERY MODAL ========== */
    #deliveryModal .form-input {
        font-size: 14px;
    }

    /* ========== RESPONSIVE TWEAKS ========== */
    @media screen and (max-width: 480px) {
        .navbar-container {
            padding: 10px 12px;
        }

        .logo-text {
            font-size: 16px;
        }

        .logo-icon {
            width: 35px;
            height: 35px;
            font-size: 16px;
        }

        .header-title h1 {
            font-size: 18px;
        }

        .header-title i {
            font-size: 24px;
        }

        .stat-number {
            font-size: 16px;
        }

        .stat-label {
            font-size: 9px;
        }

        .download-buttons {
            grid-template-columns: 1fr;
        }

        .header-stats {
            grid-template-columns: 1fr;
        }

        .invoice-table {
            min-width: 500px;
        }

        .invoice-table thead th,
        .invoice-table tbody td {
            padding: 10px 6px;
            font-size: 11px;
        }

        .action-btn {
            font-size: 9px;
            padding: 5px 8px;
        }
    }

    /* ========== ARCHIVE SECTION ========== */
    .archive-section {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border-radius: 15px;
        padding: 15px;
        margin-bottom: 20px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    }

    .archive-section h3 {
        text-align: center;
        color: #2c2c2c;
        margin-bottom: 15px;
        font-size: 16px;
        font-weight: 600;
    }

    .archive-btn {
        background: linear-gradient(135deg, #3498db, #2980b9);
        color: white;
        border: none;
        padding: 12px 20px;
        border-radius: 12px;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        margin-bottom: 10px;
        box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    }

    /* ========== PAYMENT HISTORY CELL ========== */
    .payment-history-cell {
        font-size: 10px;
        line-height: 1.4;
        color: #666;
        white-space: pre-wrap;
    }

    /* ========== EXPENDITURE ITEMS ========== */
    .expenditure-item {
        background: #f9f9f9;
        border: 1px solid #ddd;
        padding: 12px;
        margin-bottom: 10px;
        border-radius: 10px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .expenditure-item p {
        margin: 0;
        font-size: 12px;
        color: #333;
    }

    .expenditure-item button {
        padding: 8px 12px;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        font-size: 11px;
        font-weight: 600;
        transition: all 0.3s ease;
    }

    .expenditure-item .edit-btn {
        background: linear-gradient(135deg, #3498db, #2980b9);
        color: white;
    }

    .expenditure-item .delete-btn {
        background: linear-gradient(135deg, #e74c3c, #c0392b);
        color: white;
    }

    /* ========== SUMMARY SECTION ========== */
    .summary-section {
        background: linear-gradient(135deg, #f8fafc, #e8f5e9);
        padding: 15px;
        border-radius: 12px;
        margin-top: 20px;
        border-left: 4px solid #3498db;
    }

    .summary-section h3 {
        color: #2c2c2c;
        font-size: 16px;
        margin-bottom: 12px;
    }

    .closing-balance {
        background: white;
        padding: 15px;
        border-radius: 10px;
        margin-top: 15px;
        text-align: center;
    }

    .closing-balance-value {
        font-size: 22px;
        font-weight: 700;
    }

    /* ========== PREVIEW HEADER SECTION ========== */
    .preview-header-section {
        text-align: center;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 3px solid #f4d03f;
    }

    .preview-header-section h1 {
        color: #2c2c2c;
        font-size: 20px;
        margin-bottom: 8px;
    }

    .preview-header-section h2 {
        color: #666;
        font-size: 16px;
        margin-bottom: 6px;
    }

    .preview-header-section p {
        color: #999;
        font-size: 12px;
    }

    /* ========== TABLE CONTAINER ========== */
    .preview-table-container {
        margin: 20px 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ========== ARCHIVE MODALS ========== */
    #archiveModal .modal-content,
    #viewArchiveModal .modal-content,
    #restoreArchiveModal .modal-content {
        max-width: 100%;
        margin: 10px;
        width: calc(100% - 20px);
    }

    #archiveListContainer,
    #archivedInvoicesContainer {
        padding: 15px;
        max-height: 60vh;
        overflow-y: auto;
    }

    /* ========== DISCOUNT DETAILS ========== */
    .discount-item {
        background: white;
        padding: 15px;
        border-radius: 12px;
        margin-bottom: 12px;
        border-left: 4px solid #27ae60;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    /* ========== REMAINING PAYMENT SECTION ========== */
    #outstandingBalance {
        font-size: 20px;
        font-weight: 700;
        color: #e74c3c;
    }

    input[type="number"]#remainingPaymentAmount,
    input[type="number"]#discountAmount {
        font-size: 15px;
        font-weight: 600;
    }

    /* ========== ACTION BUTTON GROUPS ========== */
    .expenditure-btns {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    /* ========== NOTIFICATION EMPTY STATE ========== */
    .notification-empty {
        text-align: center;
        padding: 30px 15px;
        color: #999;
    }

    .notification-empty i {
        font-size: 40px;
        color: #ddd;
        margin-bottom: 12px;
    }

    /* ========== OWNER PAYMENT SECTION ========== */
    #ownerPaymentSection {
        background: #f8fafc;
        padding: 12px;
        border-radius: 10px;
        border-left: 4px solid #3498db;
    }

    /* ========== TIMER DISPLAY ========== */
    #viewTimer {
        font-weight: 700;
        color: #e74c3c;
        font-size: 16px;
    }

    /* ========== SCROLLBAR STYLING ========== */
    .modal-content::-webkit-scrollbar,
    .table-wrapper::-webkit-scrollbar,
    .notification-dropdown::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    .modal-content::-webkit-scrollbar-track,
    .table-wrapper::-webkit-scrollbar-track,
    .notification-dropdown::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }

    .modal-content::-webkit-scrollbar-thumb,
    .table-wrapper::-webkit-scrollbar-thumb,
    .notification-dropdown::-webkit-scrollbar-thumb {
        background: #f4d03f;
        border-radius: 10px;
    }

    /* ========== TOUCH OPTIMIZATIONS ========== */
    button,
    .action-btn,
    .nav-link,
    .notification-btn,
    .logout-btn {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    /* ========== INVOICE DETAILS ACTIONS ========== */
    .invoice-details + div[style*="display: flex"] {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin: 20px 0;
    }

    .invoice-details + div[style*="display: flex"] button {
        width: 100%;
        padding: 12px;
        border-radius: 10px;
        font-size: 13px;
    }

    /* ========== DATE RANGE INPUTS ========== */
    input[type="date"] {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        font-size: 14px;
    }

    /* ========== PREVIEW ARCHIVE SECTION ========== */
    #archivePreview {
        background: #f8fafc;
        padding: 15px;
        border-radius: 10px;
        margin: 15px 0;
    }

    #archivePreview h4 {
        margin-bottom: 10px;
        color: #2c2c2c;
        font-size: 15px;
    }

    #archivePreview p {
        margin: 8px 0;
        font-size: 13px;
        color: #555;
    }

    /* ========== CONFIRM BUTTONS ========== */
    #confirmArchiveBtn {
        background: linear-gradient(135deg, #27ae60, #2ecc71);
        color: white;
        border: none;
        padding: 12px 20px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    #confirmArchiveBtn:disabled {
        background: linear-gradient(135deg, #95a5a6, #7f8c8d);
        cursor: not-allowed;
        opacity: 0.6;
    }

    /* ========== WARNING BOX ========== */
    div[style*="background: #fff3cd"] {
        background: #fff3cd !important;
        padding: 12px !important;
        border-radius: 8px !important;
        border-left: 4px solid #f39c12 !important;
        margin-top: 15px !important;
    }

    div[style*="background: #fff3cd"] p {
        margin: 0 !important;
        font-size: 11px !important;
        color: #856404 !important;
        line-height: 1.5 !important;
    }

    /* ========== USER AVATAR ========== */
    .user-avatar {
        width: 40px;
        height: 40px;
        background: linear-gradient(135deg, #2c2c2c, #1a1a1a);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #f4d03f;
        font-size: 14px;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    /* ========== GRID LAYOUTS FOR DETAILS ========== */
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    div[style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    div[style*="grid-template-columns: repeat(2, 1fr)"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* ========== PAYMENT DETAILS SECTION ========== */
    div[style*="background: linear-gradient(135deg, #f8fafc, #e8f5e9)"] {
        padding: 15px !important;
        border-radius: 12px !important;
        margin-top: 20px !important;
    }

    /* ========== OUTSTANDING BALANCE DISPLAY ========== */
    div[style*="border: 2px solid #f39c12"] {
        background: white !important;
        padding: 12px !important;
        border-radius: 8px !important;
        margin-bottom: 12px !important;
    }

    /* ========== FLEX CONTAINERS ========== */
    div[style*="display: flex; gap: 15px"] {
        flex-direction: column !important;
        gap: 10px !important;
    }

    div[style*="display: flex; justify-content: space-between"] {
        flex-wrap: wrap !important;
    }

    /* ========== DISCOUNT MESSAGE ========== */
    div[id^="discountMsg_"] {
        margin-top: 10px !important;
        padding: 10px !important;
        background: #d4edda !important;
        color: #155724 !important;
        border-radius: 8px !important;
        font-size: 11px !important;
        font-weight: 600 !important;
    }

    /* ========== PAYMENT HISTORY STYLING ========== */
    div[style*="background: #e8f5e9"] tr {
        background: #e8f5e9 !important;
    }

    div[style*="background: #ffe8e8"] tr {
        background: #ffe8e8 !important;
    }

    /* ========== MODAL TOTAL DISCOUNT ========== */
    #modalTotalDiscount {
        font-size: 20px;
        font-weight: 700;
        color: #27ae60;
    }

    /* ========== SAFE AREA INSETS (iPhone X+) ========== */
    @supports (padding: max(0px)) {
        .navbar-container {
            padding-left: max(15px, env(safe-area-inset-left));
            padding-right: max(15px, env(safe-area-inset-right));
        }

        .main-container {
            padding-left: max(15px, env(safe-area-inset-left));
            padding-right: max(15px, env(safe-area-inset-right));
            padding-bottom: max(20px, env(safe-area-inset-bottom));
        }

        .modal-content,
        .expenditure-modal-content {
            margin-left: max(10px, env(safe-area-inset-left));
            margin-right: max(10px, env(safe-area-inset-right));
        }
    }

    /* ========== LANDSCAPE MODE ========== */
    @media screen and (max-width: 768px) and (orientation: landscape) {
        .navbar-container {
            height: 50px;
            min-height: 50px;
        }

        .navbar-nav {
            margin-top: 0;
            padding-top: 0;
            border-top: none;
            flex-wrap: nowrap;
        }

        .header-stats {
            grid-template-columns: repeat(3, 1fr);
        }

        .download-buttons {
            grid-template-columns: repeat(4, 1fr);
        }

        .modal-content,
        .expenditure-modal-content {
            max-height: 90vh;
        }
    }

    /* ========== DARK MODE SUPPORT (Optional) ========== */
    @media (prefers-color-scheme: dark) {
        body {
            background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
        }

        .page-header,
        .search-filter-bar,
        .invoice-table-container,
        .expenditure-section,
        .download-section {
            background: rgba(30, 30, 30, 0.98);
        }

        .header-title h1,
        .modal-header h2 {
            color: #f4d03f;
        }

        .modal-content,
        .expenditure-modal-content,
        .invoice-table {
            background: #2c2c2c;
        }

        .detail-group {
            background: #1a1a1a;
        }

        .search-input,
        .filter-select,
        .form-input,
        .form-textarea {
            background: #1a1a1a;
            color: #fff;
            border-color: #444;
        }
    }

    /* ========== PRINT STYLES ========== */
    @media print {
        .advanced-navbar,
        .expenditure-section,
        .download-section,
        .search-filter-bar,
        .actions-cell {
            display: none !important;
        }

        body {
            background: white;
        }

        .page-header,
        .invoice-table-container {
            box-shadow: none;
            border: 1px solid #ddd;
        }
    }

    /* ========== ACCESSIBILITY IMPROVEMENTS ========== */
    .action-btn:focus,
    .nav-link:focus,
    .form-input:focus,
    .filter-select:focus,
    button:focus {
        outline: 3px solid #f4d03f;
        outline-offset: 2px;
    }

    /* ========== HIGH CONTRAST MODE ========== */
    @media (prefers-contrast: high) {
        .nav-link,
        .action-btn,
        button {
            border: 2px solid currentColor;
        }

        .stat-card,
        .net-revenue {
            border: 2px solid #1a1a1a;
        }
    }

    /* ========== REDUCED MOTION ========== */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }

        .loading-spinner {
            animation: none;
            border-top-color: #f4d03f;
        }
    }

    /* ========== END MOBILE RESPONSIVE CSS ========== */
}

/* ========== ADDITIONAL MOBILE OPTIMIZATIONS ========== */
@media screen and (max-width: 375px) {
    .navbar-container {
        padding: 8px 10px;
    }

    .logo-text {
        font-size: 15px;
    }

    .header-title h1 {
        font-size: 16px;
    }

    .stat-number {
        font-size: 15px;
    }

    .stat-label {
        font-size: 8px;
    }

    .action-btn {
        font-size: 8px;
        padding: 4px 6px;
    }

    .invoice-table {
        min-width: 450px;
        font-size: 10px;
    }

    .modal-content,
    .expenditure-modal-content {
        padding: 15px;
    }

    .modal-header h2 {
        font-size: 16px;
    }

    .form-input,
    .form-textarea {
        font-size: 13px;
    }
}