/* ========================================
   RESPONSIVE UTILITIES & COMPONENTS
   Mobile-First Design System
   ======================================== */

/* ========================================
   BREAKPOINT REFERENCE
   ======================================== */
/* xs: 0px (default)
   sm: 640px
   md: 768px
   lg: 1024px
   xl: 1280px
   2xl: 1536px */

/* ========================================
   RESPONSIVE DISPLAY UTILITIES
   ======================================== */

/* Hide on mobile, show on tablet+ */
.hidden-xs {
    display: none;
}

@media (min-width: 640px) {
    .hidden-xs {
        display: block;
    }
    
    .visible-xs {
        display: none;
    }
}

/* Responsive visibility utilities */
.show-mobile {
    display: block;
}

.hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .show-mobile {
        display: none;
    }
    
    .hide-mobile {
        display: block;
    }
}

/* ========================================
   RESPONSIVE TYPOGRAPHY
   ======================================== */

.heading-responsive-1 {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 700;
}

.heading-responsive-2 {
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 600;
}

.heading-responsive-3 {
    font-size: 1.125rem;
    line-height: 1.75rem;
    font-weight: 600;
}

.body-responsive-lg {
    font-size: 0.9375rem;
    line-height: 1.5rem;
}

.body-responsive-md {
    font-size: 0.875rem;
    line-height: 1.5rem;
}

.body-responsive-sm {
    font-size: 0.8125rem;
    line-height: 1.25rem;
}

@media (min-width: 640px) {
    .heading-responsive-1 {
        font-size: 1.875rem;
        line-height: 2.25rem;
    }

    .heading-responsive-2 {
        font-size: 1.5rem;
        line-height: 2rem;
    }

    .heading-responsive-3 {
        font-size: 1.25rem;
        line-height: 1.75rem;
    }

    .body-responsive-lg {
        font-size: 1rem;
    }

    .body-responsive-md {
        font-size: 0.9375rem;
    }

    .body-responsive-sm {
        font-size: 0.875rem;
    }
}

@media (min-width: 1024px) {
    .heading-responsive-1 {
        font-size: 2.25rem;
        line-height: 2.5rem;
    }

    .heading-responsive-2 {
        font-size: 1.875rem;
        line-height: 2.25rem;
    }

    .heading-responsive-3 {
        font-size: 1.5rem;
        line-height: 2rem;
    }
}

/* ========================================
   RESPONSIVE SPACING UTILITIES
   ======================================== */

/* Responsive margin utilities */
.m-auto-mobile {
    margin: 0.5rem;
}

.mx-auto-mobile {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
}

.my-auto-mobile {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

@media (min-width: 640px) {
    .m-auto-mobile {
        margin: 1rem;
    }

    .mx-auto-mobile {
        margin-left: 1rem;
        margin-right: 1rem;
    }

    .my-auto-mobile {
        margin-top: 1rem;
        margin-bottom: 1rem;
    }
}

/* Responsive padding utilities */
.p-auto-mobile {
    padding: 0.5rem;
}

.px-auto-mobile {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.py-auto-mobile {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

@media (min-width: 640px) {
    .p-auto-mobile {
        padding: 1rem;
    }

    .px-auto-mobile {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .py-auto-mobile {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}

@media (min-width: 1024px) {
    .p-auto-mobile {
        padding: 1.5rem;
    }

    .px-auto-mobile {
        padding-left: 2rem;
        padding-right: 2rem;
    }

    .py-auto-mobile {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
}

/* ========================================
   RESPONSIVE GAP UTILITIES
   ======================================== */

.gap-responsive-sm {
    gap: 0.5rem;
}

.gap-responsive-md {
    gap: 1rem;
}

.gap-responsive-lg {
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .gap-responsive-sm {
        gap: 0.75rem;
    }

    .gap-responsive-md {
        gap: 1.5rem;
    }

    .gap-responsive-lg {
        gap: 2rem;
    }
}

@media (min-width: 1024px) {
    .gap-responsive-sm {
        gap: 1rem;
    }

    .gap-responsive-md {
        gap: 2rem;
    }

    .gap-responsive-lg {
        gap: 2.5rem;
    }
}

/* ========================================
   RESPONSIVE GRID LAYOUTS
   ======================================== */

/* Two-column layout: full width on mobile, 2-col on tablet+ */
.grid-2-responsive {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .grid-2-responsive {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .grid-2-responsive {
        gap: 2rem;
    }
}

/* Three-column layout: full width on mobile, 2-col on tablet, 3-col on desktop */
.grid-3-responsive {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .grid-3-responsive {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .grid-3-responsive {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

/* Four-column layout: flexible */
.grid-4-responsive {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .grid-4-responsive {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .grid-4-responsive {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 1280px) {
    .grid-4-responsive {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

/* ========================================
   RESPONSIVE FLEX LAYOUTS
   ======================================== */

/* Flex direction responsive: column on mobile, row on tablet+ */
.flex-responsive-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .flex-responsive-col {
        flex-direction: row;
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .flex-responsive-col {
        gap: 2rem;
    }
}

/* Flex wrap responsive */
.flex-responsive-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .flex-responsive-wrap {
        gap: 1rem;
    }
}

@media (min-width: 1024px) {
    .flex-responsive-wrap {
        gap: 1.5rem;
    }
}

/* ========================================
   RESPONSIVE CARD COMPONENT
   ======================================== */

.card-responsive {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    transition: all 0.3s ease;
}

@media (min-width: 640px) {
    .card-responsive {
        padding: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .card-responsive {
        padding: 2rem;
    }
}

.card-responsive:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

/* ========================================
   RESPONSIVE BUTTON SIZING
   ======================================== */

.btn-responsive-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    border-radius: 0.375rem;
}

@media (min-width: 640px) {
    .btn-responsive-sm {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        line-height: 1.5rem;
    }
}

.btn-responsive-md {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    line-height: 1.5rem;
    border-radius: 0.5rem;
}

@media (min-width: 640px) {
    .btn-responsive-md {
        padding: 1rem 2rem;
        font-size: 1.0625rem;
        line-height: 1.625rem;
    }
}

.btn-responsive-lg {
    padding: 1rem 2rem;
    font-size: 1.0625rem;
    line-height: 1.625rem;
    border-radius: 0.5rem;
}

@media (min-width: 640px) {
    .btn-responsive-lg {
        padding: 1.25rem 2.5rem;
        font-size: 1.125rem;
        line-height: 1.75rem;
    }
}

/* ========================================
   RESPONSIVE WIDTH UTILITIES
   ======================================== */

.w-responsive-full {
    width: 100%;
}

.w-responsive-auto {
    width: auto;
}

.max-w-responsive-sm {
    max-width: 100%;
}

@media (min-width: 640px) {
    .max-w-responsive-sm {
        max-width: 600px;
    }
}

@media (min-width: 768px) {
    .max-w-responsive-sm {
        max-width: 700px;
    }
}

.max-w-responsive-md {
    max-width: 100%;
}

@media (min-width: 768px) {
    .max-w-responsive-md {
        max-width: 900px;
    }
}

@media (min-width: 1024px) {
    .max-w-responsive-md {
        max-width: 1000px;
    }
}

/* ========================================
   RESPONSIVE HEIGHT UTILITIES
   ======================================== */

.h-responsive-auto {
    height: auto;
}

.min-h-responsive {
    min-height: auto;
}

@media (min-width: 768px) {
    .min-h-responsive {
        min-height: 300px;
    }
}

/* ========================================
   RESPONSIVE TEXT ALIGNMENT
   ======================================== */

.text-center-mobile {
    text-align: center;
}

@media (min-width: 768px) {
    .text-center-mobile {
        text-align: left;
    }
}

.text-right-desktop {
    text-align: left;
}

@media (min-width: 1024px) {
    .text-right-desktop {
        text-align: right;
    }
}

/* ========================================
   RESPONSIVE TABLE IMPROVEMENTS
   ======================================== */

.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.table-responsive-wrapper table {
    font-size: 0.8125rem;
    width: 100%;
    border-collapse: collapse;
}

.table-responsive-wrapper th,
.table-responsive-wrapper td {
    padding: 0.5rem 0.75rem;
    text-align: left;
}

@media (min-width: 640px) {
    .table-responsive-wrapper table {
        font-size: 0.875rem;
    }

    .table-responsive-wrapper th,
    .table-responsive-wrapper td {
        padding: 0.75rem 1rem;
    }
}

@media (min-width: 1024px) {
    .table-responsive-wrapper table {
        font-size: 1rem;
    }

    .table-responsive-wrapper th,
    .table-responsive-wrapper td {
        padding: 1rem 1.5rem;
    }
}

/* ========================================
   RESPONSIVE IMAGE UTILITIES
   ======================================== */

.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 0.375rem;
}

.img-responsive-lg {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* ========================================
   RESPONSIVE CONTAINER QUERIES (Fallback)
   ======================================== */

.container-mobile {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

@media (min-width: 640px) {
    .container-mobile {
        max-width: 640px;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (min-width: 768px) {
    .container-mobile {
        max-width: 768px;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container-mobile {
        max-width: 1024px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (min-width: 1280px) {
    .container-mobile {
        max-width: 1200px;
        padding-left: 2.5rem;
        padding-right: 2.5rem;
    }
}

/* ========================================
   ACCESSIBILITY & TOUCH TARGETS
   ======================================== */

/* Ensure minimum touch target size (44x44px) */
button, a[role="button"], 
input[type="button"], input[type="submit"], 
input[type="reset"], a.btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Improved focus states for accessibility */
button:focus-visible, 
a:focus-visible,
input:focus-visible {
    outline: 2px solid #059669;
    outline-offset: 2px;
}

/* ========================================
   RESPONSIVE PRINT STYLES
   ======================================== */

@media print {
    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    .no-print {
        display: none !important;
    }

    .page-break {
        page-break-after: always;
    }
}

/* ========================================
   RESPONSIVE UTILITIES END
   ======================================== */
