/*!
 * Mobile Responsive Enhancements
 * Optimized for mobile, tablet, and multiple screen sizes
 * Priority: Navigation, Typography, Touch Targets, Grid System
 */

/* =================================================================
   MODERN RESPONSIVE BREAKPOINTS
   ================================================================= */

/* Mobile First Approach */
/* xs: 0-575px (phones) */
/* sm: 576px-767px (large phones) */
/* md: 768px-991px (tablets) */
/* lg: 992px-1199px (desktops) */
/* xl: 1200px+ (large desktops) */

/* =================================================================
   NAVIGATION IMPROVEMENTS
   ================================================================= */

/* Mobile Navigation (0-767px) */
@media (max-width: 767px) {
    /* Header optimizations */
    .navbar-fixed-top {
        min-height: 60px;
    }
    
    .navbar-brand.white {
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .navbar-brand.white img {
        max-height: 35px !important;
        width: auto;
    }
    
    .navbar-toggle {
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        padding: 8px 10px;
        margin: 0;
        border: 2px solid #fff;
        border-radius: 4px;
        background: transparent;
    }
    
    .navbar-toggle .icon-bar {
        background-color: #fff;
        width: 22px;
        height: 2px;
        border-radius: 1px;
        transition: all 0.3s ease;
    }
    
    /* Mobile menu panel */
    #main-menu.white {
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
        padding-top: 70px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .white nav ul {
        padding: 20px 0;
    }
    
    .white nav ul li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin: 0;
    }
    
    .white nav ul li a {
        font-size: 18px;
        padding: 18px 25px;
        line-height: 1.4;
        display: block;
        color: #fff !important;
        text-decoration: none;
        transition: all 0.3s ease;
    }
    
    .white nav ul li a:hover,
    .white nav ul li a:focus {
        background: rgba(255, 255, 255, 0.1);
        padding-left: 35px;
    }
    
    /* Dropdown menus on mobile */
    .white nav ul ul {
        position: static;
        background: rgba(255, 255, 255, 0.05);
        box-shadow: none;
        display: none;
    }
    
    .white nav ul li:hover ul {
        display: block;
    }
    
    .white nav ul ul li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .white nav ul ul li a {
        padding-left: 45px;
        font-size: 16px;
    }
    
    /* Search menu mobile optimization */
    .search-menu-item .search-text {
        display: none !important;
    }
    
    .search-menu-item a {
        padding: 15px 20px !important;
        width: auto;
        text-align: center;
    }
    
    .search-menu-item i {
        font-size: 18px;
    }
}

/* Small Mobile (0-479px) */
@media (max-width: 479px) {
    .navbar-fixed-top {
        min-height: 55px;
    }
    
    .navbar-brand.white {
        left: 10px;
    }
    
    .navbar-brand.white img {
        max-height: 30px !important;
    }
    
    .navbar-toggle {
        right: 10px;
        padding: 6px 8px;
    }
    
    .navbar-toggle .icon-bar {
        width: 18px;
    }
    
    .white nav ul li a {
        font-size: 16px;
        padding: 15px 20px;
    }
    
    .white nav ul ul li a {
        padding-left: 35px;
        font-size: 14px;
    }
}

/* =================================================================
   TYPOGRAPHY SCALING
   ================================================================= */

/* Tablet Typography (768px-991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .big-heading {
        font-size: 32px !important;
        line-height: 1.3;
    }
    
    h1 { font-size: 32px; }
    h2 { font-size: 28px; }
    h3 { font-size: 24px; }
    h4 { font-size: 20px; }
    h5 { font-size: 18px; }
    h6 { font-size: 16px; }
    
    body {
        font-size: 15px;
        line-height: 1.6;
    }
}

/* Mobile Typography (0-767px) */
@media (max-width: 767px) {
    .big-heading {
        font-size: 28px !important;
        line-height: 1.3;
        margin-bottom: 20px;
    }
    
    h1 { font-size: 28px; line-height: 1.3; }
    h2 { font-size: 24px; line-height: 1.3; }
    h3 { font-size: 20px; line-height: 1.4; }
    h4 { font-size: 18px; line-height: 1.4; }
    h5 { font-size: 16px; line-height: 1.4; }
    h6 { font-size: 14px; line-height: 1.4; }
    
    body {
        font-size: 14px;
        line-height: 1.6;
    }
    
    p {
        margin-bottom: 16px;
    }
    
    p.intro,
    .intro {
        font-size: 16px;
        line-height: 1.5;
    }
}

/* Small Mobile Typography (0-479px) */
@media (max-width: 479px) {
    .big-heading {
        font-size: 24px !important;
        line-height: 1.2;
        margin-bottom: 15px;
    }
    
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }
    h4 { font-size: 16px; }
    h5 { font-size: 15px; }
    h6 { font-size: 14px; }
    
    body {
        font-size: 13px;
        line-height: 1.5;
        letter-spacing: 0.3px;
    }
    
    p.intro,
    .intro {
        font-size: 15px;
    }
}

/* =================================================================
   CONTAINER AND SPACING IMPROVEMENTS
   ================================================================= */

/* Tablet Spacing (768px-991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .m-5-hor {
        margin-left: 4% !important;
        margin-right: 4% !important;
    }
    
    .container-fluid {
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* Mobile Spacing (0-767px) */
@media (max-width: 767px) {
    .m-5-hor {
        margin-left: 3% !important;
        margin-right: 3% !important;
    }
    
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Section spacing */
    section {
        padding: 40px 0;
    }
    
    .space-single {
        height: 15px;
    }
    
    .space-double {
        height: 30px;
    }
    
    /* Breadcrumb improvements */
    .thm-breadcrumb {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        margin-top: 15px;
        padding: 0 15px;
    }
    
    .thm-breadcrumb li {
        margin: 3px 5px;
        font-size: 13px;
    }
    
    .thm-breadcrumb li:after {
        content: "›";
        margin-left: 8px;
        color: #999;
    }
    
    .thm-breadcrumb li:last-child:after {
        display: none;
    }
}

/* Small Mobile Spacing (0-479px) */
@media (max-width: 479px) {
    .m-5-hor {
        margin-left: 2% !important;
        margin-right: 2% !important;
    }
    
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    section {
        padding: 30px 0;
    }
    
    .space-single {
        height: 10px;
    }
    
    .space-double {
        height: 20px;
    }
    
    .thm-breadcrumb {
        flex-direction: column;
        margin-top: 10px;
    }
    
    .thm-breadcrumb li {
        margin: 2px 0;
        font-size: 12px;
    }
    
    .thm-breadcrumb li:after {
        display: none;
    }
}

/* =================================================================
   BUTTON AND FORM IMPROVEMENTS
   ================================================================= */

/* Touch-friendly interactive elements */
@media (max-width: 767px) {
    /* Buttons */
    button, 
    .btn, 
    a.btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 6px;
        transition: all 0.3s ease;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Form controls */
    .form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    textarea,
    select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 15px;
        border-radius: 6px;
        transition: all 0.3s ease;
    }
    
    textarea {
        min-height: 100px;
        resize: vertical;
    }
    
    /* Gallery filter buttons */
    #relics ul,
    #gallery ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin-bottom: 30px;
    }
    
    #relics ul li,
    #gallery ul li {
        background: #f8f9fa;
        border: 2px solid #e9ecef;
        border-radius: 25px;
        padding: 10px 20px;
        margin: 4px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.3s ease;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #relics ul li:hover,
    #gallery ul li:hover,
    #relics ul li.active,
    #gallery ul li.active {
        background: #007bff;
        color: #fff;
        border-color: #007bff;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    }
}

/* Small Mobile Button Adjustments */
@media (max-width: 479px) {
    button, 
    .btn, 
    a.btn {
        width: 100%;
        margin-bottom: 10px;
        font-size: 15px;
    }
    
    .btn-group .btn {
        width: auto;
        margin-bottom: 0;
    }
    
    #relics ul,
    #gallery ul {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }
    
    #relics ul li,
    #gallery ul li {
        width: 100%;
        text-align: center;
        margin: 2px 0;
        border-radius: 8px;
    }
}

/* =================================================================
   GRID SYSTEM ENHANCEMENTS
   ================================================================= */

/* Features Grid Mobile Optimization */
@media (max-width: 767px) {
    .features-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
        margin: 20px 0;
    }
    
    .feature-item .bg-img,
    .feature-item .bg-img-1,
    .feature-item .bg-img-2,
    .feature-item .bg-img-3,
    .feature-item .bg-img-4 {
        padding: 25px 20px;
        min-height: 220px;
        background-attachment: scroll; /* Better performance on mobile */
        background-size: cover;
        background-position: center;
        border-radius: 12px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        position: relative;
        overflow: hidden;
    }
    
    .feature-item .bg-img::before,
    .feature-item .bg-img-1::before,
    .feature-item .bg-img-2::before,
    .feature-item .bg-img-3::before,
    .feature-item .bg-img-4::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1;
    }
    
    .feature-item .bg-img > *,
    .feature-item .bg-img-1 > *,
    .feature-item .bg-img-2 > *,
    .feature-item .bg-img-3 > *,
    .feature-item .bg-img-4 > * {
        position: relative;
        z-index: 2;
        color: #fff;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .features-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Small Mobile Grid */
@media (max-width: 479px) {
    .features-grid {
        gap: 10px;
    }
    
    .feature-item .bg-img,
    .feature-item .bg-img-1,
    .feature-item .bg-img-2,
    .feature-item .bg-img-3,
    .feature-item .bg-img-4 {
        padding: 20px 15px;
        min-height: 180px;
        border-radius: 8px;
    }
}

/* =================================================================
   CONTENT AND IMAGE OPTIMIZATIONS
   ================================================================= */

/* Tablet Content */
@media (min-width: 768px) and (max-width: 991px) {
    .relic__single {
        margin-bottom: 25px;
    }
    
    .relic__content {
        padding: 20px;
    }
    
    .relic__content h3 {
        font-size: 20px;
        margin-bottom: 10px;
    }
}

/* Mobile Content */
@media (max-width: 767px) {
    .relic__single {
        margin-bottom: 20px;
    }
    
    .relic__content {
        padding: 15px;
    }
    
    .relic__content h3 {
        font-size: 18px;
        margin-bottom: 8px;
        line-height: 1.3;
    }
    
    .relic__content p {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 10px;
    }
    
    /* Background image optimization */
    .bg-img {
        background-attachment: scroll !important;
        background-size: cover;
        background-position: center;
    }
    
    /* Image responsive behavior */
    img {
        max-width: 100%;
        height: auto;
        border-radius: 6px;
    }
    
    /* Card components */
    .card,
    .panel {
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        margin-bottom: 20px;
        overflow: hidden;
    }
}

/* Small Mobile Content */
@media (max-width: 479px) {
    .relic__content {
        padding: 12px;
    }
    
    .relic__content h3 {
        font-size: 16px;
        margin-bottom: 6px;
    }
    
    .relic__content p {
        font-size: 13px;
    }
    
    img {
        border-radius: 4px;
    }
    
    .card,
    .panel {
        border-radius: 6px;
        margin-bottom: 15px;
    }
}

/* =================================================================
   MODAL AND POPUP IMPROVEMENTS
   ================================================================= */

/* Mobile Modal Optimization */
@media (max-width: 767px) {
    .modal-dialog {
        width: 95%;
        margin: 20px auto;
    }
    
    .modal-content {
        border-radius: 12px;
        border: none;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
    
    .modal-header {
        padding: 20px;
        border-bottom: 1px solid #e9ecef;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
        border-top: 1px solid #e9ecef;
    }
    
    /* Custom popup tour */
    .custom-popup-tour .custom-popup-tour-home {
        width: 90%;
        max-width: 400px;
        border-radius: 12px;
    }
    
    .custom-popup-tour .custom-popup-tour-home .custom-popup-tour-content > div {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }
    
    .custom-popup-tour .custom-popup-tour-home .custom-popup-tour-content > div a {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
        border-radius: 8px;
        font-size: 15px;
    }
}

/* Small Mobile Modal */
@media (max-width: 479px) {
    .modal-dialog {
        width: 98%;
        margin: 10px auto;
    }
    
    .modal-header,
    .modal-body {
        padding: 15px;
    }
    
    .modal-footer {
        padding: 12px 15px;
    }
    
    .custom-popup-tour .custom-popup-tour-home {
        width: 95%;
        max-width: none;
    }
    
    .custom-popup-tour .custom-popup-tour-home .custom-popup-tour-content h4 {
        font-size: 18px;
        line-height: 1.3;
    }
    
    .custom-popup-tour .custom-popup-tour-home .custom-popup-tour-content > div {
        padding: 15px;
    }
}

/* =================================================================
   PERFORMANCE AND ACCESSIBILITY IMPROVEMENTS
   ================================================================= */

/* Touch and hover optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .feature-item:hover,
    .relic__single:hover {
        transform: none !important;
    }
    
    /* Enhance focus states for accessibility */
    button:focus,
    .btn:focus,
    a:focus,
    input:focus,
    textarea:focus,
    select:focus {
        outline: 2px solid #007bff;
        outline-offset: 2px;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn,
    button {
        border: 2px solid;
    }
    
    .form-control {
        border: 2px solid #333;
    }
}

/* =================================================================
   UTILITY CLASSES FOR RESPONSIVE DESIGN
   ================================================================= */

/* Hide/Show utilities */
.mobile-only { display: none !important; }
.tablet-only { display: none !important; }
.desktop-only { display: block !important; }

@media (max-width: 767px) {
    .mobile-only { display: block !important; }
    .mobile-hide { display: none !important; }
    .desktop-only { display: none !important; }
}

@media (min-width: 768px) and (max-width: 991px) {
    .tablet-only { display: block !important; }
    .tablet-hide { display: none !important; }
}

@media (min-width: 992px) {
    .mobile-only { display: none !important; }
    .tablet-only { display: none !important; }
}

/* Text alignment utilities */
@media (max-width: 767px) {
    .text-center-mobile { text-align: center !important; }
    .text-left-mobile { text-align: left !important; }
    .text-right-mobile { text-align: right !important; }
}

/* Spacing utilities */
@media (max-width: 767px) {
    .mb-mobile { margin-bottom: 20px !important; }
    .mt-mobile { margin-top: 20px !important; }
    .p-mobile { padding: 15px !important; }
}

@media (max-width: 479px) {
    .mb-mobile { margin-bottom: 15px !important; }
    .mt-mobile { margin-top: 15px !important; }
    .p-mobile { padding: 10px !important; }
}