/**
 * HTSB FAQ Plugin - Frontend Styles
 * 
 * Optimiert für:
 * - Responsive Design
 * - WCAG 2.1 Level AA Accessibility
 * - Moderne Browser
 * - SEO-freundliche Struktur
 */

/* ========================================
   Container & Layout
   ======================================== */

.htsb-faq-container {
    max-width: 100%;
    margin: 2rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

.htsb-faq-no-results {
    padding: 2rem;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
    color: #6c757d;
}

/* ========================================
   Kategorie-Sektionen
   ======================================== */

.htsb-faq-category-section {
    margin-bottom: 3rem;
}

.htsb-faq-category-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #003d5c;
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid #0077b6;
}

.htsb-faq-category-description {
    color: #6c757d;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* ========================================
   FAQ Items
   ======================================== */

.htsb-faq-item {
    background: #ffffff;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    overflow: hidden;
}

.htsb-faq-item:hover {
    box-shadow: 0 4px 12px rgba(0, 61, 92, 0.1);
    border-color: #0077b6;
}

.htsb-faq-item:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.2);
    outline: none;
}

/* Hervorgehobene FAQs */
.htsb-faq-item.htsb-faq-featured {
    border-left: 4px solid #0077b6;
    background: linear-gradient(to right, rgba(0, 119, 182, 0.02), #ffffff);
}

/* ========================================
   Frage/Question
   ======================================== */

.htsb-faq-question {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #003d5c;
    line-height: 1.4;
}

/* Einfacher Listen-Modus */
.htsb-faq-list .htsb-faq-question {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e6ed;
}

/* Accordion-Modus */
.htsb-faq-accordion .htsb-faq-question {
    padding: 0;
}

/* ========================================
   Accordion Toggle Button
   ======================================== */

.htsb-faq-toggle {
    width: 100%;
    padding: 1.5rem;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #003d5c;
    transition: all 0.2s ease;
    position: relative;
}

.htsb-faq-toggle:hover {
    background: rgba(0, 119, 182, 0.05);
    color: #0077b6;
}

.htsb-faq-toggle:focus {
    outline: 2px solid #0077b6;
    outline-offset: -2px;
    background: rgba(0, 119, 182, 0.05);
}

.htsb-faq-toggle[aria-expanded="true"] {
    background: rgba(0, 119, 182, 0.08);
    color: #0077b6;
}

/* Icon für Accordion */
.htsb-faq-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    position: relative;
    transition: transform 0.3s ease;
}

.htsb-faq-icon::before,
.htsb-faq-icon::after {
    content: '';
    position: absolute;
    background: currentColor;
    border-radius: 2px;
}

/* Horizontale Linie */
.htsb-faq-icon::before {
    width: 16px;
    height: 2px;
    top: 11px;
    left: 4px;
}

/* Vertikale Linie */
.htsb-faq-icon::after {
    width: 2px;
    height: 16px;
    top: 4px;
    left: 11px;
    transition: transform 0.3s ease;
}

/* Icon im geöffneten Zustand (nur horizontale Linie) */
.htsb-faq-toggle[aria-expanded="true"] .htsb-faq-icon::after {
    transform: rotate(90deg);
    opacity: 0;
}

/* ========================================
   Antwort/Answer
   ======================================== */

.htsb-faq-answer {
    overflow: hidden;
}

/* Accordion-Modus - versteckt */
.htsb-faq-accordion .htsb-faq-answer[hidden] {
    display: none;
}

/* Accordion-Modus - sichtbar */
.htsb-faq-accordion .htsb-faq-answer:not([hidden]) {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.htsb-faq-answer-content {
    padding: 1.5rem;
    color: #333;
    font-size: 1rem;
    line-height: 1.7;
}

.htsb-faq-answer-content p {
    margin-bottom: 1rem;
}

.htsb-faq-answer-content p:last-child {
    margin-bottom: 0;
}

.htsb-faq-answer-content ul,
.htsb-faq-answer-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.htsb-faq-answer-content li {
    margin-bottom: 0.5rem;
}

.htsb-faq-answer-content a {
    color: #0077b6;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.htsb-faq-answer-content a:hover {
    color: #005a8d;
}

.htsb-faq-answer-content a:focus {
    outline: 2px solid #0077b6;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ========================================
   Meta-Informationen & Permalink
   ======================================== */

.htsb-faq-meta {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid #e0e6ed;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
}

.htsb-faq-permalink {
    font-size: 0.875rem;
    color: #6c757d;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.2s ease;
}

.htsb-faq-permalink:hover {
    color: #0077b6;
}

.htsb-faq-permalink:focus {
    outline: 2px solid #0077b6;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ========================================
   Responsive Design
   ======================================== */

@media screen and (max-width: 768px) {
    .htsb-faq-category-title {
        font-size: 1.5rem;
    }
    
    .htsb-faq-question {
        font-size: 1.125rem;
    }
    
    .htsb-faq-toggle {
        font-size: 1.125rem;
        padding: 1.25rem 1rem;
    }
    
    .htsb-faq-answer-content {
        padding: 1.25rem 1rem;
    }
    
    .htsb-faq-meta {
        padding: 0.625rem 1rem;
    }
}

@media screen and (max-width: 480px) {
    .htsb-faq-category-title {
        font-size: 1.25rem;
    }
    
    .htsb-faq-question {
        font-size: 1rem;
    }
    
    .htsb-faq-toggle {
        font-size: 1rem;
        padding: 1rem 0.75rem;
        gap: 0.75rem;
    }
    
    .htsb-faq-answer-content {
        padding: 1rem 0.75rem;
        font-size: 0.9375rem;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .htsb-faq-item {
        page-break-inside: avoid;
        border: 1px solid #000;
        box-shadow: none;
    }
    
    .htsb-faq-toggle {
        background: none;
        border-bottom: 1px solid #000;
    }
    
    .htsb-faq-answer[hidden] {
        display: block !important;
    }
    
    .htsb-faq-icon {
        display: none;
    }
    
    .htsb-faq-permalink {
        display: none;
    }
}

/* ========================================
   High Contrast Mode (Windows)
   ======================================== */

@media (prefers-contrast: high) {
    .htsb-faq-item {
        border-width: 2px;
    }
    
    .htsb-faq-toggle:focus {
        outline-width: 3px;
    }
}

/* ========================================
   Reduced Motion Preference
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .htsb-faq-item,
    .htsb-faq-toggle,
    .htsb-faq-icon,
    .htsb-faq-icon::after,
    .htsb-faq-permalink {
        transition: none;
    }
    
    .htsb-faq-accordion .htsb-faq-answer:not([hidden]) {
        animation: none;
    }
}

/* ========================================
   Dark Mode Support (optional)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .htsb-faq-item {
        background: #1a1a1a;
        border-color: #333;
        color: #e0e0e0;
    }
    
    .htsb-faq-question,
    .htsb-faq-toggle {
        color: #e0e0e0;
    }
    
    .htsb-faq-toggle:hover {
        background: rgba(255, 255, 255, 0.05);
    }
    
    .htsb-faq-answer-content {
        color: #d0d0d0;
    }
    
    .htsb-faq-meta {
        background: #222;
        border-top-color: #333;
    }
    
    .htsb-faq-category-title {
        color: #4d9fd6;
    }
}
