/* ============================================
   ACE Score Calculator — Deep Purple Theme
   ============================================ */

.ace-calculator-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: #1e293b;
    line-height: 1.6;
}

.ace-calculator-container *,
.ace-calculator-container *::before,
.ace-calculator-container *::after {
    box-sizing: border-box;
}

/* ============ HERO ============ */

.ace-hero {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    text-align: center;
    padding: 48px 32px 40px;
    border-radius: 16px;
    margin-bottom: 32px;
}

.ace-hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0 0 12px;
    color: #fff;
    line-height: 1.2;
}

.ace-hero .hero-subtitle {
    font-size: 1.05rem;
    opacity: 0.92;
    margin: 0 0 24px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-badges {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-badges .badge {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.hero-badges .badge-icon {
    margin-right: 4px;
}

/* ============ STATS ROW ============ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: #7c3aed;
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 4px;
}

/* ============ PRIVACY NOTICE ============ */

.privacy-notice {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-left: 4px solid #22c55e;
    border-radius: 8px;
    padding: 14px 20px;
    font-size: 0.9rem;
    margin-bottom: 32px;
    color: #166534;
}

/* ============ CALCULATOR FORM ============ */

.calculator-form-section {
    margin-bottom: 32px;
}

/* Progress wrapper (injected by JS) */
.mdcv2-progress-wrapper {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.mdcv2-progress-text {
    font-size: 0.88rem;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 600;
}

.mdcv2-progress-bar {
    background: #e2e8f0;
    border-radius: 50px;
    height: 10px;
    overflow: hidden;
}

.mdcv2-progress-fill {
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    height: 100%;
    border-radius: 50px;
    transition: width 0.4s ease;
}

/* Question categories */
.question-category {
    margin-bottom: 24px;
}

.category-header {
    font-size: 1rem;
    font-weight: 700;
    padding: 12px 20px;
    border-radius: 10px 10px 0 0;
    color: #fff;
}

.category-abuse {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.category-household {
    background: linear-gradient(135deg, #d97706, #b45309);
}

/* Question cards */
.question-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-top: none;
    padding: 20px;
}

.question-card:last-child {
    border-radius: 0 0 10px 10px;
}

.question-text {
    margin: 0 0 12px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.question-text strong {
    color: #7c3aed;
}

/* Radio toggle buttons */
.radio-toggle {
    display: flex;
    gap: 10px;
}

.toggle-btn {
    flex: 1;
    max-width: 120px;
    cursor: pointer;
    margin: 0;
}

.toggle-btn input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-btn span {
    display: block;
    text-align: center;
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #64748b;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.toggle-btn:hover span {
    border-color: #c4b5fd;
    color: #7c3aed;
}

.toggle-btn input[type="radio"]:checked + span {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

/* Submit button */
.form-submit {
    text-align: center;
    margin-top: 32px;
}

.submit-btn {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    border: none;
    padding: 16px 48px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

/* ============ RESULTS ============ */

.results-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 40px 32px;
    margin-bottom: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.results-section h2 {
    text-align: center;
    font-size: 1.6rem;
    color: #1e293b;
    margin: 0 0 32px;
}

/* Score circle */
.score-circle-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
}

.score-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 6px solid #e2e8f0;
    background: #f8fafc;
    transition: all 0.5s ease;
}

.score-circle .score-value {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1;
    color: #1e293b;
}

.score-circle .score-max {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 4px;
}

/* Score circle color states */
.score-circle.score-low {
    border-color: #22c55e;
    background: #f0fdf4;
}

.score-circle.score-low .score-value {
    color: #16a34a;
}

.score-circle.score-moderate {
    border-color: #eab308;
    background: #fefce8;
}

.score-circle.score-moderate .score-value {
    color: #ca8a04;
}

.score-circle.score-high {
    border-color: #f97316;
    background: #fff7ed;
}

.score-circle.score-high .score-value {
    color: #ea580c;
}

.score-circle.score-severe {
    border-color: #ef4444;
    background: #fef2f2;
}

.score-circle.score-severe .score-value {
    color: #dc2626;
}

/* Risk level card */
.risk-level-card {
    text-align: center;
    padding: 20px 24px;
    border-radius: 12px;
    margin-bottom: 28px;
    border: 1px solid #e2e8f0;
}

.risk-level-card.risk-low {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.risk-level-card.risk-moderate {
    background: #fefce8;
    border-color: #fde68a;
}

.risk-level-card.risk-high {
    background: #fff7ed;
    border-color: #fed7aa;
}

.risk-level-card.risk-severe {
    background: #fef2f2;
    border-color: #fecaca;
}

.risk-label {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.risk-low .risk-label {
    color: #16a34a;
}

.risk-moderate .risk-label {
    color: #ca8a04;
}

.risk-high .risk-label {
    color: #ea580c;
}

.risk-severe .risk-label {
    color: #dc2626;
}

.risk-description {
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.6;
}

/* Category breakdown */
.category-breakdown {
    margin-bottom: 28px;
}

.category-breakdown h3 {
    font-size: 1.1rem;
    margin: 0 0 16px;
    color: #1e293b;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.breakdown-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.breakdown-category {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 6px;
}

.breakdown-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #7c3aed;
}

/* Health impact card */
.health-impact-card {
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 28px;
}

.health-impact-card h3 {
    font-size: 1.1rem;
    margin: 0 0 12px;
    color: #6d28d9;
}

.health-impact-card p,
.health-impact-card ul {
    font-size: 0.93rem;
    color: #475569;
    margin: 0 0 8px;
}

.health-impact-card ul {
    padding-left: 20px;
}

.health-impact-card li {
    margin-bottom: 4px;
}

/* Resilience section */
.resilience-section {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 28px;
}

.resilience-section h3 {
    font-size: 1.1rem;
    margin: 0 0 12px;
    color: #166534;
}

.resilience-section p {
    font-size: 0.93rem;
    color: #475569;
    margin: 0 0 12px;
}

.resilience-section ul {
    padding-left: 20px;
    margin: 0;
}

.resilience-section li {
    font-size: 0.93rem;
    color: #475569;
    margin-bottom: 6px;
}

/* Result action buttons */
.result-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.mdcv2-print-btn,
.mdcv2-share-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #475569;
    transition: all 0.2s ease;
}

.mdcv2-print-btn:hover,
.mdcv2-share-btn:hover {
    border-color: #7c3aed;
    color: #7c3aed;
    background: #faf5ff;
}

/* Crisis resources */
.crisis-resources {
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 28px;
}

.crisis-resources h3 {
    font-size: 1.1rem;
    margin: 0 0 12px;
    color: #dc2626;
}

.crisis-resources p {
    font-size: 0.93rem;
    color: #475569;
    margin: 0 0 14px;
}

.crisis-item {
    background: #fff;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 10px;
    font-size: 0.93rem;
}

.crisis-item:last-child {
    margin-bottom: 0;
}

/* History section */
.mdcv2-history-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 28px;
}

.mdcv2-history-section h3 {
    font-size: 1.1rem;
    margin: 0 0 16px;
    color: #1e293b;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.88rem;
}

.history-date {
    color: #64748b;
    font-weight: 500;
}

.history-result {
    color: #7c3aed;
    font-weight: 700;
}

.mdcv2-clear-history {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 6px 0;
    margin-top: 4px;
    text-decoration: underline;
}

.mdcv2-clear-history:hover {
    color: #ef4444;
}

/* Retake button */
.retake-wrapper {
    text-align: center;
}

.retake-btn {
    background: #fff;
    color: #7c3aed;
    border: 2px solid #7c3aed;
    padding: 14px 40px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.retake-btn:hover {
    background: #7c3aed;
    color: #fff;
}

/* ============ EDUCATION TABS ============ */

.education-tabs {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tab-nav {
    display: flex;
    gap: 6px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 18px;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #7c3aed;
}

.tab-btn.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content h3 {
    font-size: 1.2rem;
    color: #1e293b;
    margin: 0 0 16px;
}

.tab-content p {
    font-size: 0.95rem;
    color: #475569;
    margin: 0 0 14px;
}

.tab-content ul {
    padding-left: 20px;
    margin: 0 0 14px;
}

.tab-content li {
    font-size: 0.93rem;
    color: #475569;
    margin-bottom: 8px;
    line-height: 1.6;
}

/* ============ FAQ ACCORDION ============ */

.faq-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.faq-section h2 {
    font-size: 1.4rem;
    color: #1e293b;
    margin: 0 0 20px;
}

.faq-item {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    text-align: left;
    padding: 16px 48px 16px 20px;
    border: none;
    background: #f8fafc;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
}

.faq-question::after {
    content: '+';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3rem;
    color: #7c3aed;
    font-weight: 700;
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question::after {
    content: '\2212';
}

.faq-question:hover {
    background: #f1f5f9;
}

.faq-item.active .faq-question {
    background: #faf5ff;
}

.faq-answer {
    display: none;
    padding: 0 20px 16px;
    background: #fff;
}

.faq-item.active .faq-answer {
    display: block;
}

.faq-answer p {
    font-size: 0.93rem;
    color: #475569;
    line-height: 1.7;
    margin: 12px 0 0;
}

/* ============ MEDICAL DISCLAIMER ============ */

.medical-disclaimer {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 32px;
}

.medical-disclaimer h3 {
    font-size: 1rem;
    color: #92400e;
    margin: 0 0 8px;
}

.medical-disclaimer p {
    font-size: 0.88rem;
    color: #78350f;
    margin: 0;
    line-height: 1.6;
}

/* ============ RELATED CALCULATORS ============ */

.related-calculators {
    margin-bottom: 32px;
}

.related-calculators h2 {
    font-size: 1.4rem;
    color: #1e293b;
    margin: 0 0 20px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.related-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.related-card:hover {
    border-color: #c4b5fd;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.12);
    transform: translateY(-2px);
}

.related-card h4 {
    font-size: 0.95rem;
    color: #7c3aed;
    margin: 0 0 8px;
}

.related-card p {
    font-size: 0.82rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* ============ REFERENCES ============ */

.references-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.references-section h2 {
    font-size: 1.2rem;
    color: #1e293b;
    margin: 0 0 16px;
}

.references-section ol {
    padding-left: 20px;
    margin: 0;
}

.references-section li {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 10px;
    line-height: 1.6;
}

.references-section em {
    font-style: italic;
}

.references-section a {
    color: #7c3aed;
    text-decoration: none;
}

.references-section a:hover {
    text-decoration: underline;
}

/* ============ MOBILE RESPONSIVE ============ */

@media (max-width: 768px) {
    .ace-hero {
        padding: 32px 20px 28px;
    }

    .ace-hero h1 {
        font-size: 1.6rem;
    }

    .ace-hero .hero-subtitle {
        font-size: 0.92rem;
    }

    .hero-badges {
        gap: 8px;
    }

    .hero-badges .badge {
        font-size: 0.78rem;
        padding: 5px 12px;
    }

    .stats-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .question-card {
        padding: 16px;
    }

    .radio-toggle {
        gap: 8px;
    }

    .toggle-btn span {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .submit-btn {
        width: 100%;
        padding: 14px 32px;
    }

    .results-section {
        padding: 28px 20px;
    }

    .score-circle {
        width: 130px;
        height: 130px;
    }

    .score-circle .score-value {
        font-size: 2.6rem;
    }

    .breakdown-grid {
        grid-template-columns: 1fr;
    }

    .result-actions {
        flex-direction: column;
        align-items: center;
    }

    .mdcv2-print-btn,
    .mdcv2-share-btn {
        width: 100%;
        max-width: 280px;
    }

    .tab-nav {
        gap: 4px;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 0.82rem;
    }

    .education-tabs {
        padding: 24px 20px;
    }

    .faq-section {
        padding: 24px 20px;
    }

    .related-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .references-section {
        padding: 24px 20px;
    }
}

@media (max-width: 480px) {
    .ace-calculator-container {
        padding: 0 10px;
    }

    .ace-hero {
        padding: 24px 16px;
        border-radius: 12px;
    }

    .ace-hero h1 {
        font-size: 1.35rem;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .tab-nav {
        flex-direction: column;
        border-bottom: none;
        gap: 2px;
    }

    .tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
        text-align: left;
        margin-bottom: 0;
        padding: 10px 14px;
        background: #f8fafc;
        border-radius: 6px;
    }

    .tab-btn.active {
        border-bottom-color: transparent;
        border-left-color: #7c3aed;
        background: #faf5ff;
    }
}
