/* styles.css */

/* WCAG 2.1 AA Compliance Styles */

/* Skip Link for Screen Readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    z-index: 1000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* Screen Reader Only Text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Enhanced Focus Indicators - WCAG 2.1 AA compliant */
*:focus {
    outline: 3px solid var(--focus-ring-light);
    outline-offset: 2px;
}

/* CSS Variables for RGB values */
:root {
    --primary-rgb: 74, 108, 247;
    --accent-rgb: 16, 185, 129;
    --card-background-rgb: 255, 255, 255;
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary-rgb: 252, 134, 134;
        --accent-rgb: 3, 218, 198;
        --card-background-rgb: 18, 18, 18;
    }
}

/* Prevent FOUC */
body {
    visibility: visible;
}

/* High contrast focus for dark mode */
@media (prefers-color-scheme: dark) {
    *:focus {
        outline-color: var(--focus-ring-dark);
    }
}

/* Remove default focus for mouse users but keep for keyboard */
*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 3px solid var(--focus-ring-light);
    outline-offset: 2px;
}

@media (prefers-color-scheme: dark) {
    *:focus-visible {
        outline-color: var(--focus-ring-dark);
    }
}

/* Ensure minimum 44px touch targets on mobile */
@media (max-width: 768px) {
    button, a, input, [role="button"] {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Enhanced color contrast ratios */
:root {
    /* Light theme colors - Enhanced for WCAG AA contrast */
    --background-color: #f5f7fa;
    --text-color: #1a202c; /* Darker for better contrast */
    --card-background: #ffffff;
    --card-shadow: 0 10px 25px rgba(0,0,0,0.05);
    --border-color: #e2e8f0;
    --primary-color: #3b51d4; /* Darker for better contrast */
    --primary-hover: #2a3cb8;
    --accent-color: #047857; /* Darker green for better contrast */
    --accent-hover: #065f46;
    --danger-color: #dc2626; /* Better contrast red */
    --danger-hover: #b91c1c;
    --header-color: #111827; /* Much darker for better contrast */
    --secondary-text: #4b5563; /* Darker for better contrast */
    --placeholder-bg: #f8fafc;
    --meta-background: rgba(0, 0, 0, 0.75); /* Higher opacity for readability */
    --search-border: #9ca3af; /* Darker border for visibility */
    --disabled-button: #9ca3af; /* Darker for better contrast */
    --loading-color: #3b51d4;
    --tag-bg: #d1d5db; /* Darker background */
    --tag-text: #374151; /* Darker text */
    --hover-overlay: rgba(0, 0, 0, 0.05);
    --progress-bg: #e5e7eb;
    --progress-fill: #3b51d4;
    
    /* Enhanced focus colors */
    --focus-ring-light: #3b51d4;
    --focus-ring-dark: #10b981;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark theme colors - Enhanced for WCAG AA contrast */
        --background-color: #000000;
        --text-color: #f1f5f9; /* Brighter for better contrast */
        --card-background: #121212;
        --card-shadow: 0 10px 25px rgba(0,0,0,0.4);
        --border-color: #404040; /* Lighter border for visibility */
        --primary-color: #ff6b6b; /* Better contrast red */
        --primary-hover: #ff5252;
        --accent-color: #4ecdc4; /* Better contrast cyan */
        --accent-hover: #26a69a;
        --danger-color: #ff5252;
        --danger-hover: #f44336;
        --header-color: #ffffff;
        --secondary-text: #b3b3b3; /* Lighter for better contrast */
        --placeholder-bg: #1e1e1e;
        --meta-background: rgba(0, 0, 0, 0.85); /* Higher opacity for readability */
        --search-border: #525252; /* Lighter border */
        --disabled-button: #525252; /* Better contrast */
        --hover-overlay: rgba(255, 255, 255, 0.08);
        --tag-bg: #404040; /* Lighter background */
        --tag-text: #f1f5f9; /* Brighter text */
        --progress-bg: #404040;
        --progress-fill: #4ecdc4;
        
        /* Enhanced focus colors for dark mode */
        --focus-ring-light: #ff6b6b;
        --focus-ring-dark: #4ecdc4;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    color: var(--text-color);
    line-height: 1.6;
    font-size: 2rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header card redesign */
header {
    text-align: center;
    margin-bottom: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 2rem;
    border: 0px solid var(--border-color);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
                rgba(var(--primary-rgb), 0.08) 0%, 
                rgba(var(--card-background-rgb), 1) 50%,
                rgba(var(--accent-rgb), 0.08) 100%);
    z-index: -1;
}

/* Enhanced title styling */
.site-title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

h1 {
    color: var(--header-color);
    font-size: 2rem;
    letter-spacing: -0.025em;
    font-weight: 800;
    margin: 0 0 0.5rem;
    position: relative;
    display: inline-block;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* Fallback for browsers that don't support text-fill-color */
    color: transparent;
}

.title-icon {
    margin-bottom: 0.75rem;
    font-size: 2rem;
    animation: pulse 2s infinite ease-in-out;
}

.site-tagline {
    color: var(--secondary-text);
    font-size: 1.2rem;
    font-weight: 500;
    max-width: 600px;
    margin: 0 auto;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* Library stats styling */
.library-stats-container {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.library-stats-container::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 25%;
    right: 25%;
    height: 1px;
    background: linear-gradient(to right, 
                transparent 0%, 
                var(--primary-color) 50%, 
                transparent 100%);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat-item {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--secondary-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.search-container {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin: 0 auto;
    max-width: 650px;
    width: 100%;
}

.navigation-container {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

#search {
    padding: 0.875rem 1.25rem;
    width: 100%;
    border-radius: 9999px;
    border: 1px solid var(--search-border);
    font-size: 1rem;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    transition: all 0.25s ease;
    background-color: var(--card-background);
    color: var(--text-color);
}

#search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.15);
}

button {
    padding: 0.875rem 1.25rem;
    border-radius: 9999px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    line-height: 1;
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background-color: var(--disabled-button);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

button:disabled:hover {
    background-color: var(--disabled-button);
    transform: none;
    box-shadow: none;
}

.single-card {
    background-color: var(--card-background);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.audiobook-card {
    position: relative;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    overflow: hidden;
    min-height: 500px;
    background-size: cover;
    background-position: center;
}

.card-overlay {
    position: relative;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.85) 100%);
    width: 100%;
    height: 100%;
    color: white;
    padding: 2rem;
    box-sizing: border-box;
}

@media (min-width: 800px) {
    .card-overlay {
        flex-direction: row;
        align-items: flex-start;
        gap: 2rem;
    }
}

/* Media container and player */
.media-container {
    z-index: 3;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 320px;
    margin-bottom: 1.5rem;
}

#youtube-player {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    margin-bottom: 1rem;
    aspect-ratio: 16/9;
}

.player-controls {
    background-color: rgba(18, 18, 18, 0.85); /* Darker background for dark theme */
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.progress-container {
    width: 100%;
    height: 4px;
    background-color: var(--progress-bg);
    border-radius: 2px;
    margin: 0.5rem 0;
    position: relative;
    cursor: pointer;
}

.progress-bar {
    height: 100%;
    background-color: var(--progress-fill);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.progress-handle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: white;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    left: 0%;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    cursor: pointer;
}

.time-display {
    color: white;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.control-button {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    padding: 0;
    border: none;
}

.control-button:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
    box-shadow: none;
}

.control-button.large {
    width: 50px;
    height: 50px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

#volume-slider {
    width: 100%;
    height: 4px;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
}

#volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
}

/* Icons */
.play-icon::before {
    content: "▶";
}

.pause-icon::before {
    content: "⏸";
}

.volume-icon::before {
    content: "🔊";
    font-size: 16px;
}

.rewind-icon::before {
    content: "⏪";
    font-size: 14px;
}

.forward-icon::before {
    content: "⏩";
    font-size: 14px;
}

.error-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    margin-right: 8px;
    font-style: normal;
    font-weight: bold;
}

.time-icon::before {
    content: "⏱";
    margin-right: 5px;
}

.audio-icon::before {
    content: "🎧";
    margin-right: 5px;
}

/* Book details */
.book-details {
    flex: 1;
    z-index: 2;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.book-text-content {
    background-color: rgba(0, 0, 0, 0.75);
    padding: 1.75rem;
    border-radius: 12px;
    margin-bottom: 0;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.book-details h2 {
    color: white;
    margin-top: 0;
    font-size: 1.75rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    letter-spacing: -0.025em;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.book-details h3 {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    margin-top: 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
}

.book-details p {
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0px 1px 2px rgba(0,0,0,0.7);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.book-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.category-tag {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

#audio-player {
    width: 100%;
    margin-top: 1rem;
    border-radius: 8px;
    height: 36px;
}

.meta-inline {
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: white;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    color: #c4c4c4;
}

.duration-badge {
    display: inline-flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    margin-left: 0.5rem;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.875rem;
}

.audio-status.available {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
    background-color: var(--accent-color);
    color: white;
}

.channel-link {
    display: inline-flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.15);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    margin-left: 0.25rem;
    transition: all 0.2s ease;
    text-decoration: none;
    color: white;
}

.channel-link:hover {
    background-color: rgba(255, 255, 255, 0.25);
    text-decoration: none;
    color: white;
}

.channel-link .channel-icon {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
}

/* Loading states */
.loading-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 500px;
    color: var(--text-color);
    background-color: var(--card-background);
    border-radius: 16px;
    padding: 2rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1.5rem;
}

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

.error-message, .no-results {
    padding: 3rem 2rem;
    text-align: center;
    border-radius: 12px;
    margin: 1rem 0;
}

.error-message {
    color: var(--danger-color);
    background-color: rgba(239, 68, 68, 0.1);
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.no-results {
    color: var(--text-color);
    background-color: rgba(255, 255, 255, 0.05);
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.search-icon::before {
    content: "🔍";
    font-size: 32px;
    display: block;
}

.book-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 400px;
    color: var(--secondary-text);
    text-align: center;
    font-size: 1.125rem;
    background-color: var(--placeholder-bg);
    border-radius: 12px;
    gap: 1rem;
}

.book-placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    opacity: 0.5;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
    color: var(--secondary-text);
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    background: linear-gradient(to top, rgba(var(--primary-rgb), 0.02), transparent);
}

.footer-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.footer-link {
    text-decoration: none;
    font-weight: 500;
    letter-spacing: 0.01em;
    position: relative;
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.2s ease;
}

.footer-link:hover::after {
    width: 100%;
}

.footer-info {
    line-height: 1.6;
}

.footer-info p {
    margin: 0.5rem 0;
}

#theme-toggle {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

#theme-toggle:hover {
    background-color: var(--hover-overlay);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.theme-icon {
    font-size: 1rem;
    transition: transform 0.2s ease;
}

#theme-toggle:hover .theme-icon {
    transform: rotate(180deg);
}

.source-code-link {
    cursor: pointer;
    transition: all 0.2s ease;
}

.source-code-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 640px) {
    footer {
        margin-top: 2rem;
        padding-top: 1.5rem;
        font-size: 0.8125rem;
    }
    
    .footer-links {
        gap: 1rem;
    }
    
    .footer-info p {
        margin: 0.375rem 0;
    }
}

/* EN 301 549 European Accessibility Standard Styles */

/* Session Timeout Warning Dialog */
.session-timeout-warning {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.timeout-content {
    background-color: var(--card-background);
    color: var(--text-color);
    border-radius: 8px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--primary-color);
}

.timeout-content h3 {
    margin-bottom: 1rem;
    color: var(--header-color);
    font-size: 1.25rem;
}

.timeout-content p {
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.extend-session-btn,
.dismiss-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin: 0.5rem;
    min-height: 44px;
    min-width: 44px;
    transition: all 0.2s ease;
}

.extend-session-btn:hover,
.dismiss-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.extend-session-btn:focus,
.dismiss-btn:focus {
    outline: 3px solid var(--focus-ring-light);
    outline-offset: 2px;
}

.dismiss-btn {
    background-color: var(--secondary-text);
}

.dismiss-btn:hover {
    background-color: var(--text-color);
}

/* Accessible Error Dialog */
.accessible-error-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.error-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
}

.error-dialog-content {
    position: relative;
    background-color: var(--card-background);
    color: var(--text-color);
    border-radius: 8px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--danger-color);
}

.error-dialog-content h2 {
    color: var(--danger-color);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.error-dialog-content p {
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.primary-action,
.secondary-action {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    transition: all 0.2s ease;
}

.primary-action:hover,
.secondary-action:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.primary-action:focus,
.secondary-action:focus {
    outline: 3px solid var(--focus-ring-light);
    outline-offset: 2px;
}

.secondary-action {
    background-color: var(--secondary-text);
}

.secondary-action:hover {
    background-color: var(--text-color);
}

/* Language Switcher (hidden by default) */
#language-switcher {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    box-shadow: var(--card-shadow);
}

#language-switcher label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

#lang-select {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    background-color: var(--card-background);
    color: var(--text-color);
    font-size: 0.875rem;
    min-height: 44px;
}

#lang-select:focus {
    outline: 3px solid var(--focus-ring-light);
    outline-offset: 2px;
}

/* Enhanced Mobile Accessibility */
@media (max-width: 768px) {
    .timeout-content,
    .error-dialog-content {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .error-actions {
        flex-direction: column;
    }
    
    .primary-action,
    .secondary-action,
    .extend-session-btn,
    .dismiss-btn {
        width: 100%;
        margin: 0.25rem 0;
    }
}

/* High Contrast Mode Support for EN 301 549 */
@media (prefers-contrast: high) {
    .session-timeout-warning,
    .accessible-error-dialog {
        background-color: rgba(0, 0, 0, 0.95);
    }
    
    .timeout-content,
    .error-dialog-content {
        border-width: 3px;
        box-shadow: 0 0 0 2px var(--text-color);
    }
    
    .extend-session-btn,
    .dismiss-btn,
    .primary-action,
    .secondary-action {
        border: 2px solid var(--text-color);
    }
    
    #lang-select {
        border-width: 2px;
    }
}

/* Reduced Motion Support for EN 301 549 */
@media (prefers-reduced-motion: reduce) {
    .timeout-content,
    .error-dialog-content,
    .extend-session-btn,
    .dismiss-btn,
    .primary-action,
    .secondary-action {
        transition: none !important;
        transform: none !important;
    }
    
    .extend-session-btn:hover,
    .dismiss-btn:hover,
    .primary-action:hover,
    .secondary-action:hover {
        transform: none !important;
    }
}
