/**
 * Slots Gamblers FAQ Accordion Widget Styles
 * 
 * @package    SlotsGamblersFAQAccordion
 * @version    1.0.0
 * @since      1.0.0
 * 
 * BEM Methodology with 'sgfa-' prefix to prevent conflicts
 * All styles are scoped to prevent interference with other Elementor widgets
 */

/* ============================================
   CSS CUSTOM PROPERTIES (THEMING)
   ============================================ */
.sgfa-wrapper {
    /* Colors */
    --sgfa-color-purple: #9333EA;
    --sgfa-color-orange: #FF8C42;
    --sgfa-color-orange-light: #FFF4E6;
    --sgfa-color-green: #10B981;
    --sgfa-color-white: #FFFFFF;
    --sgfa-color-gray-light: #F3F4F6;
    --sgfa-text-primary: #1F2937;
    --sgfa-text-secondary: #4B5563;
    --sgfa-border-color: #E5E7EB;
    --sgfa-border-color-hover: #D0D0D0;
    --sgfa-bg-main: #F9FAFB;
    
    /* Gradients */
    --sgfa-brand-gradient: linear-gradient(135deg, #9333EA 0%, #FF8C42 50%, #10B981 100%);
    
    /* Spacing with clamp for responsive sizing */
    --sgfa-spacing-xs: clamp(0.25rem, 0.3vw, 0.5rem);
    --sgfa-spacing-sm: clamp(0.5rem, 0.6vw, 0.75rem);
    --sgfa-spacing-md: clamp(0.75rem, 0.9vw, 1rem);
    --sgfa-spacing-lg: clamp(1rem, 1.2vw, 1.5rem);
    --sgfa-spacing-xl: clamp(1.25rem, 1.5vw, 2rem);
    --sgfa-spacing-2xl: clamp(1.5rem, 2vw, 3rem);
    
    /* Border Radius */
    --sgfa-radius-sm: clamp(0.375rem, 0.5vw, 0.5rem);
    --sgfa-radius-md: clamp(0.5rem, 0.6vw, 0.75rem);
    --sgfa-radius-lg: clamp(0.75rem, 0.9vw, 1rem);
    --sgfa-radius-xl: clamp(1rem, 1.2vw, 1.5rem);
    --sgfa-radius-full: 6.25rem;
    
    /* Transitions */
    --sgfa-transition-base: all 0.3s ease;
    --sgfa-transition-fast: all 0.15s ease;
    
    /* Shadows */
    --sgfa-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.05);
    --sgfa-shadow-md: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
    --sgfa-shadow-lg: 0 0.375rem 1rem rgba(0, 0, 0, 0.12);
    --sgfa-shadow-xl: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
}

/* ============================================
   WRAPPER & MAIN CONTAINER
   ============================================ */
.sgfa-wrapper {
    width: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--sgfa-text-primary);
    position: relative;
    box-sizing: border-box;
}

.sgfa-wrapper *,
.sgfa-wrapper *::before,
.sgfa-wrapper *::after {
    box-sizing: border-box;
}

/* ============================================
   MOBILE FULL WIDTH TECHNIQUE
   Edge-to-edge layout breaking out of containers
   ============================================ */
@media (max-width: 768px) {
    .sgfa-wrapper.sgfa-mobile-fullwidth {
        width: 100vw !important;
        max-width: 100vw !important;
        margin-left: calc(-50vw + 50%) !important;
        margin-right: calc(-50vw + 50%) !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        position: relative;
        left: 0;
        right: 0;
    }
    
    .sgfa-wrapper.sgfa-mobile-fullwidth .sgfa-faq-section {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }
}

/* ============================================
   32" DISPLAY OPTIMIZATION
   Full container width utilization
   ============================================ */
@media (min-width: 2560px) {
    .sgfa-wrapper {
        max-width: 100%;
    }
    
    .sgfa-faq-section {
        max-width: 100%;
    }
    
    .sgfa-faq-grid {
        gap: clamp(1.5rem, 2vw, 2.5rem);
    }
}

/* ============================================
   SECTION HEADER
   ============================================ */
.sgfa-section-header {
    margin-bottom: var(--sgfa-spacing-xl);
}

.sgfa-section-tag {
    display: inline-block;
    background: var(--sgfa-color-orange-light);
    color: var(--sgfa-color-orange);
    padding: 0.375rem 0.875rem;
    border-radius: var(--sgfa-radius-full);
    font-size: clamp(0.75rem, 0.8vw, 0.8125rem);
    font-weight: 600;
    margin-bottom: var(--sgfa-spacing-sm);
    border: 0.0625rem solid var(--sgfa-color-orange);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: var(--sgfa-transition-base);
}

.sgfa-section-tag:hover {
    transform: translateY(-0.0625rem);
    box-shadow: var(--sgfa-shadow-sm);
}

.sgfa-section-title {
    font-size: clamp(1.25rem, 1.5vw + 0.5rem, 2rem);
    font-weight: 800;
    margin: 0 0 var(--sgfa-spacing-sm) 0;
    color: var(--sgfa-text-primary);
    line-height: 1.2;
}

.sgfa-section-description {
    font-size: clamp(0.875rem, 0.9vw + 0.3rem, 1.0625rem);
    color: var(--sgfa-text-secondary);
    line-height: 1.6;
    max-width: 50rem;
    margin: 0;
}

/* ============================================
   FAQ SECTION CONTAINER
   ============================================ */
.sgfa-faq-section {
    background: var(--sgfa-color-white);
    border: 0.0625rem solid #E0E0E0;
    border-radius: var(--sgfa-radius-xl);
    padding: var(--sgfa-spacing-xl);
    box-shadow: var(--sgfa-shadow-md);
    transition: var(--sgfa-transition-base);
}

.sgfa-faq-section:hover {
    box-shadow: var(--sgfa-shadow-lg);
    border-color: var(--sgfa-border-color-hover);
}

/* ============================================
   FAQ GRID LAYOUT
   ============================================ */
.sgfa-faq-grid {
    display: grid;
    gap: var(--sgfa-spacing-lg);
    margin-top: var(--sgfa-spacing-lg);
}

/* Desktop - 2 columns default */
.sgfa-faq-grid[data-columns-desktop="1"] {
    grid-template-columns: 1fr;
}

.sgfa-faq-grid[data-columns-desktop="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.sgfa-faq-grid[data-columns-desktop="3"] {
    grid-template-columns: repeat(3, 1fr);
}

/* ============================================
   FAQ ITEM STYLING
   ============================================ */
.sgfa-faq-item {
    background: var(--sgfa-color-gray-light);
    border: 0.125rem solid var(--sgfa-border-color);
    border-radius: var(--sgfa-radius-lg);
    transition: var(--sgfa-transition-base);
    position: relative;
    overflow: hidden;
}

/* Gradient accent bar on hover */
.sgfa-faq-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0.25rem;
    height: 100%;
    background: var(--sgfa-brand-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sgfa-faq-item:hover {
    transform: translateY(-0.125rem);
    box-shadow: var(--sgfa-shadow-xl);
    border-color: var(--sgfa-color-purple);
}

.sgfa-faq-item:hover::before {
    opacity: 1;
}

/* ============================================
   ACCORDION FUNCTIONALITY
   ============================================ */
.sgfa-faq-item.sgfa-accordion {
    cursor: pointer;
    padding: var(--sgfa-spacing-md);
}

.sgfa-faq-question {
    display: flex;
    align-items: flex-start;
    gap: var(--sgfa-spacing-sm);
    margin-bottom: 0;
}

/* FAQ Icon Styling */
.sgfa-faq-icon {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.sgfa-faq-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.sgfa-faq-item:hover .sgfa-faq-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Question Header Container */
.sgfa-faq-question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: var(--sgfa-spacing-sm);
}

/* Question Text */
.sgfa-faq-question-text {
    font-size: clamp(0.9375rem, 0.95vw + 0.3rem, 1.0625rem);
    font-weight: 700;
    color: var(--sgfa-text-primary);
    line-height: 1.4;
    margin: 0;
    flex: 1;
}

/* Toggle Arrow */
.sgfa-faq-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    flex-shrink: 0;
    color: var(--sgfa-color-purple);
    font-weight: 700;
    transition: transform 0.3s ease;
    width: 1.25rem;
    height: 1.25rem;
}

.sgfa-faq-toggle svg {
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
}

.sgfa-faq-item.sgfa-accordion.sgfa-open .sgfa-faq-toggle svg {
    transform: rotate(180deg);
}

/* Answer Section */
.sgfa-faq-answer {
    max-height: 0;
    overflow: hidden;
    padding-left: 0;
    opacity: 0;
    transition: all 0.3s ease;
    font-size: clamp(0.8125rem, 0.85vw + 0.2rem, 0.9375rem);
    color: var(--sgfa-text-secondary);
    line-height: 1.6;
}

.sgfa-faq-answer p {
    margin: 0;
}

.sgfa-faq-item.sgfa-accordion.sgfa-open .sgfa-faq-answer {
    max-height: 31.25rem;
    padding-left: calc(1.5rem + var(--sgfa-spacing-sm));
    margin-top: var(--sgfa-spacing-sm);
    opacity: 1;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet Portrait and Below (1024px) */
@media (max-width: 1024px) {
    .sgfa-faq-grid[data-columns-desktop="2"],
    .sgfa-faq-grid[data-columns-desktop="3"] {
        grid-template-columns: 1fr;
    }
    
    .sgfa-faq-grid[data-columns-tablet="2"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet (768px - 1024px) */
@media (max-width: 768px) {
    .sgfa-faq-section {
        padding: var(--sgfa-spacing-md);
    }
    
    .sgfa-faq-item.sgfa-accordion {
        padding: var(--sgfa-spacing-sm);
    }
    
    .sgfa-section-title {
        font-size: clamp(1.125rem, 4vw, 1.5rem);
    }
    
    .sgfa-section-description {
        font-size: clamp(0.8125rem, 3vw, 0.9375rem);
    }
}

/* Mobile Landscape and Below (640px) */
@media (max-width: 640px) {
    .sgfa-faq-grid {
        grid-template-columns: 1fr !important;
        gap: var(--sgfa-spacing-md);
    }
    
    .sgfa-faq-question-text {
        font-size: clamp(0.875rem, 3.5vw, 1rem);
    }
    
    .sgfa-faq-answer {
        font-size: clamp(0.8125rem, 3vw, 0.875rem);
    }
    
    .sgfa-faq-item.sgfa-accordion.sgfa-open .sgfa-faq-answer {
        padding-left: 0;
        margin-top: var(--sgfa-spacing-sm);
    }
    
    .sgfa-section-header {
        margin-bottom: var(--sgfa-spacing-md);
    }
}

/* Mobile Portrait (480px and below) */
@media (max-width: 480px) {
    .sgfa-faq-section {
        padding: var(--sgfa-spacing-sm);
    }
    
    .sgfa-section-tag {
        font-size: 0.6875rem;
        padding: 0.25rem 0.625rem;
    }
    
    .sgfa-faq-icon {
        width: 1.25rem;
        height: 1.25rem;
    }
}

/* Small Mobile (320px) */
@media (max-width: 320px) {
    .sgfa-faq-item.sgfa-accordion {
        padding: 0.625rem;
    }
    
    .sgfa-faq-question {
        gap: 0.375rem;
    }
}

/* ============================================
   LARGE DESKTOP OPTIMIZATION (1920px+)
   ============================================ */
@media (min-width: 1920px) {
    .sgfa-wrapper {
        max-width: 100%;
    }
    
    .sgfa-faq-section {
        padding: var(--sgfa-spacing-2xl);
    }
    
    .sgfa-section-title {
        font-size: clamp(1.75rem, 2vw, 2.25rem);
    }
    
    .sgfa-section-description {
        font-size: clamp(1rem, 1.1vw, 1.125rem);
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */
.sgfa-faq-item.sgfa-accordion:focus {
    outline: 0.125rem solid var(--sgfa-color-purple);
    outline-offset: 0.125rem;
}

.sgfa-faq-item.sgfa-accordion:focus-visible {
    outline: 0.125rem solid var(--sgfa-color-purple);
    outline-offset: 0.125rem;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .sgfa-wrapper *,
    .sgfa-wrapper *::before,
    .sgfa-wrapper *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sgfa-faq-item.sgfa-accordion {
        cursor: default;
    }
    
    .sgfa-faq-answer {
        max-height: none !important;
        opacity: 1 !important;
        padding-left: 0 !important;
    }
    
    .sgfa-faq-toggle {
        display: none;
    }
    
    .sgfa-faq-section {
        box-shadow: none;
        border: 0.0625rem solid #000;
    }
}

/* ============================================
   ELEMENTOR EDITOR COMPATIBILITY
   ============================================ */
.elementor-editor-active .sgfa-wrapper {
    pointer-events: auto;
}

.elementor-editor-active .sgfa-faq-item.sgfa-accordion {
    pointer-events: auto;
}

/* Ensure proper display in Elementor preview */
.elementor-widget-slotsgamblersfaqaccordion {
    width: 100%;
}

/* ============================================
   RTL (Right-to-Left) SUPPORT
   ============================================ */
.rtl .sgfa-faq-question {
    flex-direction: row-reverse;
}

.rtl .sgfa-faq-question-header {
    flex-direction: row-reverse;
}

.rtl .sgfa-faq-toggle {
    margin-left: 0;
    margin-right: auto;
}

.rtl .sgfa-faq-item::before {
    left: auto;
    right: 0;
}

.rtl .sgfa-faq-item.sgfa-accordion.sgfa-open .sgfa-faq-answer {
    padding-left: 0;
    padding-right: calc(1.5rem + var(--sgfa-spacing-sm));
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */
@media (prefers-contrast: high) {
    .sgfa-faq-section {
        border-width: 0.125rem;
    }
    
    .sgfa-faq-item {
        border-width: 0.1875rem;
    }
    
    .sgfa-section-tag {
        border-width: 0.125rem;
    }
}

/* ============================================
   LOADING STATE (OPTIONAL)
   ============================================ */
.sgfa-wrapper.sgfa-loading {
    opacity: 0.6;
    pointer-events: none;
}

.sgfa-wrapper.sgfa-loading .sgfa-faq-item {
    animation: sgfa-pulse 1.5s ease-in-out infinite;
}

@keyframes sgfa-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

