/**
 * Enhanced Accessibility & Mobile Professional Standards
 * WCAG 2.1 AA Compliance
 * Professional Business UX/UI
 */

/* ================================================================
   SCREEN READER ONLY CONTENT
   ================================================================ */

.sr-only,
.page-announcement {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only:focus,
.page-announcement:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Ensure visible focus indicators for keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
    outline: 3px solid #00C9D7;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 201, 215, 0.25);
}

/* Enhanced focus states for nav items */
.nav-link:focus,
.nav-link:focus-visible {
    outline: 3px solid #00C9D7;
    outline-offset: -2px;
    position: relative;
    z-index: 2;
}

/* Skip to main content link (accessible but hidden) */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: #00C9D7;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 9999;
    border-radius: 0 0 4px 0;
}

.skip-to-main:focus {
    top: 0;
}

/* ================================================================
   TOUCH TARGET SIZE & MOBILE INTERACTION
   ================================================================ */

/* Minimum 44x44px touch targets per WCAG */
button,
a,
input[type="button"],
input[type="submit"],
input[type="reset"],
input[type="checkbox"],
input[type="radio"],
.nav-link,
.clickable {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Increase padding for touch-friendly spacing */
button,
.nav-link {
    padding: 12px 16px;
    margin: 4px;
}

/* Mobile menu button optimization */
.mobile-menu-toggle {
    min-width: 56px;
    min-height: 56px;
    padding: 12px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:active {
    background: rgba(0, 201, 215, 0.4);
    transform: scale(0.95);
}

/* Remove hover effects on touch devices */
@media (hover: none) and (pointer: coarse) {
    button:hover,
    a:hover,
    .nav-link:hover {
        /* Disable hover on touch devices */
    }
}

/* ================================================================
   COLOR CONTRAST & READABILITY (WCAG AA/AAA)
   ================================================================ */

/* Ensure minimum 4.5:1 contrast ratio for normal text, 3:1 for large text */
body {
    color: rgba(255, 255, 255, 0.95);
    background-color: #0a0a0a;
    line-height: 1.6;
    font-size: 16px;
}

h1, h2, h3, h4, h5, h6 {
    color: #ffffff;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

/* Text on glass panels */
.aero-glass,
.glass-panel,
[class*="glass"] {
    color: rgba(255, 255, 255, 0.95);
}

/* Ensure sufficient color contrast in dark mode */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #000000;
        color: rgba(255, 255, 255, 0.95);
    }
    
    p, li, td {
        color: rgba(255, 255, 255, 0.9);
    }
}

/* ================================================================
   RESPONSIVE TYPOGRAPHY & MOBILE READABILITY
   ================================================================ */

/* Fluid typography - scales with viewport */
h1 {
    font-size: clamp(1.75rem, 5vw, 3rem);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

body {
    font-size: clamp(14px, 2.5vw, 16px);
}

/* Minimum font size of 14px */
small, .text-sm {
    font-size: clamp(12px, 1.5vw, 14px);
}

/* Improve line spacing on mobile */
p {
    margin-bottom: 1.5em;
    line-height: 1.7;
}

/* Better spacing for lists */
ul, ol {
    margin-bottom: 1.5em;
    padding-left: 1.5em;
}

li {
    margin-bottom: 0.5em;
}

/* ================================================================
   MOBILE-FIRST RESPONSIVE LAYOUT
   ================================================================ */

/* Stack layout on mobile by default */
@media (max-width: 480px) {
    .main-content-panel {
        flex-direction: column;
        padding: 0.75rem;
    }
    
    .content-window {
        width: 100%;
        margin: 0;
        border-radius: 8px;
    }
    
    /* Improve button spacing on mobile */
    button {
        width: 100%;
        margin-bottom: 0.75rem;
    }
    
    /* Full-width inputs */
    input,
    select,
    textarea {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Better spacing for navigation */
    nav {
        padding: 1rem 0;
    }
}

/* ================================================================
   FORM ACCESSIBILITY
   ================================================================ */

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5em;
    color: rgba(255, 255, 255, 0.95);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
select,
textarea {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 12px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: #00C9D7;
    box-shadow: 0 0 0 3px rgba(0, 201, 215, 0.25);
}

/* Required field indicator */
input[required]::after,
textarea[required]::after,
select[required]::after {
    content: " *";
    color: #ff6b6b;
}

/* Error states */
.form-error,
input.error,
textarea.error,
select.error {
    border-color: #ff6b6b;
}

.error-message {
    color: #ff8c8c;
    font-size: 0.875rem;
    margin-top: 0.25em;
}

/* ================================================================
   REDUCED MOTION SUPPORT (WCAG 2.1)
   ================================================================ */

@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: more) {
    /* Increase border visibility */
    button,
    input,
    textarea,
    select,
    [role="button"] {
        border-width: 3px;
        border-color: #00C9D7;
    }
    
    /* Increase text contrast */
    body {
        color: #ffffff;
    }
    
    /* More visible focus indicators */
    *:focus {
        outline-width: 4px;
    }
}

/* ================================================================
   PROFESSIONAL BUSINESS STYLING
   ================================================================ */

/* Professional spacing and padding */
.container,
.content-wrapper {
    padding: clamp(1rem, 5vw, 2rem);
    margin: 0 auto;
    max-width: 1200px;
}

/* Professional button states */
.btn,
button {
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn:disabled,
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Professional section spacing */
section {
    margin: 2rem 0;
    padding: 1.5rem;
}

/* Better visual hierarchy */
.section-header {
    margin-bottom: 2rem;
    border-bottom: 2px solid rgba(0, 201, 215, 0.3);
    padding-bottom: 1rem;
}

/* ================================================================
   DARK MODE OPTIMIZATION
   ================================================================ */

@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #000a0f 0%, #0a0505 100%);
        color: rgba(255, 255, 255, 0.95);
    }
    
    a {
        color: #00d4ff;
    }
    
    a:visited {
        color: #00a8b5;
    }
}

/* ================================================================
   PRINT STYLES (Professional document printing)
   ================================================================ */

@media print {
    body {
        color: #000;
        background: #fff;
    }
    
    .mobile-menu-toggle,
    nav,
    .sidebar {
        display: none;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    h1, h2, h3, h4 {
        page-break-after: avoid;
    }
    
    p {
        orphans: 3;
        widows: 3;
    }
}

/* ================================================================
   PERFORMANCE & OPTIMIZATION
   ================================================================ */

/* Optimize animations for performance */
@media (prefers-reduced-motion: no-preference) {
    * {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* Optimize rendering */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Lazy loading support */
img[loading="lazy"] {
    background: rgba(255, 255, 255, 0.1);
}

/* ================================================================
   ARIA LIVE REGIONS & FEEDBACK
   ================================================================ */

[aria-live],
[role="alert"],
[role="status"] {
    position: relative;
    z-index: 1000;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: " (loading)";
}

/* Success/error messages */
.success-message {
    padding: 12px 16px;
    background: rgba(0, 255, 127, 0.2);
    border-left: 4px solid #00ff7f;
    color: rgba(255, 255, 255, 0.95);
    margin: 1rem 0;
    border-radius: 4px;
}

.error-message {
    padding: 12px 16px;
    background: rgba(255, 107, 107, 0.2);
    border-left: 4px solid #ff6b6b;
    color: rgba(255, 200, 200, 0.95);
    margin: 1rem 0;
    border-radius: 4px;
}

/* ================================================================
   LANDSCAPE & TABLET OPTIMIZATION
   ================================================================ */

@media (orientation: landscape) and (max-height: 500px) {
    body {
        padding: 0.5rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .main-content-panel {
        flex-direction: row;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .content-window {
        width: 95%;
    }
    
    .nav-text {
        font-size: 0.9rem;
    }
}

/* ================================================================
   OPTIMIZATION FOR DIFFERENT DEVICES
   ================================================================ */

/* iPhone notch support */
@supports (padding: max(0px)) {
    body {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Network-aware optimizations */
@media (prefers-reduced-data: reduce) {
    * {
        background-attachment: scroll !important;
        animation-duration: 0.01ms !important;
    }
}
