/* Mobile Responsive Styles */

/* Tablet Styles */
@media screen and (max-width: 991.98px) {
    /* Navigation */
    .navbar-nav {
        padding-top: 1rem;
    }
    
    .nav-link {
        padding: 0.5rem 0;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .navbar-toggler {
        border-color: #6ba535;
    }
    
    .navbar-toggler:focus {
        box-shadow: none;
    }

    /* Header */
    .header {
        position: sticky;
        top: 8%;
    }

    /* Grid */
    .col-lg-2 {
        width: 33.33%;
    }
}

/* Mobile Styles */
@media screen and (max-width: 768px) {
    /* General Layout */
    .container {
        padding: 0 15px;
    }
    .top-bar{
        width: 100%;
    }
    .top-bar>.container>div{
        flex-direction: column;
    }
    .top-bar>.container>div>.text-controls button{
        width: unset !important;
    }
    .dashboard-content {
        width: 100%;
        margin: 0;
        padding: 10px;
    }

    /* Navigation */
    .navbar-nav {
        padding: 15px 0;
        background: white;
        text-align: center;
    }
    .fixed-top{
        top: 8% !important;
    }

    .navbar-nav .nav-link {
        padding: 10px 0;
    }

    /* Dashboard Layout */
    .dashboard-content .container-fluid > .row {
        flex-direction: column;
    }

    .col-md-3 {
        width: 100%;
        margin-bottom: 20px;
    }

    .col-md-9 {
        width: 100%;
    }

    /* Sidebar */
    .sidebar-profile {
        margin: 0 -15px;
        border-radius: 0;
    }

    .sidebar-menu {
        margin: 0 -15px;
    }

    /* Cards and Tables */
    .dashboard-card {
        width: 100%;
        margin-bottom: 15px;
    }

    .table-responsive {
        margin: 0 -15px;
        width: calc(100% + 30px);
    }

    .table td, .table th {
        white-space: nowrap;
        min-width: 100px;
    }

    /* Forms */
    .form-group {
        margin-bottom: 15px;
    }

    .form-control {
        font-size: 16px; /* Better touch target on mobile */
    }

    /* Buttons */
    .btn {
        margin-bottom: 10px;
    }

    .btn-group {
        display: flex;
        flex-direction: column;
    }    /* Modal */
    .modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1150;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-dialog {
        position: relative;
        width: auto;
        margin: 0.5rem;
        pointer-events: none;
    }

    .modal-dialog-centered {
        display: flex;
        align-items: center;
        min-height: calc(100% - 1rem);
    }

    .payment-modal {
        -webkit-transform: translate3d(0,0,0);
        transform: translate3d(0,0,0);
    }

    .payment-modal .modal-dialog {
        margin: 1rem auto;
        max-width: 320px;
    }

    .payment-modal .modal-content {
        background-color: #fff;
        border: 0;
        border-radius: 12px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.5);
        pointer-events: auto;
    }

    .payment-modal .modal-header {
        padding: 1rem;
        border-bottom: 1px solid #dee2e6;
    }

    .payment-modal .qr-image-wrapper {
        display: flex;
        justify-content: center;
        align-items: center;
        background: #f8f9fa;
        padding: 1rem;
        border-radius: 8px;
    }

    .payment-modal .form-control {
        font-size: 16px;
        padding: 8px;
    }

    .payment-modal .btn {
        min-height: 44px;
    }

    /* Tour Registration Section */
    .tour-registration-section .card {
        border-radius: 0;
        margin: 0 -15px;
    }

    /* Vehicle Table */
    #vehicleTable {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Calendar View */
    #availabilityGrid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .date-card {
        margin: 5px !important;
    }

    /* Profile Section */
    .profile-info {
        text-align: center;
        padding: 15px !important;
    }

    /* Footer */
    .footer .container {
        padding: 20px 15px;
    }

    /* Welcome Page */
    .hero-section {
        margin-top: 56px;
    }

    .explore-section .row {
        margin: 0 -5px;
    }

    .explore-card {
        margin: 5px 0;
    }

    .category-icons .col {
        flex: 0 0 50%;
        max-width: 50%;
        margin-bottom: 15px;
    }

    .social-card {
        margin: 5px 0;
    }

    /* Blog Section */
    .blog-card {
        margin: 10px 0;
    }

    /* Articles */
    .article-content {
        padding: 15px !important;
    }

    /* Modal styles */
    .modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1150;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-dialog {
        position: relative;
        width: auto;
        margin: 0.5rem;
        pointer-events: none;
        transform: translate(0, 0) !important;
    }

    .payment-modal .modal-dialog {
        margin: 1rem auto;
        max-width: 320px;
    }

    .payment-modal .modal-content {
        background-color: #fff;
        border: 0;
        border-radius: 12px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.5);
        pointer-events: auto;
    }

    .payment-modal .modal-header {
        padding: 1rem;
        border-bottom: 1px solid #dee2e6;
    }

    .payment-modal .qr-image-wrapper {
        display: flex;
        justify-content: center;
        align-items: center;
        background: #f8f9fa;
        padding: 1rem;
        border-radius: 8px;
    }

    .payment-modal .modal-dialog-centered {
        display: flex;
        align-items: center;
        min-height: calc(100% - 1rem);
    }

    /* Modal iOS Fixes */
    @media screen and (max-width: 768px) {
        /* Modal */
        .modal {
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            bottom: 0 !important;
            right: 0 !important;
            z-index: 1150 !important;
            -webkit-overflow-scrolling: touch;
        }

        .payment-modal .modal-dialog {
            margin: 10px auto !important;
            max-width: 320px !important;
            width: calc(100% - 20px) !important;
        }

        .payment-modal .modal-content {
            border: none;
            border-radius: 12px;
            overflow: hidden;
        }

        .payment-modal .modal-body {
            padding: 1rem;
        }

        .payment-modal .form-control {
            font-size: 16px;
        }
    }
}

/* Small phone styles */
@media screen and (max-width: 480px) {
    /* Navigation */
    .navbar-brand img {
        height: 35px;
    }

    .navbar-toggler {
        padding: 4px 8px;
        font-size: 1rem;
    }

    /* Layout */
    .container {
        padding: 0 10px;
    }

    /* Grid */
    .col-lg-2, .col-md-3, .col-6 {
        width: 100%;
        margin-bottom: 15px;
    }

    .navbar-brand img{
        height: 50px;
    }
    /* Dashboard */
    .dashboard-header {
        height: 200px;
        padding: 20px;
        margin-top: 0px;
        display: flex;
        align-items: flex-end;
    }

    .dashboard-header h1 {
        font-size: 24px;
        margin: 0px;
        text-align: center;
    }

    /* Components */
    .dashboard-card {
        height: auto;
        padding: 10px;
    }

    .dashboard-card .icon-circle {
        width: 45px;
        height: 45px;
    }

    .dashboard-card .icon-circle i {
        font-size: 18px;
    }

    /* Content */
    .card-content h4 {
        font-size: 15px;
    }

    .card-content p {
        font-size: 12px;
        height: 40px;
    }

    .category-icons .col {
        flex: 0 0 100%;
        max-width: 100%;
    }

    #availabilityGrid {
        grid-template-columns: repeat(1, 1fr) !important;
    }

    .dashboard-card {
        height: auto;
        padding: 15px;
    }
    .dashboard-card .card-icon{
        padding: 10px;
        margin-bottom: 10px;
    }
    .dashboard-card .icon-circle {
        width: 50px;
        height: 50px;
    }

    .dashboard-card .icon-circle i {
        font-size: 20px;
    }

    .card-content h4 {
        font-size: 16px;
    }

    .card-content p {
        font-size: 14px;
    }
    .input-group{
        height: 40px;
    }
    .input-group input{
        height: 100%;
        padding: 0 10px;
        font-size: 14px;
    }
    .auth-section #registrationForm>div{
        min-width: 90%;
        max-width: 90%;
    }
    .input-group .country-select{
        height: 100%;
    }
    .input-group button{
        height: 100%;
        margin: 0;
    }
}

/* Extra small phone styles */
@media screen and (max-width: 360px) {
    /* Layout */
    .container {
        padding: 0 8px;
    }

    /* Text */
    h1, .h1 { font-size: 24px; }
    h2, .h2 { font-size: 20px; }
    h3, .h3 { font-size: 18px; }
    
    /* Forms */
    input, select, textarea {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }

    /* Buttons */
    .btn {
        padding: 8px 16px;
        font-size: 14px;
        min-height: 44px; /* Better touch targets */
    }

    /* Navigation */
    .nav-link {
        padding: 12px 8px; /* Larger touch targets */
    }

    /* Cards */
    .card {
        margin-bottom: 15px;
    }

    .card-body {
        padding: 15px;
    }

    /* Tables */
    .table {
        font-size: 13px;
    }
}

/* Modal */
    .modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1150;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-dialog {
        position: relative;
        width: auto;
        margin: 0.5rem;
        pointer-events: none;
        transform: translate(0, 0) !important;
    }

    .payment-modal .modal-dialog {
        margin: 1rem auto;
        max-width: 320px;
    }

    .payment-modal .modal-content {
        background-color: #fff;
        border: 0;
        border-radius: 12px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.5);
        pointer-events: auto;
    }

    .payment-modal .modal-header {
        padding: 1rem;
        border-bottom: 1px solid #dee2e6;
    }

    .payment-modal .qr-image-wrapper {
        display: flex;
        justify-content: center;
        align-items: center;
        background: #f8f9fa;
        padding: 1rem;
        border-radius: 8px;
    }

    .payment-modal .modal-dialog-centered {
        display: flex;
        align-items: center;
        min-height: calc(100% - 1rem);
    }

    /* iOS-specific fixes */
    @supports (-webkit-touch-callout: none) {
        .modal-open {
            position: fixed;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }

        .modal-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
            -webkit-transform: translate3d(0,0,0);
            transform: translate3d(0,0,0);
        }

        .payment-modal input[type="file"] {
            font-size: 16px !important;
            padding: 8px;
        }

        .payment-modal .btn {
            min-height: 44px;
        }

        .payment-modal .qr-image-wrapper {
            background: #f8f9fa;
            padding: 1rem;
            border-radius: 8px;
            margin: 1rem 0;
        }
    }

    /* Touch device improvements */
    @media (hover: none) {
        .payment-modal .btn {
            min-height: 44px;
            padding: 0.5rem 1rem;
        }

        .payment-modal input[type="file"] {
            padding: 8px;
            line-height: 1.2;
        }
    }


/* Accessibility Improvements */
@media screen and (prefers-reduced-motion: reduce) {
    /* Reduce animations */
    * {
        transition: none !important;
        animation: none !important;
    }
}

@media screen and (prefers-contrast: more) {
    /* Increase contrast */
    .btn, .nav-link, .form-control {
        border-width: 2px;
    }

    .card {
        box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
    }

    .text-muted {
        color: #595959 !important;
    }
}

/* Print styles */
@media print {
    /* Hide non-essential elements */
    .sidebar, .navbar, .footer, .social-icons {
        display: none !important;
    }

    /* Ensure text is readable */
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    /* Make links useful */
    a::after {
        content: " (" attr(href) ")";
        font-size: 0.9em;
    }

    /* Break tables appropriately */
    tr, img {
        page-break-inside: avoid;
    }

    /* Remove shadows and backgrounds */
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}

/* iOS Modal Fixes */
.payment-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1150;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
}

.payment-modal .modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    max-width: 320px;
    pointer-events: none;
}

.payment-modal .modal-content {
    position: relative;
    background-color: #fff;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    pointer-events: auto;
}

/* iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
    .modal-open {
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    .modal-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0,0,0,0.5);
        -webkit-transform: translate3d(0,0,0);
        transform: translate3d(0,0,0);
    }

    .payment-modal input[type="file"] {
        font-size: 16px !important;
        padding: 8px;
    }

    .payment-modal .btn {
        min-height: 44px;
    }

    .payment-modal .qr-image-wrapper {
        background: #f8f9fa;
        padding: 1rem;
        border-radius: 8px;
        margin: 1rem 0;
    }
}

/* Touch device improvements */
@media (hover: none) {
    .payment-modal .btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }

    .payment-modal input[type="file"] {
        padding: 8px;
        line-height: 1.2;
    }
}
