/* Colorblind Accessibility Enhancements */

/* 
 * This file provides accessibility improvements for colorblind users
 * - High contrast ratios (WCAG AAA compliant where possible)
 * - Pattern/texture differentiation
 * - Icon reinforcement alongside colors
 * - Underlines and borders for important elements
 * - Focus indicators with multiple visual cues
 */

/* Skip Link for Keyboard Navigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: var(--light-text);
    padding: 0.75rem 1rem;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 6px 0;
    font-weight: 600;
    font-size: 0.95rem;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid var(--focus-outline);
    outline-offset: 2px;
}

/* Enhanced Color Variables for Better Contrast */
:root {
    /* Maintain original colors but ensure proper usage */
    --primary-color: #ff9800; /* Orange - Good for most colorblind types */
    --secondary-color: #f57c00;
    --accent-color: #ff5722; /* Red-Orange */
    --text-color: #212121; /* Darker for better contrast */
    --light-text: #ffffff;
    --hover-color: #ffb74d;
    
    /* Success/Error colors optimized for colorblind users */
    --success-color: #2e7d32; /* Dark green with pattern */
    --error-color: #c62828; /* Dark red with pattern */
    --warning-color: #f57f17; /* Amber */
    --info-color: #1565c0; /* Blue */
    
    /* Border and focus colors */
    --focus-border: #4a148c; /* Purple - distinct from other colors */
    --focus-outline: #4a148c; /* Purple - distinct from other colors */
}

/* Ensure all text meets WCAG AAA contrast standards */
body {
    color: var(--text-color);
}

/* Enhanced focus states for keyboard navigation */
*:focus,
*:focus-visible {
    outline: 3px solid var(--focus-outline) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px rgba(74, 20, 140, 0.2) !important;
}

/* Links - Add underlines for clarity */
a {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

a:hover {
    text-decoration-thickness: 3px;
    font-weight: 500;
}

/* Button States - Use patterns + borders + icons */
.auth-btn,
.submit-btn,
.join-btn,
button {
    border: 3px solid currentColor !important;
    position: relative;
    font-weight: 600;
}

.auth-btn:hover,
.submit-btn:hover,
.join-btn:hover,
button:hover {
    border-width: 4px !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
}

/* Active/Selected States - Use borders + background patterns */
.menu-item a:hover,
.menu-item a.active,
.menu-item a[style*="background-color"] {
    border-left: 5px solid var(--accent-color) !important;
    font-weight: 600;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 152, 0, 0.1) 10px,
        rgba(255, 152, 0, 0.1) 20px
    );
}

/* Success Messages - Pattern + Icon */
.success-message,
.copy-success {
    border-left: 5px solid var(--success-color) !important;
    background: linear-gradient(135deg, #e8f5e9 25%, transparent 25%) -10px 0,
                linear-gradient(225deg, #e8f5e9 25%, transparent 25%) -10px 0,
                linear-gradient(315deg, #e8f5e9 25%, transparent 25%),
                linear-gradient(45deg, #e8f5e9 25%, transparent 25%);
    background-size: 20px 20px;
    background-color: #f1f8e9;
}

.success-message::before,
.copy-success::before {
    content: '✓ ';
    font-weight: bold;
    font-size: 1.2em;
}

/* Error Messages - Pattern + Icon */
.error-message,
.general-error {
    border-left: 5px solid var(--error-color) !important;
    background: repeating-linear-gradient(
        45deg,
        #ffebee,
        #ffebee 10px,
        #ffcdd2 10px,
        #ffcdd2 20px
    );
}

.error-message::before,
.general-error::before {
    content: '✕ ';
    font-weight: bold;
    font-size: 1.2em;
}

/* Form Input States */
input:focus,
textarea:focus,
select:focus {
    border: 3px solid var(--focus-border) !important;
    box-shadow: 0 0 0 3px rgba(74, 20, 140, 0.3) !important;
}

input.error,
textarea.error,
select.error {
    border: 3px solid var(--error-color) !important;
    background: repeating-linear-gradient(
        135deg,
        #fff,
        #fff 10px,
        #ffebee 10px,
        #ffebee 20px
    );
}

input:valid,
textarea:valid {
    border-left: 4px solid var(--success-color) !important;
}

/* Card Differentiation - Use borders and subtle patterns */
.service-card,
.resource-card,
.dashboard-card,
.summary-card {
    border: 2px solid #e0e0e0;
    border-top: 4px solid var(--primary-color);
    box-shadow: 0 2px 8px rgba(74, 20, 140, 0.15);
}

.service-card:hover,
.resource-card:hover,
.dashboard-card:hover,
.summary-card:hover {
    border: 3px solid var(--accent-color);
    box-shadow: 0 6px 16px rgba(74, 20, 140, 0.3) !important;
}

/* Icons - Ensure they're always visible with high contrast */
.material-icons {
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
}

/* Status Indicators - Always use icon + text + color + pattern */
.status-active,
.indicator.active {
    border: 3px solid var(--success-color) !important;
    background: #c8e6c9 !important;
}

.status-active::before {
    content: '● ';
    color: var(--success-color);
}

.status-inactive {
    border: 3px solid #757575 !important;
    opacity: 0.6;
}

.status-inactive::before {
    content: '○ ';
    color: #757575;
}

/* Carousel Indicators - Enhanced visibility */
.indicator {
    border: 3px solid #fff !important;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.indicator.active {
    border-color: var(--focus-border) !important;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--focus-border);
}

/* Navigation Active States */
.carousel-btn,
.carousel-btn.prev,
.carousel-btn.next {
    border: 3px solid rgba(0, 0, 0, 0.5) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Progress Indicators - Use patterns */
.progress-bar {
    height: 30px;
    border: 2px solid var(--text-color);
    background: repeating-linear-gradient(
        90deg,
        #e0e0e0,
        #e0e0e0 10px,
        #f5f5f5 10px,
        #f5f5f5 20px
    );
}

.progress-fill {
    height: 100%;
    background: repeating-linear-gradient(
        45deg,
        var(--success-color),
        var(--success-color) 10px,
        #66bb6a 10px,
        #66bb6a 20px
    );
    border-right: 3px solid var(--text-color);
}

/* Tables - Striped with borders */
table {
    border: none;
}

tr:nth-child(even) {
    background: #f5f5f5;
}

tr:nth-child(odd) {
    background: #fff;
}

th {
    background: var(--primary-color) !important;
    color: var(--light-text);
    border: none !important;
    font-weight: 700;
}

td {
    border: 1px solid #e0e0e0;
}

/* Calendar Days - Enhanced differentiation */
.calendar-day {
    border: 2px solid #e0e0e0;
}

.calendar-day.has-event {
    border: 3px solid var(--accent-color) !important;
    font-weight: 700;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(255, 152, 0, 0.1) 5px,
        rgba(255, 152, 0, 0.1) 10px
    );
}

.calendar-day.today {
    border: 4px solid var(--focus-border) !important;
    background: #fff9c4;
    box-shadow: inset 0 0 0 2px var(--focus-border);
}

/* Subject/Category Differentiation - Use unique patterns */
.subject-item:nth-child(1) {
    border-left: 5px solid #1976d2; /* Blue */
}

.subject-item:nth-child(2) {
    border-left: 5px solid #388e3c; /* Green */
}

.subject-item:nth-child(3) {
    border-left: 5px solid #f57c00; /* Orange */
}

.subject-item:nth-child(4) {
    border-left: 5px solid #7b1fa2; /* Purple */
}

.subject-item:nth-child(5) {
    border-left: 5px solid #c62828; /* Red */
}

/* Logged-in User Display - High contrast */
.user-info {
    background: rgba(255, 255, 255, 0.2) !important;
    border: 2px solid var(--light-text) !important;
    border-radius: 4px;
    padding: 4px 12px;
}

/* Logout Button - Distinct styling */
.auth-btn[onclick*="logout"],
.auth-btn[style*="f44336"] {
    background: repeating-linear-gradient(
        45deg,
        #c62828,
        #c62828 10px,
        #d32f2f 10px,
        #d32f2f 20px
    ) !important;
    border: 3px solid #fff !important;
}

/* Hover States - Always add scale transform */
a:hover,
button:hover,
.auth-btn:hover,
.resource-card:hover,
.service-card:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #ff6f00;
        --accent-color: #d84315;
        --text-color: #000000;
    }
    
    * {
        border-width: 2px !important;
    }
    
    .material-icons {
        font-weight: 700;
    }
}

/* 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;
    }
}

/* Print Styles - Ensure patterns show */
@media print {
    .error-message,
    .success-message {
        border: 3px solid #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
