/* Keyboard Navigation & Shortcuts Styles */

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

/* ===== Focus Indicators ===== */
:focus-visible {
    outline: none !important;
}

button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
    outline: none !important;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: none !important;
}

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: #1f2937;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 4px 0;
    font-weight: 600;
    transition: top 0.2s;
}

.skip-to-main:focus {
    top: 0;
}

/* ===== Keyboard Shortcuts Modal ===== */
.keyboard-shortcuts-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease-out;
}

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

.keyboard-shortcuts-modal {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

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

/* Header */
.shortcuts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    color: white;
}

.shortcuts-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
}

.shortcuts-close {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.shortcuts-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.shortcuts-close:active {
    transform: scale(0.95);
}

/* Content */
.shortcuts-content {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.shortcuts-section {
    margin-bottom: 2rem;
}

.shortcuts-section:last-child {
    margin-bottom: 0;
}

.shortcuts-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.shortcuts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    transition: all 0.2s;
}

.shortcut-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.shortcut-keys {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.shortcut-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.25rem 0.5rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05),
                inset 0 -2px 0 0 rgba(0, 0, 0, 0.05);
}

.shortcut-plus {
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 600;
}

.shortcut-description {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

/* Footer */
.shortcuts-footer {
    padding: 1rem 2rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    text-align: center;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .keyboard-shortcuts-modal {
        border-radius: 1rem;
        max-height: 95vh;
    }

    .shortcuts-header {
        padding: 1rem 1.5rem;
    }

    .shortcuts-title {
        font-size: 1.25rem;
    }

    .shortcuts-content {
        padding: 1.5rem;
    }

    .shortcuts-list {
        grid-template-columns: 1fr;
    }

    .shortcuts-footer {
        padding: 0.75rem 1.5rem;
    }
}

/* ===== Focus Trap Indicator ===== */
[data-focus-trap] {
    position: relative;
}

/* ===== Keyboard User Detection ===== */
body.keyboard-user *:focus {
    outline: none;
}

/* Mouse users don't see focus outline */
body:not(.keyboard-user) *:focus {
    outline: none;
}

/* But always show for :focus-visible */
*:focus-visible {
    outline: none !important;
}

/* ===== Tab Focus Animations ===== */
*:focus {
    animation: focusPulse 0.3s ease-out;
}

@keyframes focusPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(220, 38, 38, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
    }
}
