/**
 * Gościniec WCAG Accessibility Styles
 * Zgodność z WCAG 2.1 poziom AA
 */

/* ==========================================================================
   Floating Accessibility Button
   ========================================================================== */
.wcag-trigger-btn {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    z-index: 99999 !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background: #4a3728 !important;
    color: #fff !important;
    border: 3px solid #fff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 28px !important;
    transition: all 0.3s ease;
    padding: 0 !important;
    margin: 0 !important;
    /* Pływająca ikonka - zawsze widoczna */
    position: fixed !important;
    float: none !important;
    clear: none !important;
}

.wcag-trigger-btn:hover,
.wcag-trigger-btn:focus {
    background: #5f4833;
    transform: scale(1.1);
    outline: 3px solid #c9a961;
    outline-offset: 3px;
}

.wcag-trigger-btn:active {
    transform: scale(0.95);
}

.wcag-trigger-btn[aria-expanded="true"] {
    background: #c9a961;
    color: #4a3728;
}

.wcag-icon {
    display: block;
    line-height: 1;
}

/* ==========================================================================
   Accessibility Panel
   ========================================================================== */
.wcag-panel {
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 99998 !important;
    width: 320px;
    max-width: calc(100vw - 60px);
    background: #fff;
    border: 2px solid #4a3728;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.wcag-panel[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.wcag-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 2px solid #e5ded5;
    background: #f9f7f4;
    border-radius: 10px 10px 0 0;
}

.wcag-panel-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #4a3728;
}

.wcag-close-btn {
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #4a3728;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.wcag-close-btn:hover,
.wcag-close-btn:focus {
    background: #e5ded5;
    outline: 2px solid #c9a961;
    outline-offset: 2px;
}

.wcag-panel-body {
    padding: 20px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* ==========================================================================
   Control Groups
   ========================================================================== */
.wcag-control-group {
    margin-bottom: 20px;
}

.wcag-control-group:last-child {
    margin-bottom: 0;
}

.wcag-control-label {
    display: block;
    font-weight: 600;
    color: #4a3728;
    margin-bottom: 10px;
    font-size: 14px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.wcag-btn-group {
    display: flex;
    gap: 8px;
}

.wcag-btn-small {
    flex: 1;
    background: #4a3728;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcag-btn-small:hover,
.wcag-btn-small:focus {
    background: #5f4833;
    outline: 2px solid #c9a961;
    outline-offset: 2px;
    transform: translateY(-2px);
}

.wcag-btn-small:active {
    transform: translateY(0);
}

.wcag-btn-full {
    width: 100%;
    background: #4a3728;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wcag-btn-full:hover,
.wcag-btn-full:focus {
    background: #5f4833;
    outline: 2px solid #c9a961;
    outline-offset: 2px;
    transform: translateY(-2px);
}

.wcag-btn-full:active {
    transform: translateY(0);
}

.wcag-btn-full.active {
    background: #c9a961;
    color: #4a3728;
}

.wcag-btn-reset {
    background: #6c757d;
}

.wcag-btn-reset:hover,
.wcag-btn-reset:focus {
    background: #5a6268;
}

/* ==========================================================================
   Overlay
   ========================================================================== */
.wcag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99997 !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.wcag-overlay[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Skip Link
   ========================================================================== */
.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 999999;
    padding: 1em;
    background: #4a3728;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.skip-link:focus {
    left: 6px;
    top: 7px;
    outline: 3px solid #c9a961;
    outline-offset: 2px;
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */
body.wcag-high-contrast {
    filter: contrast(1.2);
}

body.wcag-high-contrast * {
    border-color: #000 !important;
}

body.wcag-high-contrast a {
    text-decoration: underline !important;
}

body.wcag-high-contrast button,
body.wcag-high-contrast .btn {
    border: 2px solid #000 !important;
}

/* Ensure accessibility button is always visible in high contrast mode */
body.wcag-high-contrast .wcag-trigger-btn {
    background: #000 !important;
    color: #fff !important;
    border: 3px solid #fff !important;
    filter: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

body.wcag-high-contrast .wcag-trigger-btn:hover,
body.wcag-high-contrast .wcag-trigger-btn:focus {
    background: #fff !important;
    color: #000 !important;
    border: 3px solid #000 !important;
    outline: 3px solid #fff !important;
}

body.wcag-high-contrast .wcag-trigger-btn[aria-expanded="true"] {
    background: #fff !important;
    color: #000 !important;
    border: 3px solid #000 !important;
}

body.wcag-high-contrast .wcag-panel {
    border: 3px solid #000 !important;
    background: #fff !important;
    filter: none !important;
}

body.wcag-high-contrast .wcag-panel-header {
    background: #000 !important;
    color: #fff !important;
    border-bottom: 3px solid #000 !important;
}

body.wcag-high-contrast .wcag-panel-title {
    color: #fff !important;
}

body.wcag-high-contrast .wcag-close-btn {
    color: #fff !important;
    border: 2px solid #fff !important;
}

body.wcag-high-contrast .wcag-close-btn:hover,
body.wcag-high-contrast .wcag-close-btn:focus {
    background: #fff !important;
    color: #000 !important;
}

body.wcag-high-contrast .wcag-btn-small,
body.wcag-high-contrast .wcag-btn-full {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #000 !important;
    filter: none !important;
}

body.wcag-high-contrast .wcag-btn-small:hover,
body.wcag-high-contrast .wcag-btn-small:focus,
body.wcag-high-contrast .wcag-btn-full:hover,
body.wcag-high-contrast .wcag-btn-full:focus {
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #000 !important;
    outline: 3px solid #000 !important;
}

body.wcag-high-contrast .wcag-btn-full.active {
    background: #000 !important;
    color: #fff !important;
    border: 3px solid #fff !important;
}

/* ==========================================================================
   Font Size Adjustments
   ========================================================================== */
body.wcag-font-small {
    font-size: 0.875rem;
}

body.wcag-font-normal {
    font-size: 1rem;
}

body.wcag-font-large {
    font-size: 1.125rem;
}

body.wcag-font-xlarge {
    font-size: 1.25rem;
}

body.wcag-font-xxlarge {
    font-size: 1.5rem;
}

/* ==========================================================================
   Keyboard Navigation Indicator
   ========================================================================== */
*:focus {
    outline: 2px solid #c9a961;
    outline-offset: 2px;
}

body.wcag-keyboard-nav *:focus {
    outline: 3px solid #c9a961 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 4px rgba(201, 169, 97, 0.3) !important;
}

/* Remove outline for mouse users, keep for keyboard */
body:not(.wcag-keyboard-nav) *:focus:not(:focus-visible) {
    outline: none;
}

/* ==========================================================================
   Screen Reader Text
   ========================================================================== */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    clip: auto !important;
    height: auto;
    width: auto;
    position: static !important;
}

/* ==========================================================================
   Improved Focus States for Interactive Elements
   ========================================================================== */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
    outline: 2px solid #c9a961;
    outline-offset: 2px;
}

/* ==========================================================================
   Form Labels (WCAG requirement)
   ========================================================================== */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #4a3728;
}

/* Ensure labels are associated with inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    min-height: 44px; /* WCAG: min touch target size */
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .wcag-trigger-btn {
        bottom: 20px !important;
        right: 20px !important;
        width: 56px !important;
        height: 56px !important;
        font-size: 24px !important;
        position: fixed !important;
    }
    
    .wcag-panel {
        bottom: 90px;
        right: 20px;
        width: calc(100vw - 40px);
        max-width: 320px;
    }
    
    .wcag-panel-body {
        padding: 16px;
    }
}

/* ==========================================================================
   Ensure button is always floating and visible
   ========================================================================== */
#wcag-trigger-btn {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    z-index: 99999 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Override any theme styles that might hide it */
body #wcag-trigger-btn,
html #wcag-trigger-btn,
.site #wcag-trigger-btn {
    position: fixed !important;
    float: none !important;
    clear: none !important;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .wcag-toolbar {
        display: none;
    }
}

