/* Mobile and Responsive Fixes for Invoice Creator
   These styles fix scrolling and layout issues on mobile devices */

/* Fix for scrolling on mobile devices */
@media (max-width: 992px) {
    .app-wrapper {
        height: auto;
        min-height: 100vh;
        overflow: visible;
        flex-direction: column;
    }

    .main-content {
        overflow: visible;
        height: auto;
        min-height: 100vh;
    }

    .content-wrapper {
        overflow: visible;
        flex-direction: column;
    }

    .form-container {
        width: 100%;
        margin-bottom: 20px;
    }

    .sidebar {
        height: auto;
        width: 100%;
        position: relative;
        transform: none;
        box-shadow: none;
        border-right: none;
        transition: none;
    }

    .sidebar.active {
        position: fixed;
        height: 100vh;
        width: 280px;
        z-index: 1000;
        box-shadow: var(--shadow-large);
    }

    /* Prevent nested scrollbars */
    .sidebar-nav {
        max-height: 70vh;
    }

    /* Fix for content scrolling */
    .form-section.active {
        overflow: visible;
    }

    /* Improve form group spacing */
    .form-group {
        margin-bottom: 15px;
    }
}

/* Specific fixes for very small screens */
@media (max-width: 576px) {
    /* Better touch targets */
    input, select, textarea, button {
        padding: 12px !important;
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }

    .section-content {
        padding: 15px 10px;
    }

    /* Make font sizes more readable */
    body {
        font-size: 16px;
    }

    .section-header h3,
    label,
    .form-group::before,
    .totals-row {
        font-size: 16px !important;
    }

    /* Fix for login overlay */
    .login-overlay {
        overflow-y: auto;
    }

    .login-container {
        margin: 20px auto;
    }

    /* Better visibility for scroll indicators */
    .item-row {
        position: relative;
        padding-bottom: 40px;
    }

    .item-row::after {
        content: "↓ Scroll for more fields ↓";
        position: absolute;
        bottom: 10px;
        left: 0;
        width: 100%;
        text-align: center;
        font-size: 12px;
        color: var(--primary-color);
        opacity: 0.7;
    }

    /* Fix for scrollable areas */
    .preview-container {
        overflow: visible;
        height: auto;
    }

    .invoice-preview {
        padding: 10px;
        margin-bottom: 20px;
    }

    /* Add visual separation between sections */
    .form-section {
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
    }

    /* Better navigation visibility */
    .sidebar-nav li {
        padding: 16px 20px;
    }

    /* Table improvements for mobile */
    .invoice-items th,
    .invoice-items td {
        padding: 8px;
        font-size: 14px;
    }

    /* Fix for preview container */
    .preview-container {
        position: relative;
        width: 100%;
    }
}

/* Fix for vertical overflow */
html, body {
    overflow-x: hidden;
    position: relative;
    height: auto;
}

/* Fix for iOS specific issues */
@supports (-webkit-overflow-scrolling: touch) {
    input, select, textarea {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }

    .app-wrapper {
        -webkit-overflow-scrolling: touch;
    }

    .content-wrapper {
        -webkit-overflow-scrolling: touch;
    }
}

/* Make sure we can scroll to the bottom of sections */
.form-section.active {
    padding-bottom: 30px;
}

/* Fix scroll issue with invoice preview */
@media (max-width: 1200px) {
    .invoice-preview {
        min-height: auto;
        overflow: visible;
    }
}

/* Additional viewport fix */
@viewport {
    width: device-width;
    zoom: 1.0;
}

/* Ensure mobile menu button is easy to tap */
.mobile-menu-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Make sure modals are scrollable */
.modal {
    overflow-y: auto;
}

.modal-content {
    margin: 20px auto;
    max-height: 90vh;
    overflow-y: auto;
}

/* Ensure forms are properly visible */
@media (max-width: 768px) {
    .form-container {
        max-height: none;
        overflow: visible;
    }
} 