/* ============================================
   RESPONSIVE STYLES - Media Queries
   ============================================ */

/* ----------------------------------------
   Tablets (768px and below)
   ---------------------------------------- */
@media (max-width: 768px) {
    /* Header */
    .header {
        padding: 24px 16px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header p {
        font-size: 0.9rem;
    }
    
    .header-top-right {
        position: static;
        margin-top: 10px;
    }
    
    .status-indicator {
        margin: 0;
    }
    
    .header-logout-btn {
        align-self: flex-end;
        padding: 4px 10px;
        font-size: 11px;
    }
    
    /* Dashboard */
    .dashboard {
        padding: 20px 16px;
    }
    
    .dashboard h2 {
        font-size: 1.2rem;
    }
    
    /* Month Selector */
    .month-selector {
        padding: 16px;
    }
    
    /* Content */
    .content {
        padding: 16px;
    }
    
    .tab-content {
        padding: 16px;
    }
    
    /* Grids */
    .summary-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .summary-card {
        padding: 16px;
    }
    
    .summary-card .amount {
        font-size: 1.5rem;
    }
    
    .statistics-grid {
        grid-template-columns: 1fr;
    }
    
    .management-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    /* Tabs */
    .tab-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 4px;
    }
    
    .tab-nav::-webkit-scrollbar {
        display: none;
    }
    
    .tab-button {
        padding: 10px 14px;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .tab-button .tab-icon {
        font-size: 14px;
    }
    
    .tab-pane h2 {
        font-size: 1.2rem;
    }
    
    /* Tables - horizontal scroll */
    .table-container,
    .trend-summary {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 11px;
        min-width: 600px;
    }
    
    .trend-table {
        font-size: 11px;
        min-width: 500px;
    }
    
    .trend-table th,
    .trend-table td {
        padding: 8px 10px;
    }
    
    th, td {
        padding: 10px 12px;
    }
    
    /* Form elements */
    .input-field {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 12px;
    }
    
    /* Trend section */
    .trend-range-selector {
        flex-direction: column;
        align-items: stretch !important;
        gap: 8px !important;
    }
    
    .trend-range-selector select,
    .trend-range-selector input {
        width: 100%;
    }
    
    #trendCustomRange {
        flex-direction: column !important;
        width: 100%;
    }
    
    /* Profile form */
    .profile-form {
        padding: 16px;
    }

    .profile-form.compact-admin .profile-grid {
        grid-template-columns: 1fr;
    }

    .profile-form .compact-section summary {
        padding: 10px 12px;
    }
    
    .checkbox-group {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Management buttons */
    .management-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .management-buttons .btn {
        width: 100%;
    }
    
    /* Wizard */
    .wizard-steps {
        flex-direction: column;
        gap: 10px;
    }
    
    .wizard {
        width: 95%;
        top: 20px;
    }
}

/* ----------------------------------------
   Enhanced Tablet Styles (600px - 768px)
   Hamburger Menu & Optimized Forms
   ---------------------------------------- */
@media (max-width: 768px) and (min-width: 600px) {
    /* Sidebar hamburger menu */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 900;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    /* Hamburger toggle button */
    #sidebarToggle {
        display: block;
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
        padding: 8px 12px;
    }
    
    /* Form layouts: Stack vertically */
    .form-table {
        display: block !important;
    }
    
    .form-table tr {
        display: block;
        margin-bottom: 15px;
        border-bottom: 1px solid #e2e8f0;
        padding-bottom: 15px;
    }
    
    .form-table td {
        display: block;
        width: 100% !important;
        text-align: left !important;
        margin-bottom: 8px;
    }
    
    .form-table label {
        display: block;
        font-weight: 600;
        margin-bottom: 6px;
        color: #2d3748;
    }
    
    .form-table input,
    .form-table select,
    .form-table textarea {
        width: 100% !important;
        box-sizing: border-box;
    }
    
    /* Button sizing for touch */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn-primary, .btn-secondary {
        padding: 12px 20px !important;
        font-size: 14px !important;
    }
    
    /* Section controls layout */
    .section-controls {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .section-controls > div,
    .section-controls > button {
        width: 100%;
    }
    
    .profile-selector,
    .profile-selector select {
        width: 100%;
    }
}

/* ----------------------------------------
   Mobile (< 600px)
   ---------------------------------------- */
@media (max-width: 599px) {
    /* Hide sidebar completely on small phones */
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    /* Reduced padding */
    .page-section {
        padding: 12px;
    }
    
    /* Stack all controls */
    .section-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    /* Full-width buttons */
    .btn {
        width: 100%;
        min-height: 44px;
    }
    
    /* Tables convert to card layout */
    table {
        border-collapse: collapse;
    }
    
    table thead {
        display: none;
    }
    
    table tbody tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }
}

/* ----------------------------------------
   Extra Small Devices (480px and below)
   ---------------------------------------- */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.25rem;
    }
    
    .summary-card .amount {
        font-size: 1.25rem;
    }
    
    /* Hide tab text, show only icons */
    .tab-button span:not(.tab-icon) {
        display: none;
    }
    
    .tab-button {
        padding: 10px 12px;
    }
    
    .tab-button .tab-icon {
        font-size: 18px;
    }
}

/* ----------------------------------------
   Print Styles
   ---------------------------------------- */
@media print {
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    body {
        background: white !important;
        padding: 0 !important;
        font-size: 11px;
        line-height: 1.3;
    }
    
    .container {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: white !important;
    }
    
    .header {
        background: #2d3748 !important;
        color: white !important;
        padding: 15px !important;
        text-align: center;
        page-break-inside: avoid;
        margin-bottom: 0 !important;
    }
    
    .header h1 {
        font-size: 24px !important;
        margin-bottom: 5px !important;
        text-shadow: none !important;
    }
    
    .dashboard {
        background: #f8f9fa !important;
        color: #2d3748 !important;
        padding: 15px !important;
        page-break-inside: avoid;
    }
    
    .summary-card {
        background: white !important;
        color: #2d3748 !important;
        border: 1px solid #e2e8f0 !important;
        padding: 10px !important;
    }
    
    /* Hide interactive elements */
    .section-header,
    .section-controls,
    .btn,
    .file-input-label,
    .wizard,
    .wizard-overlay,
    .profile-form,
    .template-section,
    .status-indicator {
        display: none !important;
    }
    
    .section {
        margin-bottom: 15px !important;
        background: white !important;
        border-left: 3px solid #4299e1 !important;
    }
    
    .section-content {
        padding: 10px !important;
        display: block !important;
    }
    
    /* Table print styles */
    table {
        font-size: 10px !important;
        page-break-inside: auto;
    }
    
    th {
        background: #4299e1 !important;
        color: white !important;
        padding: 6px 4px !important;
        font-size: 9px !important;
        border: 1px solid #2d3748 !important;
    }
    
    td {
        padding: 4px !important;
        border: 1px solid #e2e8f0 !important;
        font-size: 9px !important;
        color: black !important;
    }
    
    .total-row {
        background: #38a169 !important;
        color: white !important;
        font-weight: bold !important;
    }
    
    .total-row td {
        font-weight: bold !important;
        font-size: 10px !important;
        border: 1px solid #2f855a !important;
        color: white !important;
    }
    
    @page {
        margin: 0.5in;
        size: A4;
    }
}
