/**
 * File: /assets/css/components.css
 * Description: Scoped styling for Forms, Accordion FAQs, Sliders, and Loaders.
 * Dependency: Global CSS variables must be loaded from style.css first.
 */

/* ==========================================================================
   1. FORMS & INPUTS (Light Mode Architecture)
   ========================================================================== */
.light-mode-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.form-group label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Universal Input Reset */
.light-mode-form input,
.light-mode-form select,
.light-mode-form textarea {
    width: 100%;
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-medium);
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    border-radius: 8px;
    outline: none;
    transition: border-color var(--transition-speed) ease, 
                box-shadow var(--transition-speed) ease,
                background-color var(--transition-speed) ease;
}

/* Focus Physics */
.light-mode-form input:focus,
.light-mode-form select:focus,
.light-mode-form textarea:focus {
    border-color: var(--accent-cyan);
    background: var(--bg-main);
    box-shadow: 0 0 0 4px rgba(0, 210, 255, 0.1);
}

/* Custom Select Arrow Dropdown */
.light-mode-form select {
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="%23495057" stroke-width="2" xmlns="http://www.w3.org/2000/svg"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    cursor: pointer;
}

/* Validation States */
.light-mode-form input:user-invalid {
    border-color: #ff4b4b;
}

/* ==========================================================================
   2. ACCORDION FAQs
   ========================================================================== */
.faq-accordion {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.faq-item:hover {
    border-color: var(--border-medium);
}

/* The Clickable Question Row */
.faq-question {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    transition: color var(--transition-speed) ease;
}

.faq-question:hover {
    color: var(--accent-cyan);
}

/* The Animated Plus/Minus Icon */
.faq-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    position: relative;
    margin-left: 16px;
}

.faq-icon::before,
.faq-icon::after {
    content: '';
    position: absolute;
    background-color: var(--text-primary);
    transition: transform var(--transition-speed) var(--transition-curve),
                background-color var(--transition-speed) ease;
}

/* Horizontal Line */
.faq-icon::before { top: 11px; left: 0; width: 100%; height: 2px; }
/* Vertical Line */
.faq-icon::after { top: 0; left: 11px; width: 2px; height: 100%; }

/* The Expanding Answer Container */
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--transition-curve), padding 0.4s var(--transition-curve);
    background: var(--bg-surface-alt);
}

.faq-answer-inner {
    padding: 0 24px 24px 24px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}

/* Active State Physics */
.faq-item.is-active .faq-question {
    color: var(--accent-cyan);
}

.faq-item.is-active .faq-icon::before,
.faq-item.is-active .faq-icon::after {
    background-color: var(--accent-cyan);
}

.faq-item.is-active .faq-icon::after {
    transform: rotate(90deg); /* Turns the Plus into a Minus */
}

/* ==========================================================================
   3. PACKAGE GRID & SLIDERS
   ========================================================================== */

/* The Grid (Desktop) */
.dna-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    width: 100%;
    margin-top: 30px;
}

/* The Slider (Mobile Only) */
@media (max-width: 991px) {
    .dna-plans-track {
        display: flex;
        gap: 20px;
        overflow-x: auto;
        padding-bottom: 20px;
        scroll-snap-type: x mandatory;
    }
    
    .dna-plans-track > .dna-plan-card {
        flex: 0 0 85%; /* Shows a peek of the next card */
        scroll-snap-align: start;
        margin: 0;
    }
}

/* Constrain the Card width so it never stretches to fill a massive space */
.dna-plan-card {
    max-width: 400px;
    width: 100%;
    margin: 0 auto; /* Keeps cards centered in grid */
}

/* ==========================================================================
   4. ANIMATIONS & UTILITIES
   ========================================================================== */
/* Loading Spinner Keyframes (Used inside buttons during form submit) */
@keyframes spin {
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.btn-loader {
    animation: spin 1s linear infinite;
}

/* Button Loading State Setup */
.btn-primary.is-loading {
    color: transparent !important;
    pointer-events: none;
}

.btn-primary.is-loading .btn-text {
    opacity: 0;
}

.btn-primary.is-loading .btn-loader {
    display: block !important;
    color: #000000;
}