/* Handwriting font */
.handwriting {
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    line-height: 1.2;
}

/* Tab Navigation Styles */
.tab-btn {
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}

.tab-content {
    display: none;
}

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

/* Table styles */
table {
    width: 100%;
}

table th {
    font-weight: 600;
}

table td {
    padding: 12px 24px;
}

/* Form input styles */
input[type="date"],
input[type="number"],
input[type="text"],
select {
    transition: border-color 0.2s ease;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
}

/* Chart container */
#pieChart {
    max-width: 100%;
    max-height: 100%;
}

/* ==================== MOBILE RESPONSIVE STYLES ==================== */

/* ==================== TABLET/IPAD STYLES (768px - 1024px) ==================== */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Larger touch targets for iPad */
    .tab-btn {
        padding: 16px 20px !important;
        font-size: 1rem;
        min-height: 48px;
    }

    /* Better button sizing for touch */
    button {
        min-height: 44px;
        padding: 12px 20px;
    }

    /* Form inputs - larger for touch */
    input[type="date"],
    input[type="number"],
    input[type="text"],
    select {
        min-height: 48px;
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 12px 16px;
    }

    /* Dashboard cards - 2 columns on tablet portrait, 3 on landscape */
    .dashboard-cards {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Receipt layout - side by side on tablet landscape */
    .receipt-layout {
        flex-direction: row !important;
    }
    .receipt-form-section,
    .receipt-preview-section {
        width: 50% !important;
    }

    /* Receipt preview - slightly scaled for tablet */
    #receiptPreview {
        transform: scale(0.9);
        transform-origin: top center;
        margin-bottom: -50px;
    }

    /* Tables - show description column */
    table td, table th {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    /* Filter section - horizontal on tablet */
    .filter-section {
        flex-direction: row !important;
        flex-wrap: wrap;
    }
    .filter-section > div {
        flex: 1;
        min-width: 180px;
    }

    /* Improved spacing */
    .tab-content {
        padding: 24px !important;
    }
}

/* iPad Portrait specific */
@media (min-width: 768px) and (max-width: 834px) and (orientation: portrait) {
    .dashboard-cards {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .receipt-layout {
        flex-direction: column !important;
    }
    .receipt-form-section,
    .receipt-preview-section {
        width: 100% !important;
    }

    #receiptPreview {
        transform: scale(0.95);
        margin-bottom: -30px;
    }
}

/* iPad Landscape & larger tablets */
@media (min-width: 1024px) and (max-width: 1366px) {
    .tab-btn {
        padding: 16px 24px !important;
        min-height: 48px;
    }

    input[type="date"],
    input[type="number"],
    input[type="text"],
    select {
        min-height: 44px;
        font-size: 16px;
    }

    button {
        min-height: 44px;
    }
}

/* Mobile Navigation */
@media (max-width: 768px) {
    /* Nav tabs - horizontal scroll */
    .nav-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-tabs::-webkit-scrollbar {
        display: none;
    }
    .tab-btn {
        padding: 12px 16px !important;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    #logoutBtn {
        padding: 8px 12px !important;
        font-size: 0.75rem;
    }

    /* Dashboard cards */
    .dashboard-cards {
        grid-template-columns: 1fr !important;
    }

    /* Chart container */
    .chart-container {
        width: 100% !important;
        height: 300px !important;
    }

    /* Tables - horizontal scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table td, table th {
        padding: 8px 12px;
        font-size: 0.875rem;
    }

    /* Forms */
    .form-grid {
        grid-template-columns: 1fr !important;
    }

    /* Receipt tab - stack vertically */
    .receipt-layout {
        flex-direction: column !important;
        height: auto !important;
    }
    .receipt-form-section,
    .receipt-preview-section {
        width: 100% !important;
        max-height: none !important;
    }
    .receipt-preview-section {
        padding: 16px !important;
    }

    /* Receipt preview - scale down */
    #receiptPreview {
        transform: scale(0.85);
        transform-origin: top center;
        margin-bottom: -100px;
    }

    /* Filter section */
    .filter-section {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .filter-section > div,
    .filter-section > button {
        width: 100%;
    }

    /* Buttons full width on mobile */
    .mobile-full-btn {
        width: 100%;
    }
}

/* Small mobile screens */
@media (max-width: 480px) {
    #receiptPreview {
        transform: scale(0.7);
        margin-bottom: -180px;
    }

    .tab-btn {
        padding: 10px 12px !important;
        font-size: 0.8rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    /* Login page */
    .login-container {
        margin: 16px;
        padding: 24px !important;
    }
}
