/**
 * Sandston Automotive FAQ - Frontend Styles
 * Designed to match the hero aesthetic of Sandston Automotive
 */

/* CSS Variables - defaults, overridden by plugin settings */
.sa-faq-container {
    --sa-faq-accent: #e63946;
    --sa-faq-dark: #1a1a2e;
    --sa-faq-darker: #16213e;
    --sa-faq-light: #ffffff;
    --sa-faq-gray: #f8f9fa;
    --sa-faq-text: #333333;
    --sa-faq-text-light: #6c757d;
    --sa-faq-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --sa-faq-radius: 8px;
    --sa-faq-transition: 0.3s ease;
}

/* Container */
.sa-faq-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Hero Section */
.sa-faq-hero {
    background: linear-gradient(135deg, var(--sa-faq-dark) 0%, var(--sa-faq-darker) 100%);
    color: var(--sa-faq-light);
    padding: 0;
    margin: 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 350px;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    /* Full width overrides */
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    margin-bottom: 40px;
}

/* Hero with background image */
.sa-faq-hero.has-image {
    background-color: transparent;
}

/* Hero content wrapper */
.sa-faq-hero-content {
    position: relative;
    z-index: 2;
    padding: 40px;
    width: 100%;
}

/* Overlay Styles */

/* Dark overlay - default for images */
.sa-faq-hero.overlay-dark::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.sa-faq-hero.overlay-dark .sa-faq-hero-title,
.sa-faq-hero.overlay-dark .sa-faq-hero-subtitle {
    color: #ffffff;
}

/* Light overlay */
.sa-faq-hero.overlay-light::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 1;
}

.sa-faq-hero.overlay-light .sa-faq-hero-title,
.sa-faq-hero.overlay-light .sa-faq-hero-subtitle {
    color: #1a1a2e;
}

/* No overlay - text shadow for readability */
.sa-faq-hero.overlay-none .sa-faq-hero-title {
    color: #ffffff;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8),
                 0 0 20px rgba(0, 0, 0, 0.6);
}

.sa-faq-hero.overlay-none .sa-faq-hero-subtitle {
    color: #ffffff;
    text-shadow: 1px 1px 6px rgba(0, 0, 0, 0.8);
}

/* Banner style - text on dark band */
.sa-faq-hero.overlay-banner .sa-faq-hero-content {
    background: rgba(26, 26, 46, 0.85);
    padding: 30px 60px;
    border-radius: 8px;
    max-width: 80%;
    margin: 0 auto;
}

.sa-faq-hero.overlay-banner .sa-faq-hero-title,
.sa-faq-hero.overlay-banner .sa-faq-hero-subtitle {
    color: #ffffff;
}

/* Pattern overlay for non-image heroes */
.sa-faq-hero:not(.has-image)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
    z-index: 1;
}

/* Image-only hero (no text) - no overlays needed */
.sa-faq-hero.no-text::before {
    display: none;
}

.sa-faq-hero.no-text.overlay-dark::before,
.sa-faq-hero.no-text.overlay-light::before {
    display: none;
}

.sa-faq-hero-title {
    font-size: 2.8rem;
    font-weight: 700;
    margin: 0 0 15px;
    position: relative;
    z-index: 2;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sa-faq-hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin: 0;
    position: relative;
    z-index: 2;
    font-weight: 400;
}

/* Category Groups */
.sa-faq-category-group {
    margin-bottom: 40px;
}

.sa-faq-category-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--sa-faq-dark);
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--sa-faq-accent);
    display: inline-block;
}

/* Accordion Container */
.sa-faq-accordion {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* FAQ Item */
.sa-faq-item {
    background: var(--sa-faq-light);
    border-radius: var(--sa-faq-radius);
    box-shadow: var(--sa-faq-shadow);
    overflow: hidden;
    transition: box-shadow var(--sa-faq-transition);
}

.sa-faq-item:hover {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

/* Question Button */
.sa-faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--sa-faq-text);
    transition: all var(--sa-faq-transition);
    gap: 20px;
}

.sa-faq-question:hover {
    background: var(--sa-faq-gray);
}

.sa-faq-question:focus {
    outline: none;
    background: var(--sa-faq-gray);
}

.sa-faq-question:focus-visible {
    outline: 2px solid var(--sa-faq-accent);
    outline-offset: -2px;
}

.sa-faq-item.active .sa-faq-question {
    background: var(--sa-faq-dark);
    color: var(--sa-faq-light);
}

.sa-faq-question-text {
    flex: 1;
}

/* Icon Styles */
.sa-faq-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform var(--sa-faq-transition);
}

/* Plus/Minus Icon (default) */
[data-icon-style="plus"] .sa-faq-icon::before,
[data-icon-style="plus"] .sa-faq-icon::after {
    content: '';
    position: absolute;
    background: currentColor;
    transition: transform var(--sa-faq-transition);
}

[data-icon-style="plus"] .sa-faq-icon::before {
    width: 16px;
    height: 2px;
}

[data-icon-style="plus"] .sa-faq-icon::after {
    width: 2px;
    height: 16px;
}

[data-icon-style="plus"] .sa-faq-item.active .sa-faq-icon::after {
    transform: rotate(90deg);
}

/* Chevron Icon */
[data-icon-style="chevron"] .sa-faq-icon::before {
    content: '›';
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    transition: transform var(--sa-faq-transition);
}

[data-icon-style="chevron"] .sa-faq-item.active .sa-faq-icon::before {
    transform: rotate(90deg);
}

/* Caret Icon */
[data-icon-style="caret"] .sa-faq-icon::before {
    content: '▼';
    font-size: 12px;
    transition: transform var(--sa-faq-transition);
}

[data-icon-style="caret"] .sa-faq-item.active .sa-faq-icon::before {
    transform: rotate(180deg);
}

/* Answer Section */
.sa-faq-answer {
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.sa-faq-answer[hidden] {
    display: block;
    max-height: 0;
}

.sa-faq-answer:not([hidden]) {
    max-height: 2000px;
}

.sa-faq-answer-content {
    padding: 0 25px 25px;
    color: var(--sa-faq-text);
    line-height: 1.7;
}

.sa-faq-answer-content p:first-child {
    margin-top: 0;
}

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

.sa-faq-answer-content a {
    color: var(--sa-faq-accent);
    text-decoration: none;
    font-weight: 500;
}

.sa-faq-answer-content a:hover {
    text-decoration: underline;
}

.sa-faq-answer-content ul,
.sa-faq-answer-content ol {
    margin: 15px 0;
    padding-left: 25px;
}

.sa-faq-answer-content li {
    margin: 8px 0;
}

.sa-faq-answer-content strong {
    color: var(--sa-faq-dark);
}

/* Empty State */
.sa-faq-empty {
    text-align: center;
    padding: 40px;
    color: var(--sa-faq-text-light);
    font-size: 1.1rem;
}

/* Active State Border Accent */
.sa-faq-item.active {
    border-left: 4px solid var(--sa-faq-accent);
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .sa-faq-hero {
        min-height: 250px;
        margin-bottom: 30px;
    }
    
    .sa-faq-hero-content {
        padding: 30px 20px;
    }
    
    .sa-faq-hero-title {
        font-size: 1.8rem;
    }
    
    .sa-faq-hero-subtitle {
        font-size: 1rem;
    }
    
    .sa-faq-hero.overlay-banner .sa-faq-hero-content {
        padding: 20px 30px;
        max-width: 90%;
    }
    
    .sa-faq-question {
        padding: 16px 18px;
        font-size: 0.95rem;
        gap: 15px;
    }
    
    .sa-faq-answer-content {
        padding: 0 18px 18px;
        font-size: 0.95rem;
    }
    
    .sa-faq-category-title {
        font-size: 1.2rem;
    }
}

@media screen and (max-width: 480px) {
    .sa-faq-container {
        padding: 0 15px;
    }
    
    .sa-faq-hero {
        min-height: 200px;
        margin-bottom: 25px;
    }
    
    .sa-faq-hero-content {
        padding: 25px 15px;
    }
    
    .sa-faq-hero-title {
        font-size: 1.5rem;
    }
    
    .sa-faq-hero.overlay-banner .sa-faq-hero-content {
        padding: 15px 20px;
        max-width: 95%;
        border-radius: 6px;
    }
    
    .sa-faq-question {
        padding: 14px 15px;
        font-size: 0.9rem;
    }
    
    .sa-faq-answer-content {
        padding: 0 15px 15px;
    }
}

/* Print Styles */
@media print {
    .sa-faq-hero {
        background: var(--sa-faq-dark);
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .sa-faq-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .sa-faq-answer[hidden] {
        display: block;
        max-height: none;
    }
    
    .sa-faq-icon {
        display: none;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .sa-faq-item,
    .sa-faq-question,
    .sa-faq-answer,
    .sa-faq-icon,
    .sa-faq-icon::before,
    .sa-faq-icon::after {
        transition: none;
    }
}
