/* QBank Start New Session Page Styles */
/* Based on the original DarkModeExample styling */

/* Base font size for rem units */
html {
    font-size: 16px;
}

/* Main container styling */
.session-config-form {
    width: 90%;
    max-width: 56.25rem; /* 900px */
    margin: 2rem auto;
    background: var(--card-bg);
    padding: 1.5625rem; /* 25px */
    border-radius: 0.75rem; /* 12px */
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

/* Session title */
.session-title {
    color: var(--primary-color);
    text-align: center;
    font-size: 2.5rem; /* 40px */
    margin-bottom: 0.625rem; /* 10px */
    font-weight: bold;
}

/* Form groups */
.form-group {
    margin-bottom: 1.875rem; /* 30px */
}

.form-label {
    display: block;
    color: var(--text-color);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.75rem; /* 12px */
}

/* Radio button groups */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* 12px */
}

.radio-item {
    display: flex;
    align-items: center;
    padding: 0.875rem; /* 14px */
    border: 1px solid var(--border-color);
    border-radius: 0.5rem; /* 8px */
    background: var(--bg-color);
    cursor: pointer;
    transition: all var(--transition-base);
}

.radio-item:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.radio-item.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.radio-item input[type="radio"] {
    margin-right: 0.75rem; /* 12px */
    transform: scale(1.2);
}

.radio-item span {
    font-size: 1rem;
    font-weight: 500;
}

/* Checkbox groups */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem; /* 12px */
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.75rem; /* 12px */
    border: 1px solid var(--border-color);
    border-radius: 0.5rem; /* 8px */
    background: var(--bg-color);
    transition: all var(--transition-base);
}

.checkbox-item:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.checkbox-item input[type="checkbox"] {
    margin-right: 0.75rem; /* 12px */
    transform: scale(1.2);
}

.checkbox-item label {
    color: var(--text-color);
    font-weight: 500;
    cursor: pointer;
}

.eor-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

/* Disease search container */
.disease-search-container {
    position: relative;
    margin-bottom: 1rem;
}

.disease-search-input {
    width: 100%;
    padding: 0.875rem; /* 14px */
    border: 1px solid var(--border-color);
    border-radius: 0.5rem; /* 8px */
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color var(--transition-base);
}

.disease-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
}

.disease-search-input::placeholder {
    color: var(--text-muted);
}

/* Search results */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem; /* 8px */
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 0.875rem; /* 14px */
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color var(--transition-base);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--hover-bg);
}

.suggestion-title {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem; /* 4px */
}

.suggestion-meta {
    font-size: 0.875rem; /* 14px */
    color: var(--text-muted);
}

.no-results {
    padding: 0.875rem; /* 14px */
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* Selected diseases */
.selected-diseases {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem; /* 8px */
    margin-top: 0.75rem; /* 12px */
}

.selected-disease-tag {
    display: inline-flex;
    align-items: center;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 0.75rem; /* 8px 12px */
    border-radius: 1.5rem; /* 24px */
    font-size: 0.875rem; /* 14px */
    font-weight: 500;
}

.remove-disease {
    background: none;
    border: none;
    color: white;
    margin-left: 0.5rem; /* 8px */
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color var(--transition-base);
}

.remove-disease:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Form controls */
.form-select {
    width: 100%;
    padding: 0.875rem; /* 14px */
    border: 1px solid var(--border-color);
    border-radius: 0.5rem; /* 8px */
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    transition: border-color var(--transition-base);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
}

/* Preset buttons for question count */
.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem; /* 12px */
    margin-bottom: 1rem;
}

.preset-btn {
    padding: 0.75rem 1.25rem; /* 12px 20px */
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem; /* 8px */
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    min-height: 3rem; /* 48px */
    display: flex;
    align-items: center;
    justify-content: center;
}

.preset-btn:hover {
    background: var(--btn-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.preset-btn.active {
    background: var(--btn-success-bg);
    color: white;
}

.preset-btn.custom.active {
    background: var(--text-muted);
}

/* Custom input field */
.custom-input {
    display: none;
    width: 100%;
    padding: 0.875rem; /* 14px */
    border: 1px solid var(--border-color);
    border-radius: 0.5rem; /* 8px */
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color var(--transition-base);
    margin-top: 0.75rem; /* 12px */
}

.custom-input.show {
    display: block;
}

.custom-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
}

.custom-input::placeholder {
    color: var(--text-muted);
}

/* Session options */
.session-options {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem; /* 12px */
}

.session-options h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

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

.option-item {
    padding: 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem; /* 8px */
    transition: all var(--transition-base);
}

.option-item:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.option-item h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem; /* 8px */
    font-size: 1.1rem;
}

.option-item p {
    color: var(--text-color);
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Submit button */
.submit-button {
    width: 100%;
    padding: 1rem 2rem;
    background: var(--btn-primary-bg);
    color: white;
    border: none;
    border-radius: 0.5rem; /* 8px */
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    margin-top: 1.5rem;
}

.submit-button:hover:not(:disabled) {
    background: var(--btn-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.submit-button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Responsive design */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    .session-config-form {
        width: 95%;
        padding: 1rem;
        margin: 1rem auto;
    }
    
    .session-title {
        font-size: 2.2rem;
    }
    
    .checkbox-group {
        grid-template-columns: 1fr;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .session-config-form {
        width: 100%;
        padding: 0.75rem;
        border-radius: 0.5rem;
    }
    
    .session-title {
        font-size: 1.8rem;
    }
    
    .radio-item,
    .checkbox-item {
        padding: 0.625rem;
    }
    
    .submit-button {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* ========================================
   START NEW SESSION PAGE STYLES - EXTRACTED
   ======================================== */

/* The :root block for variables has been moved to global_combined.css */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 24px;
    margin-bottom: 24px;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 24px;
    font-size: 2rem;
    text-align: center;
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.disease-search-container {
    position: relative;
    margin-bottom: 16px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: #f8fafc;
}

.search-result-item:last-child {
    border-bottom: none;
}

.suggestion-title {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.suggestion-meta {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.no-results {
    padding: 12px 16px;
    text-align: center;
    color: var(--secondary-color);
    font-style: italic;
}

.selected-diseases {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.selected-disease-tag {
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.remove-disease {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.remove-disease:hover {
    background: rgba(255, 255, 255, 0.3);
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.preset-btn {
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preset-btn:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

.preset-btn.active {
    background-color: #22c55e; /* Use a green for selected */
    color: white;
}

.preset-btn.custom.active {
    background-color: #374151;
}

.custom-input {
    display: none;
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease;
    margin-top: 12px;
}

.custom-input.show {
    display: block;
}

.custom-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.custom-input::placeholder {
    color: #9ca3af;
}

.btn {
    display: inline-block;
    padding: 16px 32px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
    min-height: 48px;
}

.btn:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

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

.button-group {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 32px;
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .preset-buttons {
        gap: 8px;
    }
    
    .preset-btn {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        padding: 14px 24px;
        font-size: 16px;
        min-height: 48px;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* Loading Status Card */
.loading-status-card {
    position: absolute; /* Position relative to its parent container */
    top: 50%; /* Center vertically */
    left: 50%; /* Center horizontally */
    transform: translate(-50%, -50%); /* Adjust for its own size */
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    text-align: center;
    /* The card styling from .card class will apply */
    z-index: 1000;
    /* display: none; is set directly in HTML */
}

.loading-status-card h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.loading-status-card .spinner {
    border: 4px solid rgba(var(--text-rgb), 0.1);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-status-card .loading-messages {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
    color: var(--text-color-muted);
    font-size: 0.95rem;
}

.loading-status-card .loading-messages li {
    margin-bottom: 0.5rem;
}

/* Feedback Button */
.loading-status-card .btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    border: 1px solid var(--secondary-color);
}

.loading-status-card .btn-secondary:hover {
    background-color: var(--secondary-hover-bg);
    border-color: var(--secondary-hover-bg);
}

@media (max-width: 480px) {
    .loading-status-card {
        padding: 1.5rem;
    }

    .loading-status-card h2 {
        font-size: 1.5rem;
    }

    .loading-status-card .spinner {
        width: 30px;
        height: 30px;
    }
}


/* ============================================================
 * v4.0 additions — Goal Selection title, tile-style radios,
 * checkbox group (EOR + PANCE system), dark-text disease pills.
 * ============================================================ */

/* --- Tile-style radio group (Number of Questions) --- */
/* Visually-hidden radio drives the styled <span> tile. No JS. */
.tile-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.tile-item {
    display: inline-flex;
    cursor: pointer;
}
.tile-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}
.tile-item > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.5rem;
    min-height: 2.75rem;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: background-color var(--transition-base), transform var(--transition-base);
    border: 2px solid transparent;
}
.tile-item:hover > span {
    background: var(--btn-primary-hover);
    transform: translateY(-1px);
}
/* Checked tile turns green — matches the legacy .preset-btn.active look */
.tile-item input[type="radio"]:checked + span {
    background: var(--btn-success-bg);
    color: white;
    border-color: var(--btn-success-bg);
}
.tile-item input[type="radio"]:focus-visible + span {
    outline: 2px solid var(--btn-success-bg);
    outline-offset: 2px;
}

/* --- Checkbox group (EOR exams, PANCE systems) --- */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.checkbox-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: var(--bg-secondary, #f4f4f5);
    color: var(--text-color, #1a1a1a);
    border: 1px solid var(--border-color, #d4d4d8);
    border-radius: 0.5rem;
    cursor: pointer;
    min-height: 2.75rem;
    font-weight: 500;
}
.checkbox-item:hover {
    background: var(--hover-bg, #e4e4e7);
}
.checkbox-item input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--btn-success-bg);
}
.pance-weight {
    color: var(--text-muted, #71717a);
    font-weight: 400;
    margin-left: 0.15rem;
}

/* --- Disease pill dark text on light background --- */
/* Overrides the legacy .selected-disease-tag rule that used a saturated
 * primary background + white text (low-contrast in some themes). */
.selected-disease-tag {
    background: #e0f2fe;   /* sky-100 — soft light blue */
    color: #0c4a6e;        /* sky-900 — dark blue, AAA contrast */
    border: 1px solid #7dd3fc;  /* sky-300 — visible edge */
    padding: 0.5rem 0.75rem;
    border-radius: 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}
.selected-disease-tag .remove-disease {
    color: #0c4a6e;
    background: none;
    border: none;
    cursor: pointer;
    margin-left: 0.5rem;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 0.25rem;
}
.selected-disease-tag .remove-disease:hover {
    color: #7f1d1d;  /* red-900 hover hint */
}

/* Disease search popdown rows — explicit dark text so the suggestion
 * titles read against the dropdown's white background regardless of
 * the broader theme's --text-color value. */
.search-results .suggestion-title { color: #1f2937; }
.search-results .suggestion-meta  { color: #6b7280; }

/* Loading placeholder in disease panel */
.search-loading {
    color: var(--text-muted, #6b7280);
    font-size: 0.875rem;
    margin: 0;
}


/* ============================================================
 * v5.0 — Selected-state for .radio-item via :has(:checked).
 * Pure CSS, no JS. Applies to Clinical Rotation, EOR (now single-
 * select), PANCE Body Systems (now single-select), and the Goal
 * Selection radio group itself — anywhere .radio-item wraps a
 * checked radio, the card lights up in success green to match
 * the tile pattern used by the Number of Questions group.
 *
 * SOP-CSS:
 *   - Tokens via var(--…).
 *   - No !important.
 *   - No JS.
 *   - Mobile-first (existing card padding already 14px → 10px @ <768px).
 * ============================================================ */

.radio-item:has(input[type="radio"]:checked) {
    background: var(--btn-success-bg);
    color: white;
    border-color: var(--btn-success-bg);
}
.radio-item:has(input[type="radio"]:checked) span,
.radio-item:has(input[type="radio"]:checked) small {
    color: white;
}
.radio-item:has(input[type="radio"]:focus-visible) {
    outline: 2px solid var(--btn-success-bg);
    outline-offset: 2px;
}
