/* ===========================
   SUBSTANCE ABUSE ASSESSMENT
   STYLESHEET - Version 2.0
   =========================== */

:root {
    --primary-navy: #1a3a52;
    --primary-teal: #2d7d8e;
    --accent-gold: #c4975d;
    --bg-cream: #fdfaf5;
    --bg-white: #ffffff;
    --text-dark: #2c3e50;
    --text-medium: #5a6c7d;
    --text-light: #8b9aa8;
    --border-light: #e1e8ed;
    --success-green: #4a8a6c;
    --warning-amber: #d9a14a;
    --alert-red: #c85a54;
    --shadow-sm: 0 1px 3px rgba(26, 58, 82, 0.08);
    --shadow-md: 0 4px 12px rgba(26, 58, 82, 0.12);
    --shadow-lg: 0 8px 24px rgba(26, 58, 82, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-cream) 0%, #f5f0e8 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Crimson Pro', Georgia, serif;
    font-weight: 600;
    line-height: 1.3;
}

/* ===========================
   CONTAINER & LAYOUT
   =========================== */

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===========================
   HEADER
   =========================== */

.app-header {
    background: linear-gradient(135deg, var(--primary-navy) 0%, var(--primary-teal) 100%);
    color: white;
    padding: 2rem 3rem;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.app-header::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.05'%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.3;
}

.app-header h1 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.app-header p {
    font-size: 1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* ===========================
   Button
   =========================== */


.btn-primary {
    background-color: #007bff;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-primary:not(:disabled):hover {
    background-color: #0056b3;
}



/* ===========================
   PROGRESS BAR
   =========================== */

.progress-container {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-medium);
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--border-light);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-teal) 0%, var(--accent-gold) 100%);
    transition: width 0.3s ease;
    border-radius: 6px;
}

/* ===========================
   QUESTION CONTAINER
   =========================== */

.question-container {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.question-number {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-teal);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-text {
    font-size: 1.125rem;
    color: var(--text-dark);
    margin-bottom: 2rem;
    line-height: 1.7;
}

/* ===========================
   RADIO BUTTONS - EASIER TO CLICK
   =========================== */

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.radio-option {
    position: relative;
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-cream);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:hover {
    background: #f5efe5;
    border-color: var(--primary-teal);
    transform: translateX(4px);
}

.radio-option input[type="radio"] {
    width: 24px;
    height: 24px;
    margin-right: 1rem;
    cursor: pointer;
    accent-color: var(--primary-teal);
}

.radio-option label {
    font-size: 1rem;
    color: var(--text-dark);
    cursor: pointer;
    flex: 1;
}

.radio-option input[type="radio"]:checked + label {
    font-weight: 600;
    color: var(--primary-navy);
}

.radio-option:has(input[type="radio"]:checked) {
    background: #e8f4f8;
    border-color: var(--primary-teal);
    box-shadow: 0 2px 8px rgba(45, 125, 142, 0.15);
}

/* ===========================
   YES/NO BUTTONS - LARGE & EASY
   =========================== */

.yesno-group {
    display: flex;
    gap: 1.5rem;
}

.yesno-option {
    flex: 1;
    position: relative;
}

.yesno-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.yesno-option label {
    display: block;
    padding: 1.5rem;
    background: var(--bg-cream);
    border: 3px solid var(--border-light);
    border-radius: 12px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
}

.yesno-option label:hover {
    background: #f5efe5;
    border-color: var(--primary-teal);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.yesno-option input[type="radio"]:checked + label {
    background: var(--primary-teal);
    border-color: var(--primary-teal);
    color: white;
    box-shadow: var(--shadow-lg);
}

/* ===========================
   SCALE QUESTIONS (1-9) - CURRENT FORMAT PRESERVED
   =========================== */

.scale-group {
    margin-top: 1rem;
}

.scale-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-medium);
    font-style: italic;
}

.scale-options {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
}

.scale-option {
    flex: 1;
    position: relative;
}

.scale-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.scale-option label {
    display: block;
    padding: 1rem 0.5rem;
    background: var(--bg-cream);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    text-align: center;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
}

.scale-option label:hover {
    background: #f5efe5;
    border-color: var(--primary-teal);
    transform: translateY(-3px);
}

.scale-option input[type="radio"]:checked + label {
    background: var(--primary-teal);
    border-color: var(--primary-teal);
    color: white;
    box-shadow: var(--shadow-md);
}

/* ===========================
   NUMBER INPUT - NO SCROLL BARS
   =========================== */

.number-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.number-input-group label {
    font-size: 0.875rem;
    color: var(--text-medium);
}

.number-input-group input[type="number"] {
    width: 200px;
    padding: 1rem 1.25rem;
    font-size: 1.25rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-cream);
    color: var(--text-dark);
    -moz-appearance: textfield; /* Firefox - remove spinner */
}

/* Remove spinner arrows in WebKit browsers */
.number-input-group input[type="number"]::-webkit-inner-spin-button,
.number-input-group input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.number-input-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 3px rgba(45, 125, 142, 0.1);
}

/* ===========================
   CHECKBOX GROUP
   =========================== */

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.checkbox-option {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-cream);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-option:hover {
    background: #f5efe5;
    border-color: var(--primary-teal);
}

.checkbox-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    cursor: pointer;
    accent-color: var(--primary-teal);
}

.checkbox-option label {
    cursor: pointer;
    flex: 1;
}

.checkbox-option:has(input[type="checkbox"]:checked) {
    background: #e8f4f8;
    border-color: var(--primary-teal);
}

/* ===========================
   MULTI-SCALE (Q130)
   =========================== */

.multi-scale-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.multi-scale-item {
    background: var(--bg-cream);
    padding: 1rem;
    border-radius: 8px;
}

.multi-scale-label {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.multi-scale-item .scale-options {
    justify-content: flex-start;
}

/* ===========================
   NAVIGATION BUTTONS
   =========================== */

.navigation-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--primary-teal);
    color: white;
}

.btn-primary:hover {
    background: #267283;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    background: var(--border-light);
    color: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

/* ===========================
   INTRO SCREEN
   =========================== */

#intro {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    max-width: 800px;
    margin: 0 auto;
}

#intro h2 {
    color: var(--primary-navy);
    margin-bottom: 1.5rem;
}

#intro p {
    margin-bottom: 1rem;
    color: var(--text-medium);
}

#intro ul {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

#intro li {
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

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

#results {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.results-header {
    text-align: center;
    margin-bottom: 3rem;
}

.results-header h2 {
    color: var(--primary-navy);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.supervision-level {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 1rem;
}

.level-1 { background: #d4edda; color: #155724; }
.level-2 { background: #fff3cd; color: #856404; }
.level-3 { background: #f8d7da; color: #721c24; }
.level-4 { background: #f5c6cb; color: #721c24; }

.results-section {
    margin-bottom: 3rem;
}

.results-section h3 {
    color: var(--primary-navy);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-light);
}

.domain-scores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.domain-score {
    background: var(--bg-cream);
    padding: 1.25rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-teal);
}

.domain-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    text-transform: capitalize;
}

.domain-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-teal);
}

.domain-bar {
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.domain-bar-fill {
    height: 100%;
    background: var(--primary-teal);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Verification Flags */
.verification-flags {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.flag {
    padding: 1.25rem;
    border-radius: 8px;
    border-left: 4px solid;
}

.flag-critical {
    background: #f8d7da;
    border-color: var(--alert-red);
}

.flag-moderate {
    background: #fff3cd;
    border-color: var(--warning-amber);
}

.flag-minor {
    background: #d1ecf1;
    border-color: #0c5460;
}

.flag-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.flag-finding {
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.flag-recommendation {
    font-size: 0.9rem;
    color: var(--text-medium);
    white-space: pre-line;
}

/* Charts */
.chart-container {
    margin: 2rem 0;
    padding: 2rem;
    background: var(--bg-cream);
    border-radius: 8px;
}

/* Detailed Domain Analysis */
.domain-detail {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-cream);
    border-radius: 8px;
}

.domain-detail h4 {
    color: var(--primary-navy);
    margin-bottom: 1rem;
}

.question-response {
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border-left: 3px solid var(--primary-teal);
}

.question-response-header {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.question-response-text {
    color: var(--text-medium);
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.question-response-answer {
    color: var(--primary-teal);
    font-weight: 600;
}

/* Export Buttons */
.export-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */

@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }
    
    .app-header {
        padding: 1.5rem 2rem;
    }
    
    .app-header h1 {
        font-size: 1.75rem;
    }
    
    .question-container {
        padding: 1.5rem;
    }
    
    .yesno-group {
        flex-direction: column;
    }
    
    .scale-options {
        flex-wrap: wrap;
    }
    
    .scale-option {
        flex-basis: calc(20% - 0.4rem);
    }
    
    .number-input-group input[type="number"] {
        width: 100%;
    }
    
    .domain-scores {
        grid-template-columns: 1fr;
    }
}

/* ===========================
   PRINT STYLES
   =========================== */

@media print {
    body {
        background: white;
    }
    
    .navigation-buttons,
    .export-buttons,
    .progress-container {
        display: none;
    }
    
    .question-container,
    .results-section {
        page-break-inside: avoid;
    }
}

/* ============================================
   STAGE-BASED DISPLAY STYLES
   ============================================ */

.stages-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.stage-category {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stage-header {
    font-size: 0.9rem;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stage-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 1rem;
}

.stage-bar-container {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.stage-bar-fill {
    height: 100%;
    transition: width 0.6s ease-out;
    border-radius: 15px;
}

.stage-description {
    font-size: 1rem;
    color: #555;
    line-height: 1.5;
}

.stage-recommendations {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid #e0e0e0;
}

.recommendations-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #2c3e50;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.recommendations-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recommendations-list li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    line-height: 1.6;
    color: #34495e;
}

.recommendations-list li:before {
    content: "•";
    position: absolute;
    left: 0.5rem;
    color: #3498db;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Substance Abuse Report Styling */
.substance-report {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.substance-category-report {
    background: white;
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.substance-category-report h3 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 3px solid #3498db;
    padding-bottom: 0.5rem;
}

.stage-classification {
    font-size: 1.1rem;
    color: #e74c3c;
    margin: 1rem 0;
    padding: 1rem;
    background: #fef5e7;
    border-left: 4px solid #e74c3c;
}

.clinical-description {
    font-size: 1rem;
    line-height: 1.8;
    color: #34495e;
    margin: 1.5rem 0;
    text-align: justify;
}

.clinical-recommendations {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #e8f5e9;
    border-radius: 6px;
    border-left: 4px solid #4CAF50;
}

.clinical-recommendations h4 {
    color: #2e7d32;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.clinical-recommendations ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.clinical-recommendations ul li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    line-height: 1.6;
    color: #1b5e20;
}

.clinical-recommendations ul li:before {
    content: "▸";
    position: absolute;
    left: 0.5rem;
    color: #4CAF50;
    font-weight: bold;
}
