/*
* Mobile-First Responsive Design for Mongolia eVisa Website
* Comprehensive mobile optimization and touch-friendly interactions
*/

/* ===== MOBILE-FIRST BASE STYLES ===== */

/* Base mobile styles (320px and up) */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== MOBILE NAVIGATION ===== */

/* Mobile-first navigation */
.navbar {
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1030;
    background: white !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-size: 1.25rem;
    padding: 0.5rem 0;
}

.navbar-toggler {
    border: none;
    padding: 0.5rem;
    font-size: 1.25rem;
    background: transparent;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(196, 39, 47, 0.25);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2833, 37, 41, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-collapse {
    background: white;
    margin-top: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 1rem;
}

.nav-link {
    padding: 0.75rem 1rem !important;
    font-weight: 500;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    display: block;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link:focus {
    background: rgba(196, 39, 47, 0.05);
    color: var(--primary) !important;
}

/* Mobile dropdown improvements */
.dropdown-menu {
    border: none;
    box-shadow: none;
    background: rgba(248, 249, 250, 0.8);
    margin: 0.5rem 0 0 1rem;
    border-radius: 6px;
    padding: 0.5rem 0;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 4px;
    margin: 0 0.5rem;
}

/* ===== MOBILE TYPOGRAPHY ===== */

h1 {
    font-size: clamp(1.75rem, 6vw, 3rem);
    line-height: 1.2;
    margin-bottom: 1rem;
}

h2 {
    font-size: clamp(1.5rem, 5vw, 2.25rem);
    line-height: 1.3;
    margin-bottom: 1rem;
}

h3 {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    line-height: 1.4;
    margin-bottom: 0.875rem;
}

h4 {
    font-size: clamp(1.125rem, 3vw, 1.5rem);
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.6;
}

.lead {
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* ===== MOBILE LAYOUT ===== */

/* Container adjustments */
.container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Section spacing */
.section {
    padding: 2.5rem 0;
}

.section-sm {
    padding: 2rem 0;
}

.section-lg {
    padding: 3rem 0;
}

/* Hero section mobile */
.hero {
    padding: 3rem 0;
    text-align: center;
}

.hero-content {
    padding: 1rem 0;
}

/* ===== MOBILE BUTTONS & FORMS ===== */

/* Touch-friendly buttons */
.btn {
    min-height: 48px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.btn-lg {
    min-height: 56px;
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-sm {
    min-height: 40px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Mobile button groups */
.btn-group-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.btn-group-mobile .btn {
    width: 100%;
}

/* Touch-friendly form controls */
.form-control {
    min-height: 48px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(196, 39, 47, 0.15);
    outline: none;
}

.form-select {
    min-height: 48px;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background-position: right 1rem center;
    background-size: 16px 12px;
}

/* ===== MOBILE CARDS & CONTENT ===== */

/* Mobile-optimized cards */
.card {
    border-radius: 12px;
    border: none;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-body {
    padding: 1.5rem;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Feature boxes mobile */
.feature-box {
    text-align: center;
    padding: 2rem 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.feature-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

/* ===== MOBILE TABLES ===== */

/* Responsive table wrapper */
.table-responsive {
    border-radius: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
}

.table {
    font-size: 0.875rem;
    margin-bottom: 0;
}

.table th,
.table td {
    padding: 0.75rem;
    white-space: nowrap;
}

/* Mobile table alternative - card layout */
.table-mobile {
    display: none;
}

/* ===== MOBILE SEARCH ===== */

/* Mobile search overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-overlay-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    position: relative;
    transform: translateY(-50px);
    transition: transform 0.3s ease;
}

.search-overlay.active .search-overlay-content {
    transform: translateY(0);
}

.search-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.search-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

/* ===== MOBILE FOOTER ===== */

.footer {
    padding: 2.5rem 0 1.5rem;
}

.footer-heading {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.footer-heading:first-child {
    margin-top: 0;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary);
}

/* ===== MOBILE UTILITIES ===== */

/* Mobile-only classes */
.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

/* Mobile spacing utilities */
.mb-mobile-2 {
    margin-bottom: 1rem;
}

.mb-mobile-3 {
    margin-bottom: 1.5rem;
}

.pb-mobile-2 {
    padding-bottom: 1rem;
}

.pb-mobile-3 {
    padding-bottom: 1.5rem;
}

/* Mobile text alignment */
.text-center-mobile {
    text-align: center;
}

/* ===== TOUCH INTERACTIONS ===== */

/* Touch-friendly hover states */
@media (hover: none) and (pointer: coarse) {
    .card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .feature-box:hover {
        transform: none;
    }
}

/* Touch feedback */
.btn:active,
.card:active,
.nav-link:active {
    transform: scale(0.98);
}

/* ===== SMALL MOBILE (320px - 480px) ===== */

@media (max-width: 480px) {
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .section {
        padding: 2rem 0;
    }
    
    .card-body {
        padding: 1.25rem;
    }
    
    .feature-box {
        padding: 1.5rem 1rem;
    }
    
    .btn-group-mobile {
        gap: 0.5rem;
    }
    
    .table-responsive {
        display: none;
    }
    
    .table-mobile {
        display: block;
    }
    
    .search-overlay-content {
        padding: 1.5rem;
        width: 95%;
    }
    
    .footer {
        padding: 2rem 0 1rem;
    }
}

/* ===== TABLET PORTRAIT (481px - 768px) ===== */

@media (min-width: 481px) and (max-width: 768px) {
    .container-fluid {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .hero {
        padding: 3.5rem 0;
    }
    
    .section {
        padding: 3rem 0;
    }
    
    .btn-group-mobile {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .btn-group-mobile .btn {
        flex: 1;
        min-width: 200px;
    }
    
    .feature-box {
        padding: 2rem;
    }
    
    .card-body {
        padding: 1.75rem;
    }
}

/* ===== TABLET LANDSCAPE (769px - 1024px) ===== */

@media (min-width: 769px) and (max-width: 1024px) {
    .mobile-only {
        display: none;
    }
    
    .desktop-only {
        display: block;
    }
    
    .navbar-collapse {
        background: transparent;
        box-shadow: none;
        padding: 0;
        margin-top: 0;
    }
    
    .nav-link {
        padding: 0.5rem 1rem !important;
        margin-bottom: 0;
        display: inline-block;
    }
    
    .dropdown-menu {
        background: white;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        margin: 0.5rem 0 0 0;
        padding: 0.5rem 0;
    }
    
    .dropdown-item {
        margin: 0;
        border-radius: 0;
    }
    
    .btn-group-mobile {
        flex-direction: row;
        gap: 1rem;
    }
    
    .btn-group-mobile .btn {
        width: auto;
        flex: none;
    }
    
    .hero {
        padding: 4rem 0;
        text-align: left;
    }
    
    .section {
        padding: 4rem 0;
    }
}

/* ===== DESKTOP (1025px and up) ===== */

@media (min-width: 1025px) {
    .mobile-only {
        display: none;
    }
    
    .desktop-only {
        display: block;
    }
    
    .container-fluid {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    .hero {
        padding: 5rem 0;
    }
    
    .section {
        padding: 5rem 0;
    }
    
    .section-lg {
        padding: 6rem 0;
    }
    
    .btn-group-mobile {
        flex-direction: row;
        gap: 1rem;
        width: auto;
    }
    
    .btn-group-mobile .btn {
        width: auto;
    }
    
    .feature-box {
        padding: 2.5rem;
    }
    
    .card-body {
        padding: 2rem;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

/* High contrast mode */
@media (prefers-contrast: high) {
    .btn {
        border-width: 3px;
    }
    
    .card {
        border: 2px solid var(--border);
    }
    
    .form-control {
        border-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .search-overlay,
    .search-overlay-content {
        transition: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text: #e9ecef;
        --text-light: #adb5bd;
        --border: #495057;
        --light: #343a40;
    }
    
    body {
        background-color: #212529;
        color: var(--text);
    }
    
    .navbar,
    .card,
    .search-overlay-content {
        background-color: #343a40;
        color: var(--text);
    }
    
    .form-control {
        background-color: #495057;
        border-color: #6c757d;
        color: var(--text);
    }
    
    .dropdown-menu {
        background-color: #343a40;
    }
}

