/* Global Responsive CSS Framework for Complete Website */

/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    /* Enhanced mobile optimization */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden;
    width: 100%;
    line-height: 1.6;
    /* Enhanced Android optimizations */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent overscroll bounce */
    overscroll-behavior: none;
    /* Enhanced Android performance */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    will-change: scroll-position;
    transform: translateZ(0);
}

/* Enhanced Navigation Responsive Framework */
.navbar, nav {
    width: 100%;
    position: relative;
    z-index: 100;
    min-height: 72px;
    display: flex;
    align-items: center;
    /* Mobile optimization */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
    touch-action: manipulation;
}

.navbar .container, nav .container, nav > div {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

/* Enhanced Button Framework */
.btn, .nav-btn, .btn-primary-custom, button, input[type="submit"], input[type="button"] {
    /* Mobile-first button design */
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    /* Mobile touch optimizations */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
    will-change: transform;
    transform: translateZ(0);
}

.btn:hover, .nav-btn:hover, .btn-primary-custom:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.btn:active, .nav-btn:active, .btn-primary-custom:active {
    transform: translateY(0) scale(0.98);
}

/* Enhanced Form Framework */
input, textarea, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    /* Mobile optimizations */
    -webkit-appearance: none;
    appearance: none;
    min-height: 44px;
    font-size: 16px; /* Prevent zoom on iOS */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #ffcc00;
    box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.1);
}

/* Enhanced Container Framework */
.container, .hero-container, .content-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

/* Enhanced Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -1rem;
}

.col, .col-sm-6, .col-md-4, .col-lg-3 {
    padding: 0 1rem;
    margin-bottom: 2rem;
}

/* Enhanced Image Framework */
img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    /* Mobile image optimizations */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    will-change: transform;
    transform: translateZ(0);
}

/* Enhanced Card Framework */
.card, .menu-item, .feature-item {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    /* Mobile optimizations */
    will-change: transform;
    transform: translateZ(0);
}

.card:hover, .menu-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* Enhanced Table Framework */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
}

/* Enhanced Alert Framework */
.alert, .custom-alert {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    /* Mobile optimizations */
    min-height: 44px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
}

/* Enhanced Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.justify-center { justify-content: center; }
.items-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

/* RESPONSIVE BREAKPOINTS */

/* Tablet Landscape and Desktop (1025px+) */
@media (min-width: 1025px) {
    .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
    .col-lg-4 { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
    .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
    
    .hide-desktop { display: none !important; }
    .show-mobile { display: none !important; }
}

/* Tablet Portrait (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container, .hero-container, .content-section {
        padding: 0 2rem;
    }
    
    .navbar .container, nav .container, nav > div {
        padding: 0 2rem;
    }
    
    .col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
    
    .btn, .nav-btn, .btn-primary-custom {
        min-height: 48px;
        padding: 0.875rem 1.75rem;
        font-size: 1rem;
    }
}

/* Mobile Landscape and Small Tablets (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .container, .hero-container, .content-section {
        padding: 0 1.5rem;
    }
    
    .navbar .container, nav .container, nav > div {
        padding: 0 1.5rem;
        flex-direction: column;
        gap: 1rem;
        min-height: auto;
    }
    
    .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
    .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
    
    .btn, .nav-btn, .btn-primary-custom {
        min-height: 48px;
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }
    
    h1 { font-size: 2.25rem; }
    h2 { font-size: 1.875rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    h5 { font-size: 1.125rem; }
    
    .hide-tablet { display: none !important; }
}

/* Mobile Portrait (≤480px) - Primary Mobile Experience */
@media (max-width: 480px) {
    .container, .hero-container, .content-section {
        padding: 0 1rem;
    }
    
    .navbar .container, nav .container, nav > div {
        padding: 0 1rem;
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        min-height: auto;
    }
    
    .navbar, nav {
        min-height: auto;
        padding: 1rem 0;
    }
    
    .navbar .navbar-brand, .navbar span, nav span {
        font-size: 1.2rem !important;
        text-align: center;
        margin-bottom: 0.5rem;
    }
    
    .nav-btns {
        gap: 0.5rem !important;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    
    .nav-btn, .btn {
        font-size: 0.9rem !important;
        padding: 0.625rem 1.25rem !important;
        min-height: 44px;
        min-width: 100px;
    }
    
    .col, .col-sm-6, .col-md-4, .col-lg-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1.5rem;
    }
    
    .btn, .nav-btn, .btn-primary-custom {
        width: 100%;
        max-width: 280px;
        min-height: 48px;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        margin: 0.25rem 0;
    }
    
    h1 { font-size: 2rem; line-height: 1.2; }
    h2 { font-size: 1.75rem; line-height: 1.3; }
    h3 { font-size: 1.5rem; line-height: 1.3; }
    h4 { font-size: 1.25rem; line-height: 1.4; }
    h5 { font-size: 1.125rem; line-height: 1.4; }
    h6 { font-size: 1rem; line-height: 1.4; }
    
    p, li { font-size: 0.95rem; line-height: 1.6; }
    
    .hero-container {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem 1rem;
        gap: 2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        width: 100%;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .card, .menu-item, .feature-item {
        padding: 1.5rem 1rem;
        margin-bottom: 1.5rem;
    }
    
    .alert, .custom-alert {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }
    
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
    .show-mobile-flex { display: flex !important; }
}

/* Android-specific optimizations */
@media screen and (max-width: 768px) and (-webkit-min-device-pixel-ratio: 1) {
    /* Enhanced Android performance */
    body, html {
        overscroll-behavior: none;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Android button optimizations */
    .btn, .nav-btn, .btn-primary-custom, button, input[type="button"], input[type="submit"] {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        touch-action: manipulation;
        will-change: transform;
        transform: translateZ(0);
        transition: transform 0.2s ease;
    }
    
    .btn:active, .nav-btn:active, .btn-primary-custom:active {
        transform: translateZ(0) scale(0.98);
    }
    
    /* Android safe area support */
    @supports (padding: max(0px)) {
        .navbar, nav {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
            padding-top: max(1rem, env(safe-area-inset-top));
        }
        
        .container, .hero-container, .content-section {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }
        
        footer {
            padding-bottom: max(1rem, env(safe-area-inset-bottom));
        }
    }
    
    /* Android image optimizations */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
        will-change: transform;
        transform: translateZ(0);
    }
    
    /* Android form optimizations */
    input, textarea, select {
        font-size: 16px; /* Prevent zoom on focus */
        -webkit-appearance: none;
        appearance: none;
        border-radius: 0.5rem;
        min-height: 44px;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        touch-action: manipulation;
    }
    
    /* Android scroll optimizations */
    .scroll-container {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        will-change: transform;
        transform: translateZ(0);
    }
}

/* Landscape orientation optimizations */
@media screen and (max-width: 768px) and (orientation: landscape) and (max-height: 500px) {
    .navbar, nav {
        min-height: 60px !important;
        padding: 0.5rem 0 !important;
    }
    
    .container, .hero-container, .content-section {
        padding: 1rem !important;
    }
    
    .hero-container {
        flex-direction: row;
        text-align: left;
        gap: 2rem;
    }
    
    h1, h2, h3 {
        font-size: smaller !important;
        margin-bottom: 0.5rem !important;
    }
    
    .btn, .nav-btn, .btn-primary-custom {
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
        min-height: 40px !important;
    }
}

/* High DPI display optimizations */
@media screen and (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
    img, svg {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
        image-rendering: auto;
    }
    
    .icon, .logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: smooth;
    }
}

/* Touch device optimizations */
@media (pointer: coarse) {
    /* Enhanced touch targets for tablets and touch devices */
    .btn, .nav-btn, .btn-primary-custom, button, input[type="button"], input[type="submit"] {
        min-height: 48px;
        min-width: 48px;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    input, textarea, select {
        min-height: 48px;
        padding: 0.875rem 1rem;
    }
    
    /* Better spacing for touch interactions */
    .nav-btns {
        gap: 1rem !important;
    }
    
    .card, .menu-item {
        padding: 2rem 1.5rem;
        margin-bottom: 2rem;
    }
}

/* Print optimizations */
@media print {
    .navbar, nav, .nav-btns, .btn, .nav-btn {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .container, .hero-container, .content-section {
        max-width: none;
        padding: 0;
    }
    
    .card, .menu-item {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}

/* Accessibility optimizations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (prefers-contrast: high) {
    .btn, .nav-btn, .btn-primary-custom {
        border: 2px solid currentColor;
    }
    
    .card, .menu-item {
        border: 2px solid #000;
    }
}

/* Focus visible for keyboard navigation */
.btn:focus-visible,
.nav-btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid #ffcc00;
    outline-offset: 2px;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffcc00;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Dark mode support (future-ready) */
@media (prefers-color-scheme: dark) {
    .card, .menu-item {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    input, textarea, select {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
}
