/* WoRide Accessibility & UX Enhancements */

/* ========================================
   1. COLOR CONTRAST IMPROVEMENTS
   ======================================== */

/* Ensure WCAG AA compliance (4.5:1 for normal text, 3:1 for large text) */

/* Enhanced text contrast on colored backgrounds */
.app-header {
    /* Increase contrast for header text */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.menu-header h2,
.menu-header p {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Ensure buttons have sufficient contrast */
.btn-primary {
    /* White text on orange background - good contrast */
    color: #FFFFFF;
    font-weight: 700;
}

.btn-secondary {
    /* Dark text on light background */
    color: #1E293B;
    font-weight: 600;
}

/* Status badges with enhanced contrast */
.status-badge {
    font-weight: 700;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

/* Navigation items - improve readability */
.nav-item {
    color: #475569; /* Darker secondary text for better contrast */
}

.nav-item.active {
    color: #FF6B35; /* Strong contrast */
    font-weight: 700;
}

/* Menu links with better contrast */
.menu-list li a {
    color: #1E293B; /* Darker for better readability */
}

/* Text on teal backgrounds */
.text-on-teal {
    color: #0F172A;
    font-weight: 600;
}

/* Loading screen text enhancement */
.loading-content p {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ========================================
   2. FOCUS & HOVER STATES
   ======================================== */

/* Universal focus indicator */
*:focus-visible {
    outline: 3px solid #FF6B35;
    outline-offset: 3px;
    border-radius: 4px;
}

/* Button focus states */
.btn:focus-visible,
button:focus-visible {
    outline: 3px solid #FF6B35;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(255, 107, 53, 0.2);
}

/* Input focus states */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #06B6D4;
    outline-offset: 2px;
    border-color: #06B6D4;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.15);
}

/* Navigation focus states */
.nav-item:focus-visible {
    outline: 3px solid #FF6B35;
    outline-offset: 2px;
    background: var(--selected-bg);
    transform: scale(1.05);
}

/* Menu link focus states */
.menu-link:focus-visible {
    outline: 3px solid #FF6B35;
    outline-offset: -2px;
    background: var(--background-teal-light);
}

/* Link hover states */
a:hover {
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

/* Card hover states - enhanced */
.card:hover {
    border-color: #06B6D4;
    box-shadow: 0 12px 32px rgba(6, 182, 212, 0.2);
    transform: translateY(-4px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Icon button hover states */
.icon-btn:hover {
    background: var(--background-teal-light);
    color: var(--primary-teal);
    transform: scale(1.1);
}

/* Taxi card hover enhancement */
.taxi-card:hover {
    cursor: pointer;
    border-color: #06B6D4;
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.25);
}

/* Route card hover */
.route-card:hover {
    border-color: #FF6B35;
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.2);
}

/* ========================================
   3. TOUCH TARGET SIZES (44x44px minimum)
   ======================================== */

/* Ensure all interactive elements meet minimum touch target size */
button,
a,
input[type="button"],
input[type="submit"],
.clickable {
    min-height: 44px;
    min-width: 44px;
}

/* Navigation items */
.nav-item {
    min-height: 56px;
    min-width: 68px;
    padding: 12px 16px;
}

/* Menu links */
.menu-link {
    min-height: 48px;
    padding: 14px 16px;
}

/* Icon-only buttons */
.icon-btn,
.menu-btn,
.close-menu {
    min-height: 44px;
    min-width: 44px;
    padding: 10px;
}

/* Form inputs */
input,
select,
textarea {
    min-height: 48px;
    padding: 14px 16px;
    font-size: 16px; /* Prevent iOS zoom */
}

/* Small buttons inside cards */
.select-taxi-btn,
.delete-route {
    min-height: 44px;
    min-width: 100px;
    padding: 12px 20px;
}

/* Filter buttons */
.filter-btn {
    min-height: 44px;
    padding: 12px 20px;
}

/* ========================================
   4. LOADING INDICATORS
   ======================================== */

/* Skeleton loader base */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--background-gray) 0%,
        var(--border-light) 50%,
        var(--background-gray) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Skeleton variants */
.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
    border-radius: 6px;
}

.skeleton-card {
    height: 120px;
    width: 100%;
    margin-bottom: 16px;
    border-radius: 12px;
}

.skeleton-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

.skeleton-button {
    height: 48px;
    width: 120px;
    border-radius: 12px;
}

/* Inline loader */
.inline-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Button loading state */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Content loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

/* Shimmer effect for loading cards */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

/* ========================================
   5. SMOOTH TRANSITIONS & ANIMATIONS
   ======================================== */

/* Page transition */
.page-enter {
    animation: pageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pageSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Side menu smooth transition */
.side-menu {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.side-menu.active {
    transform: translateX(0);
}

/* Modal transitions */
.modal-overlay {
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Card entrance animation */
.card-entrance {
    animation: cardFadeIn 0.5s ease-out;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

.main-content {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* ========================================
   6. HAPTIC FEEDBACK
   ======================================== */

/* Haptic feedback is triggered via JavaScript using navigator.vibrate() API
   No CSS classes needed - handled entirely by HapticFeedback object */

/* Visual feedback for active touch state */
.haptic-active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* ========================================
   7. VISUAL HIERARCHY & SPACING
   ======================================== */

/* Consistent spacing scale */
.spacing-xs {
    margin-bottom: 8px;
}

.spacing-sm {
    margin-bottom: 12px;
}

.spacing-md {
    margin-bottom: 16px;
}

.spacing-lg {
    margin-bottom: 24px;
}

.spacing-xl {
    margin-bottom: 32px;
}

/* Typography hierarchy */
.text-hero {
    font-size: 32px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.text-heading {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.text-subheading {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
}

.text-body {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
}

.text-small {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
}

.text-caption {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Section spacing */
.section {
    padding: 24px 16px;
}

.section-header {
    margin-bottom: 16px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.section-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========================================
   8. 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;
        scroll-behavior: auto !important;
    }
}

/* ========================================
   9. HIGH CONTRAST MODE SUPPORT
   ======================================== */

@media (prefers-contrast: high) {
    .btn,
    .card,
    input,
    select {
        border-width: 3px;
    }

    .nav-item.active {
        border: 3px solid var(--primary-orange);
    }

    a {
        text-decoration: underline;
    }
}

/* ========================================
   10. DARK MODE CONSIDERATIONS
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* Dark mode improvements handled in theme.css */
    /* Ensure sufficient contrast in dark mode */
}

/* ========================================
   11. MOBILE-SPECIFIC ENHANCEMENTS
   ======================================== */

@media (max-width: 768px) {
    /* Larger touch targets on mobile */
    button,
    a {
        min-height: 48px;
        min-width: 48px;
    }

    /* Prevent text selection on interactive elements */
    .btn,
    .nav-item,
    .menu-link {
        -webkit-tap-highlight-color: rgba(255, 107, 53, 0.2);
        user-select: none;
    }

    /* Optimize input fields for mobile */
    input,
    select,
    textarea {
        font-size: 16px !important; /* Prevent iOS zoom */
    }

    /* Bottom navigation safe area */
    .bottom-nav {
        padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
    }
}

/* ========================================
   12. ERROR STATES
   ======================================== */

.error-state {
    border-color: var(--error-red);
    background: rgba(239, 68, 68, 0.05);
}

.error-message {
    color: var(--error-red);
    font-size: 14px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.error-message::before {
    content: '⚠️';
}

/* Success states */
.success-state {
    border-color: var(--success-green);
    background: rgba(16, 185, 129, 0.05);
}

.success-message {
    color: var(--success-green);
    font-size: 14px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.success-message::before {
    content: '✓';
}

/* ========================================
   13. EMPTY STATES
   ======================================== */

.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state-icon {
    font-size: 64px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ========================================
   14. PROGRESS INDICATORS
   ======================================== */

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border-gray);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-orange), var(--primary-teal));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-indeterminate {
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}
