/* Responsive Layout Fixes for All Devices
 * Improves layout consistency and compactness across different screen sizes
 */

/* General improvements for all screen sizes */
.container {
    padding-left: 15px;
    padding-right: 15px;
}

/* Make buttons more compact but usable */
.btn {
    transition: all 0.3s ease;
}

.btn:active {
    transform: scale(0.98);
}

/* Card improvements for better spacing */
.card {
    margin-bottom: 20px;
    height: auto;
}

/* Center align content on medium screens */
@media (min-width: 768px) and (max-width: 1199px) {
    /* Main page header */
    .page-header {
        text-align: center;
        padding: 20px 0;
    }
    
    /* Center the main action buttons */
    .action-buttons {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Ensure main content is centered */
    .main-content-container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    /* Make main card grid more compact */
    .card-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
        width: 100%;
        max-width: 900px;
        margin: 0 auto;
    }
    
    /* Improve card title spacing */
    .card-title {
        font-size: 1.1rem;
        line-height: 1.3;
        margin-bottom: 8px;
    }
    
    /* Compact card body padding */
    .card-body {
        padding: 15px;
    }
    
    /* Make card footer more compact */
    .card-footer {
        padding: 10px 15px;
    }
    
    /* Ensure cards in grids maintain consistent heights */
    .equal-height-cards .card {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .equal-height-cards .card-body {
        flex: 1;
    }
}

/* Smaller medium screens (iPad portrait) */
@media (min-width: 768px) and (max-width: 991px) {
    /* Slightly smaller type scale for iPad */
    h1 {
        font-size: 2rem !important;
    }
    
    h2 {
        font-size: 1.7rem !important;
    }
    
    h3 {
        font-size: 1.4rem !important;
    }
    
    p {
        font-size: 0.95rem !important;
    }
    
    /* Even more compact grid for smaller tablets */
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    
    /* Make quick action buttons slightly larger and easier to hit */
    .quick-action {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    /* Ensure footer buttons are usable */
    .footer-buttons {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    /* Section spacing more compact */
    .section {
        padding: 20px 0;
    }
    
    /* ENHANCED TABLET OPTIMIZATIONS */
    
    /* Adjust layout for tablets */
    .container, .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
        width: 95%;
        max-width: none;
    }
    
    /* Make headers more compact */
    .page-header {
        margin-bottom: 1rem;
    }
    
    /* Better use of screen real estate */
    .row {
        margin-left: -8px;
        margin-right: -8px;
    }
    
    /* Reduce column padding for more content space */
    .col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, 
    .col-7, .col-8, .col-9, .col-10, .col-11, .col-12,
    .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6,
    .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12,
    .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
    .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12,
    .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6,
    .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    /* More compact forms */
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    /* Smaller but still touchable buttons */
    .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.9rem;
    }
    
    /* Cards with less wasted space */
    .card {
        margin-bottom: 0.75rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .card-header, .card-footer {
        padding: 0.5rem 0.75rem;
    }
    
    /* Prevent fixed elements from taking too much space */
    .sticky-top, .fixed-bottom {
        padding: 0.5rem;
    }
    
    /* Make icons slightly smaller */
    .fa, .fas, .far, .fab {
        font-size: 90%;
    }
    
    /* Optimize spacing of common elements */
    .mb-3, .my-3 {
        margin-bottom: 0.75rem !important;
    }
    
    .mt-3, .my-3 {
        margin-top: 0.75rem !important;
    }
    
    .mb-4, .my-4 {
        margin-bottom: 1rem !important;
    }
    
    .mt-4, .my-4 {
        margin-top: 1rem !important;
    }
    
    .p-3 {
        padding: 0.75rem !important;
    }
    
    .p-4 {
        padding: 1rem !important;
    }
    
    /* Enhance yoga card display */
    .yoga-card {
        transform: scale(0.95);
        margin: -2px;
    }
    
    /* Reading cards adjustments */
    .reading-container {
        max-width: 95% !important;
        margin: 0 auto !important;
    }
    
    .reading-interpretation {
        margin-top: 20px !important;
        margin-bottom: 20px !important;
        padding: 1rem !important;
    }
    
    /* IMPROVED TABLET COLUMN LAYOUT */
    /* For two-column layouts on tablets in landscape mode */
    @media (orientation: landscape) {
        .row .col-lg-6 {
            flex: 0 0 50% !important;
            max-width: 50% !important;
        }
    }
    
    /* For single-column layouts on tablets in portrait mode */
    @media (orientation: portrait) {
        .row .col-lg-6 {
            flex: 0 0 100% !important;
            max-width: 100% !important;
        }
    }
    
    /* IMPROVED NAV & MENU LAYOUT FOR TABLETS */
    /* Make navigation more compact but still usable */
    .navbar-nav .nav-link {
        padding: 0.4rem 0.6rem !important;
    }
    
    .dropdown-menu {
        min-width: 12rem !important;
    }
    
    .dropdown-item {
        padding: 0.4rem 0.8rem !important;
    }
    
    /* Better-spaced side menu */
    .side-menu-item {
        padding: 0.8rem 1rem !important;
    }
    
    /* Enhance main content area to be wider */
    main.container {
        max-width: 96% !important;
    }
}

/* Fix for iPhone and small mobile devices */
@media (max-width: 767px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
        max-width: 100%;
    }
    
    /* Make typography more compact */
    h1 {
        font-size: 1.8rem !important;
    }
    
    h2 {
        font-size: 1.4rem !important;
    }
    
    h3 {
        font-size: 1.3rem !important;
    }
    
    h4 {
        font-size: 1.1rem !important;
    }
    
    /* Single column for cards */
    .card-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Navigation buttons should be full width */
    .btn-block-xs {
        display: block;
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Optimize mobile authentication forms */
    .mobile-optimized.auth-form {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
    
    .mobile-optimized.auth-form .card {
        margin-bottom: 0;
        border-radius: 10px;
    }
    
    .mobile-optimized.auth-form .card-body {
        padding: 0.75rem !important;
    }
    
    .mobile-optimized.auth-form .form-control,
    .mobile-optimized.auth-form .input-group-text {
        height: 38px;
    }
    
    .mobile-optimized.auth-form .btn {
        padding: 0.4rem 1rem;
    }
    
    .mobile-optimized.auth-form .form-text {
        margin-top: 0.1rem;
        font-size: 0.7rem;
    }
    
    /* Make alerts more compact on mobile */
    .alert {
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.5rem;
    }
}

/* Adjust modal dialogs to be more compact on medium screens */
@media (min-width: 768px) and (max-width: 1199px) {
    .modal-dialog {
        max-width: 90%;
        margin: 1.75rem auto;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-footer {
        padding: 10px 15px;
    }
}

/* Wide screen optimizations */
@media (min-width: 1200px) {
    /* Optimize card placement */
    .card-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 20px;
    }
    
    /* Enhance card visuals */
    .card {
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
    
    .card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    }
    
    /* Better padding for content areas */
    .page-section {
        padding: 2rem;
    }
}
