/* ============================================
   RESPONSIVE MOBILE-OPTIMIZED STYLES
   Breakpoints: Mobile (320px) | Tablet (768px) | Desktop (1024px)
   ============================================ */

:root {
    --primary-color: #3b82f6;
    --dark-bg: #0a0a0a;
    --card-bg: #1a1a1a;
    --text-primary: #fafafa;
    --text-secondary: #999;
    --border: rgba(255, 255, 255, 0.1);
    --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ============================================
   MOBILE-FIRST BASE STYLES (320px+)
   ============================================ */

html, body {
    font-size: 16px;
    width: 100%;
    overflow-x: hidden;
}

/* Safe area insets for notched devices */
html {
    padding-top: env(safe-area-inset-top);
}

body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

/* ============================================
   TYPOGRAPHY - MOBILE OPTIMIZED
   ============================================ */

h1 {
    font-size: 24px;
    line-height: 1.3;
    margin: 16px 0 12px;
}

h2 {
    font-size: 20px;
    line-height: 1.3;
    margin: 14px 0 10px;
}

h3 {
    font-size: 18px;
    line-height: 1.35;
}

p {
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================
   NAVIGATION - MOBILE STYLES
   ============================================ */

nav {
    padding: 12px 16px;
    touch-action: manipulation;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:active {
    opacity: 0.8;
}

/* ============================================
   BUTTONS - MOBILE OPTIMIZED
   ============================================ */

button,
[role="button"],
.btn {
    padding: 12px 16px;
    min-height: 44px;
    min-width: 44px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

button:active,
[role="button"]:active,
.btn:active {
    transform: scale(0.95);
    background: rgba(59, 130, 246, 0.2);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   FORM ELEMENTS - MOBILE OPTIMIZED
   ============================================ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
textarea,
select {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    margin: 8px 0;
    font-size: 16px; /* Prevents iOS zoom */
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transition: all 0.2s ease;
    box-sizing: border-box;
    touch-action: manipulation;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

label {
    display: block;
    font-size: 14px;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* ============================================
   CARDS & CONTAINERS - MOBILE OPTIMIZED
   ============================================ */

.card,
[class*="card"] {
    border-radius: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.card:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.08);
}

/* ============================================
   GRID LAYOUT - RESPONSIVE
   ============================================ */

.grid {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1024px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* ============================================
   SPACING - MOBILE FIRST
   ============================================ */

.p-mobile {
    padding: 16px;
}

.m-mobile {
    margin: 12px;
}

@media (min-width: 768px) {
    .p-mobile {
        padding: 24px;
    }

    .m-mobile {
        margin: 16px;
    }
}

/* ============================================
   VISIBILITY - MOBILE RESPONSIVE
   ============================================ */

.hide-mobile {
    display: none !important;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block !important;
    }

    .hide-desktop {
        display: none !important;
    }
}

/* ============================================
   TEXT UTILITIES
   ============================================ */

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-wrap {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============================================
   ANIMATION UTILITIES
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   SCROLLBAR - CUSTOM (Optional)
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

/* ============================================
   TABLET OPTIMIZATIONS (768px+)
   ============================================ */

@media (min-width: 768px) {
    h1 {
        font-size: 32px;
    }

    h2 {
        font-size: 24px;
    }

    h3 {
        font-size: 20px;
    }

    p {
        font-size: 15px;
    }

    button,
    [role="button"],
    .btn {
        padding: 12px 24px;
    }

    input,
    textarea,
    select {
        padding: 12px 14px;
        font-size: 15px;
    }

    .card,
    [class*="card"] {
        border-radius: 16px;
        padding: 20px;
    }
}

/* ============================================
   DESKTOP OPTIMIZATIONS (1024px+)
   ============================================ */

@media (min-width: 1024px) {
    h1 {
        font-size: 36px;
    }

    h2 {
        font-size: 28px;
    }

    p {
        font-size: 16px;
    }

    button,
    [role="button"],
    .btn {
        padding: 12px 28px;
        transition: all 0.3s ease;
    }

    button:hover,
    [role="button"]:hover,
    .btn:hover {
        background: rgba(59, 130, 246, 0.2);
        transform: translateY(-2px);
    }

    .card,
    [class*="card"] {
        border-radius: 20px;
        padding: 24px;
    }

    .card:hover {
        background: rgba(255, 255, 255, 0.08);
        transform: translateY(-4px);
    }
}

/* ============================================
   LANDSCAPE ORIENTATION ADJUSTMENTS
   ============================================ */

@media (max-height: 600px) and (orientation: landscape) {
    h1 {
        font-size: 20px;
        margin: 8px 0;
    }

    button {
        padding: 10px 14px;
        min-height: 40px;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATION
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    button,
    a,
    [role="button"] {
        padding: 14px 18px;
        min-height: 48px;
        min-width: 48px;
    }

    button:active {
        background: rgba(59, 130, 246, 0.3);
    }
}

/* ============================================
   HIGH DPI DISPLAYS
   ============================================ */

@media (min-resolution: 192dpi) {
    border {
        width: 0.5px;
    }
}

/* ============================================
   DARK MODE VARIABLES
   ============================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --dark-bg: #0a0a0a;
        --card-bg: #1a1a1a;
    }
}

/* ============================================
   ACCESSIBILITY - KEYBOARD FOCUS
   ============================================ */

*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-main:focus {
    top: 0;
}
