/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   WCAG 2.1 AA Compliant
   ============================================ */

/* ============================================
   HIGH CONTRAST COLORS
   ============================================ */

/* Badges - High Contrast */
.badge {
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 4px;
    display: inline-block;
}

.badge-primary {
    background: #6366F1;
    color: #FFFFFF;
}

.badge-secondary {
    background: #1E293B;
    color: #FFFFFF;
}

.badge-success {
    background: #10B981;
    color: #FFFFFF;
}

.badge-warning {
    background: #F59E0B;
    color: #1E293B; /* Dark text on yellow */
}

.badge-danger {
    background: #EF4444;
    color: #FFFFFF;
}

.badge-info {
    background: #3B82F6;
    color: #FFFFFF;
}

.badge-light {
    background: #E2E8F0;
    color: #1E293B; /* Dark text on light */
}

.badge-dark {
    background: #1E293B;
    color: #FFFFFF;
}

/* ============================================
   FOCUS INDICATORS
   ============================================ */

a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
.btn:focus {
    outline: 3px solid #6366F1;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible {
    outline: 3px solid #6366F1;
    outline-offset: 2px;
}

/* ============================================
   SKIP LINKS
   ============================================ */

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #6366F1;
    color: #FFFFFF;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
    font-weight: 700;
}

.skip-link:focus {
    top: 0;
}

/* ============================================
   SCREEN READER ONLY
   ============================================ */

.sr-only,
.visually-hidden {
    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-focusable:focus,
.visually-hidden-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ============================================
   HIGH CONTRAST LINKS
   ============================================ */

a {
    color: #6366F1;
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: all 0.2s;
}

a:hover {
    color: #4F46E5;
    text-decoration-color: currentColor;
}

a:visited {
    color: #7C3AED;
}

a:active {
    color: #5B21B6;
}

/* Links in dark backgrounds */
.bg-dark a,
.footer a,
[style*="background: #1E293B"] a,
[style*="background: rgb(30, 41, 59)"] a {
    color: #A5B4FC;
}

.bg-dark a:hover,
.footer a:hover {
    color: #FFFFFF;
}

/* ============================================
   BUTTON STATES
   ============================================ */

.btn {
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================
   SOCIAL MEDIA LINKS
   ============================================ */

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.2s;
    border: 2px solid currentColor;
}

.social-link:hover {
    transform: scale(1.1);
}

.social-link:focus {
    outline: 3px solid #6366F1;
    outline-offset: 2px;
}

/* Specific social media colors (optional) */
.social-facebook { color: #1877F2; }
.social-instagram { color: #E4405F; }
.social-linkedin { color: #0A66C2; }
.social-whatsapp { color: #25D366; }
.social-twitter { color: #1DA1F2; }
.social-youtube { color: #FF0000; }

/* ============================================
   FORM ACCESSIBILITY
   ============================================ */

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1E293B;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
textarea,
select {
    border: 2px solid #E2E8F0;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #6366F1;
}

input:invalid,
textarea:invalid,
select:invalid {
    border-color: #EF4444;
}

.form-error {
    color: #EF4444;
    font-size: 14px;
    margin-top: 0.25rem;
}

.form-help {
    color: #64748B;
    font-size: 14px;
    margin-top: 0.25rem;
}

/* ============================================
   STATS (Use <p> not headings)
   ============================================ */

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #1E293B;
    margin: 0;
    line-height: 1.2;
}

.stat-label {
    font-size: 1rem;
    color: #64748B;
    margin: 0.5rem 0 0;
}

/* Stats on dark backgrounds */
.bg-dark .stat-number,
[style*="background: #1E293B"] .stat-number {
    color: #FFFFFF;
}

.bg-dark .stat-label,
[style*="background: #1E293B"] .stat-label {
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================
   CARD TITLES (Proper heading levels)
   ============================================ */

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1E293B;
    margin-bottom: 0.5rem;
}

/* ============================================
   TEXT READABILITY
   ============================================ */

body {
    color: #1E293B;
    background: #FFFFFF;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    color: #1E293B;
    line-height: 1.2;
}

p {
    color: #475569;
    line-height: 1.6;
}

/* Dark backgrounds */
.bg-dark,
.footer,
[style*="background: #1E293B"],
[style*="background: rgb(30, 41, 59)"] {
    color: #FFFFFF !important;
}

.bg-dark h1,
.bg-dark h2,
.bg-dark h3,
.bg-dark h4,
.bg-dark h5,
.bg-dark h6,
.bg-dark p,
.footer h1,
.footer h2,
.footer h3,
.footer h4,
.footer h5,
.footer h6,
.footer p {
    color: #FFFFFF !important;
}

/* ============================================
   WHATSAPP BUTTON
   ============================================ */

.btn-whatsapp {
    background: #25D366;
    color: #FFFFFF;
    border: none;
    font-weight: 700;
}

.btn-whatsapp:hover {
    background: #1EBE57;
    color: #FFFFFF;
}

.btn-whatsapp:focus {
    outline: 3px solid #25D366;
    outline-offset: 2px;
}

/* ============================================
   KEYBOARD NAVIGATION
   ============================================ */

/* Ensure tab order is visible */
*:focus {
    outline: 2px solid #6366F1;
    outline-offset: 2px;
}

/* Remove outline for mouse users */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Show outline for keyboard users */
*:focus-visible {
    outline: 3px solid #6366F1;
    outline-offset: 2px;
}

/* ============================================
   TOUCH TARGETS (Minimum 44x44px)
   ============================================ */

button,
.btn,
a.btn,
input[type="submit"],
input[type="button"] {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 20px;
}

/* Small buttons still need 44px touch target */
.btn-sm {
    min-height: 44px;
    padding: 8px 16px;
}

/* ============================================
   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 #6366F1;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   ERROR STATES
   ============================================ */

.error {
    border-color: #EF4444 !important;
}

.error-message {
    color: #EF4444;
    font-size: 14px;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* ============================================
   SUCCESS STATES
   ============================================ */

.success {
    border-color: #10B981 !important;
}

.success-message {
    color: #10B981;
    font-size: 14px;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* ============================================
   RESPONSIVE ACCESSIBILITY
   ============================================ */

@media (max-width: 768px) {
    /* Larger touch targets on mobile */
    button,
    .btn,
    a.btn {
        min-height: 48px;
        padding: 12px 24px;
    }
    
    /* Larger text for readability */
    body {
        font-size: 16px;
    }
    
    /* Prevent zoom on input focus */
    input,
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    /* Hide non-essential elements */
    .skip-link,
    .social-link,
    .btn,
    nav,
    footer {
        display: none;
    }
    
    /* Ensure text is readable */
    body {
        color: #000000;
        background: #FFFFFF;
    }
    
    a {
        color: #000000;
        text-decoration: underline;
    }
    
    /* Show link URLs */
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@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;
    }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
    /* Increase contrast for all elements */
    body {
        color: #000000;
        background: #FFFFFF;
    }
    
    a {
        color: #0000EE;
        text-decoration: underline;
    }
    
    button,
    .btn {
        border: 2px solid #000000;
    }
}
