/* Mobile-First Enhancements */

/* Touch-friendly interactions */
@media (pointer: coarse) {
    .btn, .nav-list a, .card[onclick] {
        min-height: 44px;
        position: relative;
    }
    
    .btn:active, .nav-list a:active, .card[onclick]:active {
        background-color: rgba(220, 38, 38, 0.1);
    }
    
    /* Larger touch targets */
    input, select, textarea, button {
        min-height: 44px;
    }
}

/* Improved mobile tables */
@media (max-width: 640px) {
    .mobile-scroll-hint {
        text-align: center;
        color: var(--secondary-gray);
        font-size: 12px;
        margin-bottom: 8px;
        padding: 8px;
        background: rgba(220, 38, 38, 0.04);
        border-radius: 4px;
    }
    
    .mobile-scroll-hint::before {
        content: "← Swipe to scroll →";
    }
}

/* Sticky mobile navigation */
@media (max-width: 640px) {
    .mobile-nav-sticky {
        position: sticky;
        top: 0;
        z-index: 100;
        background: white;
        padding: 8px;
        border-bottom: 2px solid var(--primary-red);
        margin: -16px -16px 16px -16px;
    }
    
    .mobile-nav-title {
        font-weight: 700;
        color: var(--primary-red);
        font-size: 18px;
        text-align: center;
    }
}

/* Better mobile forms */
@media (max-width: 640px) {
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-actions {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 16px;
        margin: 16px -16px -16px -16px;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
    }
    
    .form-actions .btn {
        margin: 4px 0;
    }
}

/* Mobile-optimized cards */
@media (max-width: 640px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin: 16px -8px;
    }
    
    .card-grid .card {
        margin: 0 8px;
        border-radius: 8px;
    }
}

/* Pull-to-refresh indicator */
.ptr-indicator {
    text-align: center;
    padding: 20px;
    color: var(--secondary-gray);
    font-size: 14px;
}

/* 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 var(--primary-red);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Improved mobile typography */
@media (max-width: 640px) {
    body {
        font-size: 16px;
        line-height: 1.5;
    }
    
    .small-text {
        font-size: 14px;
    }
    
    .large-text {
        font-size: 18px;
        font-weight: 600;
    }
}

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

/* Enhanced Dark Mode Support */
@media (prefers-color-scheme: dark) {
    [data-theme="dark"] {
        --text-primary: #f9fafb;
        --text-secondary: #e5e7eb;
        --bg-primary: #111827;
        --bg-secondary: #1f2937;
        --bg-tertiary: #0f172a;
    }
}

/* Manual Dark Mode Override */
[data-theme="dark"] {
    --text-primary: #f9fafb;
    --text-secondary: #e5e7eb;
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #0f172a;
}

[data-theme="dark"] body {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 50%, var(--bg-tertiary) 100%);
    color: var(--text-primary);
}

[data-theme="dark"] .container {
    background: var(--bg-secondary);
    border-color: rgba(220, 38, 38, 0.3);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .card {
    background: var(--bg-primary);
    border-color: rgba(220, 38, 38, 0.2);
    color: var(--text-primary);
}

[data-theme="dark"] .table-container {
    background: var(--bg-primary);
    border-color: rgba(220, 38, 38, 0.2);
}

[data-theme="dark"] tbody tr:hover {
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.1), rgba(220, 38, 38, 0.05), rgba(220, 38, 38, 0.1));
}

[data-theme="dark"] tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] input, 
[data-theme="dark"] select, 
[data-theme="dark"] textarea {
    background: var(--bg-primary);
    border-color: rgba(220, 38, 38, 0.3);
    color: var(--text-primary);
}

[data-theme="dark"] input:focus, 
[data-theme="dark"] select:focus, 
[data-theme="dark"] textarea:focus {
    background: var(--bg-secondary);
    border-color: var(--primary-red);
}

[data-theme="dark"] .breadcrumb {
    background: rgba(220, 38, 38, 0.1);
    color: var(--text-secondary);
}

[data-theme="dark"] .alert-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.15));
    border-color: rgba(59, 130, 246, 0.3);
    color: #bfdbfe;
}

[data-theme="dark"] .alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.15));
    border-color: rgba(16, 185, 129, 0.3);
    color: #bbf7d0;
}

[data-theme="dark"] .alert-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.15));
    border-color: rgba(239, 68, 68, 0.3);
    color: #fecaca;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .card {
        border: 2px solid var(--primary-red);
    }
    
    input, select, textarea {
        border-width: 3px;
    }
} 