/* ========================================
   CUSTOM STYLES (Standard CSS for Tailwind CDN)
   ======================================== */

/* 
   Base styles are now in index.html via Tailwind utility classes.
   This file handles dynamic states (active), animations, and complex selectors.
*/

/* Shape Button - Active State (Toggled by JS) */
.shape-btn.active {
    background-color: #2563EB;
    /* blue-600 */
    border-color: #2563EB;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    /* shadow-lg */
}

.shape-btn.active svg {
    stroke: #ffffff;
}

.shape-btn.active span {
    color: #ffffff;
}

/* Dimensions Panel Visibility */
.dimensions-panel {
    display: none;
}

.dimensions-panel.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* Depth Slider Styles */
.depth-slider {
    /* Base styles handled in HTML */
    -webkit-appearance: none;
    /* Required for Chrome/Safari/Edge */
    width: 100%;
    background: transparent;
    /* Track color handled by inline class */
}

/* Slider Thumb - Webkit */
.depth-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563EB 0%, #1d4ed8 100%);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
    transition: all 0.2s ease;
    margin-top: -8px;
    /* Corrects alignment in some browsers */
}

.depth-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.6);
}

.depth-slider::-webkit-slider-thumb:active {
    transform: scale(1.05);
}

/* Slider Thumb - Mozilla */
.depth-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563EB 0%, #1d4ed8 100%);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
    transition: all 0.2s ease;
}

.depth-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.6);
}

/* Slider Track - Mozilla */
.depth-slider::-moz-range-track {
    width: 100%;
    height: 0.5rem;
    background-color: #e2e8f0;
    /* slate-200 */
    border-radius: 0.5rem;
}

/* SVG Shape Visibility */
.svg-shape {
    opacity: 0;
    display: none;
    transition: opacity 0.3s ease-out;
}

.svg-shape.active {
    opacity: 1;
    display: block;
}

.svg-label {
    font-size: 14px;
    font-weight: 600;
    fill: #2563EB;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Result Item Animations */
.result-item {
    animation: fadeIn 0.4s ease-out;
}

/* Remove number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .shape-btn {
        min-height: 120px;
        padding: 1rem;
    }

    .shape-btn svg {
        width: 2.5rem;
        height: 2.5rem;
    }
}

/* ========================================
   AD CONTAINER STYLES (CLS Prevention)
   ======================================== */

.ad-label {
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    text-align: center;
    font-weight: 600;
}

.ad-container {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 1rem;
}

/* Top Banner Ad - Horizontal (CLS Prevention) */
.ad-horizontal {
    min-height: 90px;
    max-height: 90px;
    width: 100%;
}

@media (min-width: 768px) {
    .ad-horizontal {
        min-height: 90px;
        max-height: 90px;
    }
}

/* Sidebar Ad - Vertical Rectangle (CLS Prevention) */
.ad-sidebar {
    min-height: 250px;
    max-height: 250px;
    width: 100%;
}

@media (min-width: 768px) {
    .ad-sidebar {
        min-height: 250px;
        max-height: 250px;
    }
}

/* Native Ad - Responsive (CLS Prevention) */
.ad-native {
    min-height: 250px;
    width: 100%;
}

@media (min-width: 768px) {
    .ad-native {
        min-height: 280px;
    }
}

/* Placeholder styling when ad is loading */
.ad-container:empty::before {
    content: 'Advertisement Space';
    color: #cbd5e1;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ========================================
   MOBILE-ONLY CONTENT SHUFFLING (Flex Order)
   ======================================== */

/* On large screens, reset order to natural flow */
@media (min-width: 1024px) {

    .order-1,
    .order-2,
    .order-3,
    .order-4,
    .order-5,
    .order-6,
    .order-7,
    .order-8,
    .order-9 {
        order: unset !important;
    }
}

/* ========================================
   FAQ SECTION STYLES
   ======================================== */

/* FAQ Item (details element) */
.faq-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.faq-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.faq-item[open] {
    border-color: #93c5fd;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
}

/* Summary (clickable header) */
.faq-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.125rem 1.25rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.2s ease;
}

.faq-summary::-webkit-details-marker {
    display: none;
}

.faq-summary::marker {
    display: none;
    content: '';
}

.faq-summary:hover {
    background-color: #f8fafc;
}

.faq-item[open]>.faq-summary {
    background-color: #eff6ff;
    border-bottom: 1px solid #dbeafe;
}

/* Question text */
.faq-question {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.5;
    flex: 1;
}

@media (min-width: 768px) {
    .faq-question {
        font-size: 1.0625rem;
    }
}

/* Chevron icon */
.faq-chevron {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: #94a3b8;
    transition: transform 0.3s ease, color 0.3s ease;
}

.faq-item[open]>.faq-summary .faq-chevron {
    transform: rotate(180deg);
    color: #2563EB;
}

/* Answer body */
.faq-answer {
    padding: 1.25rem;
    animation: faqSlideIn 0.3s ease-out;
}

.faq-answer>p {
    font-size: 0.9375rem;
    line-height: 1.75;
    color: #475569;
    margin-bottom: 1rem;
}

.faq-answer>p:last-child {
    margin-bottom: 0;
}

@keyframes faqSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pro Tip / Rule callout */
.faq-tip {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 4px solid #2563EB;
    border-radius: 0 0.5rem 0.5rem 0;
    padding: 1rem 1.125rem;
    margin-top: 0.75rem;
}

.faq-tip-label {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #2563EB;
    background-color: #ffffff;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.faq-tip p {
    font-size: 0.875rem;
    line-height: 1.7;
    color: #334155;
    margin: 0;
}

/* Comparison cards (FAQ 3) */
.faq-compare {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .faq-compare {
        grid-template-columns: 1fr 1fr;
    }
}

.faq-compare-card {
    border-radius: 0.625rem;
    padding: 1rem;
    border: 1px solid transparent;
}

.faq-compare-card h4 {
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.faq-compare-card p {
    font-size: 0.875rem;
    line-height: 1.65;
    color: #475569;
    margin: 0;
}

.faq-compare-pea {
    background-color: #fef3c7;
    border-color: #fde68a;
}

.faq-compare-pea h4 {
    color: #92400e;
}

.faq-compare-crushed {
    background-color: #d1fae5;
    border-color: #6ee7b7;
}

.faq-compare-crushed h4 {
    color: #065f46;
}

/* Ordered steps list (FAQ 4) */
.faq-steps {
    list-style: none;
    counter-reset: faq-step;
    padding-left: 0;
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.faq-steps li {
    counter-increment: faq-step;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: #475569;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.faq-steps li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.faq-steps li::before {
    content: counter(faq-step);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    background: #2563EB;
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

/* Weight table (FAQ 5) */
.faq-weight-table {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    overflow: hidden;
    margin: 0.75rem 0 1rem 0;
}

.faq-weight-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.faq-weight-row:last-child {
    border-bottom: none;
}

.faq-weight-row:hover {
    background-color: #eff6ff;
}

.faq-weight-material {
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
}

.faq-weight-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: #2563EB;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
}

/* FAQ note */
.faq-note {
    font-size: 0.8125rem !important;
    color: #64748b !important;
    background: #f1f5f9;
    border-radius: 0.375rem;
    padding: 0.625rem 0.875rem;
    margin-top: 0.5rem;
    margin-bottom: 0 !important;
}

/* Mobile tweaks for the FAQ */
@media (max-width: 640px) {
    .faq-summary {
        padding: 1rem;
    }

    .faq-answer {
        padding: 1rem;
    }

    .faq-question {
        font-size: 0.875rem;
    }

    .faq-answer>p {
        font-size: 0.875rem;
    }

    .faq-steps li {
        font-size: 0.875rem;
    }
}