/* Accessibility Styles for Penzion Růže */

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100000;
    border-radius: 0 0 4px 0;
    font-weight: bold;
}

.skip-link:focus {
    top: 0;
}

/* Bootstrap visually-hidden-focusable class */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Enhanced focus styles for keyboard navigation */
*:focus {
    outline: 3px solid #bc4749 !important;
    outline-offset: 2px !important;
}

a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid #bc4749 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 3px rgba(188, 71, 73, 0.3) !important;
}

/* Skip link styles for better visibility */
.skip-link:focus {
    outline: 3px solid #fff !important;
    outline-offset: 2px !important;
}

/* Focus for navigation items */
.nav-link:focus,
.navbar-brand:focus {
    outline: 3px solid #bc4749 !important;
    outline-offset: 2px !important;
}

/* Focus for buttons */
.btn:focus {
    outline: 3px solid #000 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px rgba(188, 71, 73, 0.4) !important;
}

/* Focus for form controls */
.form-control:focus,
.form-select:focus {
    border-color: #bc4749 !important;
    box-shadow: 0 0 0 0.25rem rgba(188, 71, 73, 0.25) !important;
    outline: 2px solid #bc4749 !important;
    outline-offset: 1px !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    * {
        border-color: currentColor !important;
    }

    *:focus {
        outline: 4px solid currentColor !important;
        outline-offset: 3px !important;
    }
}

/* 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;
        scroll-behavior: auto !important;
    }

    .wow {
        animation-name: none !important;
    }
}

/* Screen reader only text */
.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;
}

/* Ensure sufficient color contrast for links */
a {
    text-decoration-skip-ink: auto;
}

/* Focus visible for better keyboard navigation */
.nav-link:focus-visible,
.btn:focus-visible,
a:focus-visible {
    outline: 3px solid #bc4749;
    outline-offset: 2px;
}

/* Better link distinction for screen readers */
a[target="_blank"]::after {
    content: " (otevře se v novém okně)";
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Remove focus outline from mouse clicks, keep for keyboard */
*:focus:not(:focus-visible) {
    outline: none !important;
    box-shadow: none !important;
}

*:focus-visible {
    outline: 3px solid #bc4749 !important;
    outline-offset: 2px !important;
}

/* Ensure images don't overflow and maintain aspect ratio */
img {
    max-width: 100%;
    height: auto;
}

/* Better table accessibility */
table {
    border-collapse: collapse;
}

th {
    text-align: left;
}

/* Form validation feedback */
.form-control:invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.form-control:valid:focus {
    border-color: #198754;
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}

/* Ensure sufficient touch target size (min 44x44px) */
@media (max-width: 768px) {
    a,
    button,
    input[type="submit"],
    input[type="button"],
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }
}

/* Focusable sections styling */
.focusable-section {
    scroll-margin-top: 120px; /* Offset for sticky header */
    position: relative;
    transition: all 0.3s ease;
}

.focusable-section:focus {
    outline: 4px solid #bc4749;
    outline-offset: -4px;
    background-color: rgba(188, 71, 73, 0.02);
}

.focusable-section.section-focused {
    box-shadow: 0 0 0 4px rgba(188, 71, 73, 0.2);
    background-color: rgba(188, 71, 73, 0.02);
}

/* Skip links container */
.skip-links {
    position: relative;
    z-index: 100000;
}

.skip-links .skip-link {
    position: absolute;
    top: -50px;
    left: 10px;
    background: #000;
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    z-index: 100000;
    border-radius: 0 0 4px 4px;
    font-weight: bold;
    font-size: 16px;
    transition: top 0.3s ease;
}

.skip-links .skip-link:focus {
    top: 0;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.skip-links .skip-link:nth-child(2):focus {
    left: 220px;
}

.skip-links .skip-link:nth-child(3):focus {
    left: 430px;
}

.skip-links .skip-link:nth-child(4):focus {
    left: 640px;
}

.skip-links .skip-link:nth-child(5):focus {
    left: 820px;
}

/* Keyboard help button */
.keyboard-help-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #bc4749;
    color: #fff;
    border: none;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    transition: all 0.3s ease;
}

.keyboard-help-button::after {
    content: 'K';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #803637;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    font-weight: bold;
}

.keyboard-help-button:hover,
.keyboard-help-button:focus {
    background: #803637;
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.keyboard-help-button:focus {
    outline: 3px solid #000;
    outline-offset: 3px;
}

/* Keyboard help panel */
.keyboard-help-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.keyboard-help-panel[aria-hidden="false"],
.keyboard-help-panel.visible {
    display: flex;
}

.keyboard-help-content {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.keyboard-help-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #bc4749;
    font-size: 24px;
}

.keyboard-help-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #666;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.keyboard-help-close:hover,
.keyboard-help-close:focus {
    background: #f0f0f0;
    color: #bc4749;
}

.keyboard-help-content dl {
    margin: 0;
}

.keyboard-help-content dt {
    font-weight: bold;
    margin-top: 15px;
    color: #333;
}

.keyboard-help-content dt:first-child {
    margin-top: 0;
}

.keyboard-help-content dd {
    margin-left: 0;
    margin-bottom: 10px;
    color: #666;
    padding-left: 20px;
}

.keyboard-help-content kbd {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    line-height: 14px;
    color: #333;
    vertical-align: middle;
    background-color: #fafbfc;
    border: solid 1px #d1d5da;
    border-bottom-color: #c6cbd1;
    border-radius: 3px;
    box-shadow: inset 0 -1px 0 #c6cbd1;
    font-family: monospace;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .keyboard-help-button {
        bottom: 80px;
        left: 10px;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .keyboard-help-button::after {
        width: 20px;
        height: 20px;
        font-size: 10px;
        top: -6px;
        right: -6px;
    }

    .keyboard-help-content {
        padding: 20px;
        margin: 10px;
    }

    .keyboard-help-content h2 {
        font-size: 20px;
        padding-right: 30px;
    }

    .skip-links .skip-link:nth-child(n+2):focus {
        left: 10px;
        top: calc(0px + (var(--nth-child) * 50px));
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .focusable-section,
    .keyboard-help-button,
    .skip-link {
        transition: none !important;
    }
}

/* Print styles for accessibility */
@media print {
    .skip-link,
    .skip-links,
    .back-to-top,
    .keyboard-help-button,
    .keyboard-help-panel,
    nav,
    .navbar,
    footer {
        display: none !important;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }
}
