/* ============================================================================
   MOBILE RESPONSIVE CSS - UTILITY STYLES
   ============================================================================
   This file provides mobile-first, responsive design utilities for the entire site.
   Include this file in all pages after other stylesheets.
   ============================================================================ */

/* Viewport defaults */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================================================
   RESPONSIVE TYPOGRAPHY
   ============================================================================ */

/* Base typography adjustments for mobile */
h1, .h1 {
    font-size: clamp(1.5rem, 5vw, 3.5rem);
    line-height: 1.2;
    margin-bottom: 1rem;
}

h2, .h2 {
    font-size: clamp(1.25rem, 4vw, 2.5rem);
    line-height: 1.3;
    margin-bottom: 0.875rem;
}

h3, .h3 {
    font-size: clamp(1.1rem, 3vw, 1.75rem);
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

h4, .h4 {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    margin-bottom: 0.75rem;
}

h5, .h5 {
    font-size: clamp(0.9rem, 2vw, 1.25rem);
    margin-bottom: 0.5rem;
}

h6, .h6 {
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    margin-bottom: 0.5rem;
}

p {
    font-size: clamp(0.9rem, 2vw, 1rem);
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* ============================================================================
   RESPONSIVE CONTAINERS & LAYOUT
   ============================================================================ */

.container {
    width: 100%;
    padding-left: 15px;
    padding-right: 15px;
    margin-left: auto;
    margin-right: auto;
}

/* Mobile First Approach */
@media (min-width: 576px) {        /* Small devices */
    .container {
        max-width: 540px;
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (min-width: 768px) {        /* Medium devices (tablets) */
    .container {
        max-width: 720px;
        padding-left: 25px;
        padding-right: 25px;
    }
}

@media (min-width: 992px) {        /* Large devices */
    .container {
        max-width: 960px;
        padding-left: 30px;
        padding-right: 30px;
    }
}

@media (min-width: 1200px) {       /* Extra large devices */
    .container {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {       /* 2xl devices */
    .container {
        max-width: 1320px;
    }
}

/* Responsive Grid */
.responsive-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 576px) {
    .responsive-grid.grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .responsive-grid.grid-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .responsive-grid.grid-3 {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 992px) {
    .responsive-grid.grid-3 {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    .responsive-grid.grid-4 {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 1200px) {
    .responsive-grid.grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Responsive Flexbox */
.responsive-flex {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 576px) {
    .responsive-flex.row-md {
        flex-direction: row;
        gap: 1.5rem;
    }
}

@media (min-width: 768px) {
    .responsive-flex.row-sm {
        flex-direction: row;
        gap: 1.5rem;
    }
}

@media (min-width: 992px) {
    .responsive-flex.row-lg {
        flex-direction: row;
        gap: 2rem;
    }
}

/* ============================================================================
   RESPONSIVE BUTTONS & FORMS
   ============================================================================ */

button, .btn, input[type="button"], input[type="submit"] {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

@media (min-width: 768px) {
    button, .btn, input[type="button"], input[type="submit"] {
        min-height: 40px;
        padding: 10px 20px;
    }
}

/* Full-width buttons on mobile */
.btn-block,
.btn-mobile-full {
    width: 100%;
}

@media (min-width: 768px) {
    .btn-mobile-full {
        width: auto;
    }
}

/* Form fields responsive */
input, textarea, select {
    min-height: 44px;
    font-size: 16px;
    padding: 12px;
    border-radius: 6px;
    width: 100%;
}

@media (min-width: 768px) {
    input, textarea, select {
        min-height: 40px;
        font-size: 14px;
        padding: 10px 12px;
    }
}

/* ============================================================================
   RESPONSIVE SPACING
   ============================================================================ */

/* Mobile-first padding/margin utilities */
.p-mobile { padding: 12px; }
.p-tablet { padding: 16px; }
.p-desktop { padding: 20px; }

.m-mobile { margin: 12px; }
.m-tablet { margin: 16px; }
.m-desktop { margin: 20px; }

@media (min-width: 768px) {
    .p-mobile { padding: 16px; }
    .m-mobile { margin: 16px; }
}

@media (min-width: 992px) {
    .p-mobile { padding: 20px; }
    .m-mobile { margin: 20px; }
}

/* ============================================================================
   RESPONSIVE NAVIGATION
   ============================================================================ */

/* Mobile navigation - ensure hamburger/toggle is visible */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 15px;
    flex-wrap: wrap;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
    min-height: 44px;
    min-width: 44px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    margin: 5px 0;
    transition: all 0.3s ease;
}

@media (max-width: 767px) {
    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 60px;
        right: 0;
        width: 100%;
        background: inherit;
        z-index: 1000;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        padding: 1rem 0;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu li {
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    .nav-menu a {
        display: block;
        padding: 12px 20px;
    }
}

@media (min-width: 768px) {
    .nav-menu {
        display: flex !important;
        flex-direction: row;
        position: static;
        background: transparent;
        max-height: none;
        overflow-y: visible;
        padding: 0;
    }

    .nav-menu li {
        border-bottom: none;
    }

    .nav-toggle {
        display: none;
    }
}

/* ============================================================================
   RESPONSIVE TABLES
   ============================================================================ */

table {
    width: 100%;
    font-size: 14px;
    table-layout: auto;
}

/* Mobile table wrapper for horizontal scrolling */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .table-responsive {
        overflow-x: visible;
        border: none;
        border-radius: 0;
    }
}

/* Responsive table styling */
table th, table td {
    padding: 12px 8px;
    text-align: left;
    white-space: nowrap;
}

@media (min-width: 768px) {
    table th, table td {
        padding: 12px 16px;
    }
}

/* Stack table on mobile */
@media (max-width: 767px) {
    .table-stack thead {
        display: none;
    }

    .table-stack,
    .table-stack tbody,
    .table-stack tr,
    .table-stack td {
        display: block;
        width: 100%;
    }

    .table-stack tr {
        margin-bottom: 1rem;
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 6px;
        overflow: hidden;
    }

    .table-stack td {
        padding: 12px;
        padding-left: 50%;
        position: relative;
    }

    .table-stack td:before {
        content: attr(data-label);
        position: absolute;
        left: 6px;
        font-weight: bold;
        width: 45%;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
    }
}

/* ============================================================================
   RESPONSIVE CARDS & PANELS
   ============================================================================ */

.card {
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 16px;
}

.card-body {
    padding: 16px;
}

.card-header {
    padding: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 768px) {
    .card {
        padding: 20px;
    }

    .card-body {
        padding: 20px;
    }

    .card-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

/* ============================================================================
   RESPONSIVE MODALS & OVERLAYS
   ============================================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

@media (min-width: 768px) {
    .modal-content {
        max-width: 600px;
    }
}

/* ============================================================================
   RESPONSIVE IMAGES & MEDIA
   ============================================================================ */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Responsive video embedding */
.video-responsive {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin-bottom: 1rem;
}

.video-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================================================
   RESPONSIVE VISIBILITY UTILITIES
   ============================================================================ */

.hide-mobile {
    display: none !important;
}

.show-mobile {
    display: block !important;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block !important;
    }

    .show-mobile {
        display: none !important;
    }

    .hide-tablet {
        display: none !important;
    }

    .show-tablet {
        display: block !important;
    }
}

@media (min-width: 992px) {
    .hide-desktop {
        display: none !important;
    }

    .show-desktop {
        display: block !important;
    }
}

/* ============================================================================
   RESPONSIVE TOUCH TARGETS
   ============================================================================ */

/* Ensure touch targets are at least 44px on mobile */
button, a, input[type="button"], input[type="submit"], label {
    min-height: 44px;
    min-width: 44px;
}

@media (min-width: 768px) {
    button, a, input[type="button"], input[type="submit"] {
        min-height: auto;
        min-width: auto;
    }
}

/* ============================================================================
   RESPONSIVE SIDEBAR LAYOUTS
   ============================================================================ */

.sidebar-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar {
    width: 100%;
}

.main-content {
    width: 100%;
}

@media (min-width: 992px) {
    .sidebar-layout {
        flex-direction: row;
        gap: 30px;
    }

    .sidebar {
        width: 280px;
        flex-shrink: 0;
    }

    .main-content {
        flex: 1;
        min-width: 0;
    }
}

/* ============================================================================
   RESPONSIVE FOOTER
   ============================================================================ */

footer {
    padding: 40px 20px 20px;
}

footer .footer-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 576px) {
    footer .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    footer {
        padding: 60px 20px 30px;
    }

    footer .footer-content {
        grid-template-columns: repeat(3, 1fr);
        gap: 40px;
    }
}

@media (min-width: 1200px) {
    footer .footer-content {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================================================
   RESPONSIVE UTILITY CLASSES
   ============================================================================ */

/* Padding utilities - responsive */
.pt-sm { padding-top: 12px; }
.pb-sm { padding-bottom: 12px; }
.px-sm { padding-left: 12px; padding-right: 12px; }
.py-sm { padding-top: 12px; padding-bottom: 12px; }

.pt-md { padding-top: 20px; }
.pb-md { padding-bottom: 20px; }
.px-md { padding-left: 20px; padding-right: 20px; }
.py-md { padding-top: 20px; padding-bottom: 20px; }

@media (min-width: 768px) {
    .pt-sm { padding-top: 20px; }
    .pb-sm { padding-bottom: 20px; }
    .px-sm { padding-left: 20px; padding-right: 20px; }
    .py-sm { padding-top: 20px; padding-bottom: 20px; }
}

/* Margin utilities - responsive */
.mt-sm { margin-top: 12px; }
.mb-sm { margin-bottom: 12px; }
.mx-sm { margin-left: 12px; margin-right: 12px; }
.my-sm { margin-top: 12px; margin-bottom: 12px; }

.mt-md { margin-top: 20px; }
.mb-md { margin-bottom: 20px; }
.mx-md { margin-left: 20px; margin-right: 20px; }
.my-md { margin-top: 20px; margin-bottom: 20px; }

@media (min-width: 768px) {
    .mt-sm { margin-top: 20px; }
    .mb-sm { margin-bottom: 20px; }
    .mx-sm { margin-left: 20px; margin-right: 20px; }
    .my-sm { margin-top: 20px; margin-bottom: 20px; }
}

/* Width utilities */
.w-100 { width: 100%; }
.h-100 { height: 100%; }
.mw-100 { max-width: 100%; }

/* Display utilities */
.d-block { display: block; }
.d-inline { display: inline; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

@media (max-width: 767px) {
    .text-center-mobile {
        text-align: center;
    }
}

@media (min-width: 768px) {
    .text-left-tablet { text-align: left; }
    .text-center-tablet { text-align: center; }
}

/* Gap utilities */
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 20px; }

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    body {
        background: white;
        font-size: 12pt;
    }

    .no-print {
        display: none;
    }

    a {
        text-decoration: underline;
    }

    img {
        max-width: 100%;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

/* Ensure focus states are visible */
button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    .card {
        background-color: #2a2a2a;
    }

    input, textarea, select {
        background-color: #333333;
        color: #e0e0e0;
        border-color: #444444;
    }
}
