/* ============================================
   Jetfolio - Responsive Framework
   Mobile-First Design with Touch-Friendly Interactions
   ============================================ */

/* ============================================
   1. BREAKPOINT SYSTEM
   ============================================ */

/*
  Mobile First Approach:
  - Base styles: Mobile (320px+)
  - sm: Large phones (481px+)
  - md: Tablets portrait (768px+)
  - lg: Tablets landscape (1025px+)
  - xl: Desktop (1201px+)
  - 2xl: Large desktop (1441px+)
*/

:root {
    /* Responsive Breakpoints */
    --breakpoint-sm: 481px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1025px;
    --breakpoint-xl: 1201px;
    --breakpoint-2xl: 1441px;

    /* Touch Target Sizes (Apple/Google Guidelines) */
    --touch-target-min: 44px;
    --touch-target-comfortable: 48px;
    --touch-target-large: 56px;

    /* Responsive Spacing Scale */
    --spacing-mobile: 1rem;
    --spacing-tablet: 1.5rem;
    --spacing-desktop: 2rem;

    /* Fluid Typography Scale */
    --font-size-xs: clamp(0.75rem, 2vw, 0.875rem);
    --font-size-sm: clamp(0.875rem, 2.5vw, 1rem);
    --font-size-base: clamp(1rem, 3vw, 1.125rem);
    --font-size-lg: clamp(1.125rem, 3.5vw, 1.25rem);
    --font-size-xl: clamp(1.25rem, 4vw, 1.5rem);
    --font-size-2xl: clamp(1.5rem, 5vw, 2rem);
    --font-size-3xl: clamp(2rem, 6vw, 2.5rem);
}

/* ============================================
   2. CONTAINER SYSTEM
   ============================================ */

.container {
    width: 100%;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--spacing-mobile);
    padding-right: var(--spacing-mobile);
}

@media (min-width: 768px) {
    .container {
        padding-left: var(--spacing-tablet);
        padding-right: var(--spacing-tablet);
    }
}

@media (min-width: 1201px) {
    .container {
        padding-left: var(--spacing-desktop);
        padding-right: var(--spacing-desktop);
    }
}

.container-fluid {
    width: 100%;
    padding-left: var(--spacing-mobile);
    padding-right: var(--spacing-mobile);
}

/* ============================================
   3. RESPONSIVE GRID UTILITIES
   ============================================ */

.responsive-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr; /* Mobile: 1 column */
}

@media (min-width: 481px) {
    .responsive-grid {
        gap: 1.25rem;
    }
}

@media (min-width: 768px) {
    .responsive-grid {
        grid-template-columns: repeat(2, 1fr); /* Tablet: 2 columns */
        gap: 1.5rem;
    }
}

@media (min-width: 1025px) {
    .responsive-grid {
        grid-template-columns: repeat(3, 1fr); /* Desktop: 3 columns */
        gap: 2rem;
    }
}

@media (min-width: 1441px) {
    .responsive-grid {
        grid-template-columns: repeat(4, 1fr); /* Large desktop: 4 columns */
    }
}

/* Auto-fit grid (adapts based on content) */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 1rem;
}

@media (min-width: 768px) {
    .grid-auto-fit {
        gap: 1.5rem;
    }
}

@media (min-width: 1201px) {
    .grid-auto-fit {
        gap: 2rem;
    }
}

/* Form grids */
.form-grid-2 {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .form-grid-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

.form-grid-3 {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .form-grid-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1025px) {
    .form-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   4. RESPONSIVE FLEXBOX UTILITIES
   ============================================ */

.flex-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.flex-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .flex-row {
        flex-direction: row;
        align-items: center;
    }
}

.flex-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* ============================================
   5. TOUCH-FRIENDLY INTERACTIONS
   ============================================ */

/* Minimum touch target size */
.touch-target,
button,
a.button,
input[type="button"],
input[type="submit"],
.btn {
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
    padding: 12px 20px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Larger touch targets on mobile */
@media (max-width: 767px) {
    .touch-target,
    button:not(.icon-only),
    a.button,
    input[type="button"],
    input[type="submit"],
    .btn {
        min-height: var(--touch-target-comfortable);
        padding: 14px 24px;
        font-size: 1rem;
    }
}

/* Input fields */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
    min-height: var(--touch-target-min);
    padding: 12px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
}

@media (max-width: 767px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    textarea,
    select {
        min-height: var(--touch-target-comfortable);
        padding: 14px 16px;
    }
}

/* Autocomplete dropdown items */
.autocomplete-item,
.dropdown-item,
.menu-item {
    min-height: var(--touch-target-min);
    padding: 12px 16px;
}

@media (max-width: 767px) {
    .autocomplete-item,
    .dropdown-item,
    .menu-item {
        min-height: var(--touch-target-comfortable);
        padding: 14px 16px;
    }
}

/* ============================================
   6. RESPONSIVE TYPOGRAPHY
   ============================================ */

h1, .h1 {
    font-size: var(--font-size-3xl);
    line-height: 1.2;
    margin-bottom: 1rem;
}

h2, .h2 {
    font-size: var(--font-size-2xl);
    line-height: 1.3;
    margin-bottom: 0.875rem;
}

h3, .h3 {
    font-size: var(--font-size-xl);
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

h4, .h4 {
    font-size: var(--font-size-lg);
    line-height: 1.5;
    margin-bottom: 0.625rem;
}

p, .body-text {
    font-size: var(--font-size-base);
    line-height: 1.6;
    margin-bottom: 1rem;
}

small, .text-sm {
    font-size: var(--font-size-sm);
}

.text-xs {
    font-size: var(--font-size-xs);
}

/* ============================================
   7. RESPONSIVE SPACING UTILITIES
   ============================================ */

.spacing-responsive {
    padding: var(--spacing-mobile);
}

@media (min-width: 768px) {
    .spacing-responsive {
        padding: var(--spacing-tablet);
    }
}

@media (min-width: 1201px) {
    .spacing-responsive {
        padding: var(--spacing-desktop);
    }
}

/* Gap utilities */
.gap-responsive {
    gap: 1rem;
}

@media (min-width: 768px) {
    .gap-responsive {
        gap: 1.5rem;
    }
}

@media (min-width: 1201px) {
    .gap-responsive {
        gap: 2rem;
    }
}

/* ============================================
   8. RESPONSIVE VISIBILITY UTILITIES
   ============================================ */

/* Hide on mobile */
.hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block;
    }
}

/* Show only on mobile */
.show-mobile {
    display: block;
}

@media (min-width: 768px) {
    .show-mobile {
        display: none;
    }
}

/* Hide on tablet */
@media (min-width: 768px) and (max-width: 1024px) {
    .hide-tablet {
        display: none;
    }
}

/* Show only on tablet */
.show-tablet {
    display: none;
}

@media (min-width: 768px) and (max-width: 1024px) {
    .show-tablet {
        display: block;
    }
}

/* Hide on desktop */
@media (min-width: 1025px) {
    .hide-desktop {
        display: none;
    }
}

/* Show only on desktop */
.show-desktop {
    display: none;
}

@media (min-width: 1025px) {
    .show-desktop {
        display: block;
    }
}

/* ============================================
   9. RESPONSIVE IMAGES & MEDIA
   ============================================ */

img,
video,
canvas {
    max-width: 100%;
    height: auto;
}

.responsive-iframe {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.responsive-iframe iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ============================================
   10. MOBILE MENU & NAVIGATION
   ============================================ */

.mobile-menu-toggle {
    display: block;
    min-height: var(--touch-target-comfortable);
    min-width: var(--touch-target-comfortable);
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
}

@media (min-width: 768px) {
    .mobile-menu-toggle {
        display: none;
    }
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 999;
}

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

/* ============================================
   11. RESPONSIVE CARDS
   ============================================ */

.card-responsive {
    padding: 1rem;
}

@media (min-width: 768px) {
    .card-responsive {
        padding: 1.5rem;
    }
}

@media (min-width: 1201px) {
    .card-responsive {
        padding: 2rem;
    }
}

/* ============================================
   12. RESPONSIVE TABLES
   ============================================ */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table {
    min-width: 600px;
}

/* Stack table on very small screens */
@media (max-width: 480px) {
    .table-stack thead {
        display: none;
    }

    .table-stack tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
    }

    .table-stack td {
        display: block;
        text-align: right;
        padding: 0.75rem;
        border-bottom: 1px solid #f3f4f6;
    }

    .table-stack td:last-child {
        border-bottom: none;
    }

    .table-stack td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: #374151;
    }
}

/* ============================================
   13. RESPONSIVE MODALS & OVERLAYS
   ============================================ */

.modal-responsive {
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .modal-responsive {
        width: 80%;
        max-width: 600px;
    }
}

@media (min-width: 1025px) {
    .modal-responsive {
        width: 70%;
        max-width: 800px;
    }
}

/* ============================================
   14. PRINT STYLES
   ============================================ */

@media print {
    .hide-print {
        display: none !important;
    }

    .page-break {
        page-break-after: always;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: black;
        background: white;
    }

    a {
        text-decoration: underline;
        color: black;
    }
}

/* ============================================
   15. ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary-color, #8b7355);
    outline-offset: 2px;
}

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

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

/* ============================================
   16. ORIENTATION SPECIFIC STYLES
   ============================================ */

/* Landscape orientation on small devices */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-responsive {
        max-height: 95vh;
    }

    .dashboard-header {
        padding: 1rem;
    }

    .dashboard-header h1 {
        font-size: 1.25rem;
    }
}
