/* ============================================================
   I-Profile Assessment — Styles
   Professional HR/consulting assessment UI
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    background-color: #f5f7fa;
    color: #1a202c;
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ---------- Screen visibility ---------- */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* ---------- Card ---------- */
.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* ============================================================
   HOME SCREEN
   ============================================================ */
.home-card {
    text-align: center;
    padding: 48px 32px;
    margin-top: 40px;
}

.home-logo {
    margin-bottom: 24px;
}

.home-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2c5282;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.home-subtitle {
    font-size: 1.1rem;
    color: #718096;
    margin-bottom: 32px;
}

.home-info {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 32px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.info-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #a0aec0;
    margin-bottom: 4px;
}

.info-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c5282;
}

.form-group {
    max-width: 400px;
    margin: 0 auto 24px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    color: #1a202c;
    background: #f7fafc;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
    background: #fff;
}

.footer-note {
    text-align: center;
    font-size: 0.8rem;
    color: #a0aec0;
    margin-top: 16px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    text-decoration: none;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-lg {
    width: 100%;
    max-width: 400px;
    padding: 16px 32px;
    font-size: 1.1rem;
    margin-top: 8px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-primary {
    background-color: #2c5282;
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2b6cb0;
    box-shadow: 0 4px 12px rgba(44, 82, 130, 0.3);
}

.btn-secondary {
    background-color: #edf2f7;
    color: #2d3748;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #e2e8f0;
}

.btn-danger {
    background-color: transparent;
    color: #e53e3e;
    font-weight: 500;
    font-size: 0.85rem;
}

.btn-danger:hover:not(:disabled) {
    background-color: #fff5f5;
}

/* ============================================================
   TEST SCREEN
   ============================================================ */
.test-header {
    margin-bottom: 20px;
}

.progress-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

#question-counter {
    font-weight: 600;
    color: #2d3748;
}

#progress-percent {
    font-weight: 700;
    color: #2c5282;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #3182ce, #2c5282);
    transition: width 0.35s ease;
}

/* Question */
.question-card {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-text {
    font-size: 1.15rem;
    font-weight: 500;
    color: #1a202c;
    text-align: center;
    line-height: 1.6;
}

/* Option Buttons */
.options-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.option-btn {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    font-size: 1rem;
    font-weight: 500;
    color: #2d3748;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.option-btn:hover {
    border-color: #3182ce;
    background-color: #ebf4ff;
}

.option-btn.selected {
    border-color: #2c5282;
    background-color: #2c5282;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(44, 82, 130, 0.25);
}

/* Nav buttons */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.nav-buttons .btn {
    flex: 1;
}

.test-footer {
    text-align: center;
    padding-top: 8px;
}

/* ============================================================
   RESULTS SCREEN
   ============================================================ */
.results-header {
    text-align: center;
    padding: 32px 24px;
}

.results-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2c5282;
    margin-bottom: 12px;
}

.results-meta {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.meta-item {
    font-size: 0.9rem;
    color: #718096;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 12px;
    margin-top: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

/* Chart container */
.chart-container {
    width: 100%;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 0;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-label {
    flex: 0 0 160px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #2d3748;
    text-align: right;
}

.chart-bar-track {
    flex: 1;
    height: 14px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s ease;
}

.chart-value {
    flex: 0 0 36px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #2c5282;
    text-align: right;
}

/* ---------- Dimension Cards ---------- */
.dimension-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.dimension-card .dim-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.dimension-card .dim-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1a202c;
}

.dimension-card .dim-score {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c5282;
}

.dimension-card .dim-score-row {
    margin-bottom: 8px;
}

.dimension-card .dim-score small {
    font-size: 0.7rem;
    font-weight: 400;
    color: #a0aec0;
}

.dim-bar-track {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}

.dim-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s ease;
}

.dim-interp {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 8px;
    line-height: 1.5;
}

.dimension-card .dim-description {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 8px;
    line-height: 1.5;
}

/* ---------- Score Bar ---------- */
.score-bar {
    width: 100%;
    height: 10px;
    background-color: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s ease;
}

/* Score fill color classes */
.score-fill.level-basso {
    background-color: #e53e3e;
}

.score-fill.level-medio-basso {
    background-color: #ed8936;
}

.score-fill.level-medio {
    background-color: #d69e2e;
}

.score-fill.level-medio-alto {
    background-color: #48bb78;
}

.score-fill.level-alto {
    background-color: #38a169;
}

/* ---------- Status Badges ---------- */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-basso {
    background-color: #fed7d7;
    color: #c53030;
}

.status-medio-basso {
    background-color: #fefcbf;
    color: #b7791f;
}

.status-medio {
    background-color: #fefcbf;
    color: #975a16;
}

.status-medio-alto {
    background-color: #c6f6d5;
    color: #276749;
}

.status-alto {
    background-color: #c6f6d5;
    color: #22543d;
}

/* ---------- Derived Index Cards ---------- */
.derived-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.derived-card .derived-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.derived-card .derived-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1a202c;
}

.derived-card .derived-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c5282;
}

.derived-card .derived-score {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c5282;
    margin-bottom: 8px;
}

.derived-card .derived-score small {
    font-size: 0.7rem;
    font-weight: 400;
    color: #a0aec0;
}

.derived-card .derived-description {
    font-size: 0.85rem;
    color: #718096;
    line-height: 1.5;
}

/* Generic badge (used inline by app.js) */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ---------- Reliability Card ---------- */
.reliability-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.reliability-card .reliability-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reliability-meter {
    position: relative;
    width: 100%;
    max-width: 360px;
    height: 18px;
    background: linear-gradient(90deg, #e53e3e 0%, #ed8936 25%, #d69e2e 50%, #48bb78 75%, #38a169 100%);
    border-radius: 999px;
    margin: 0 auto 12px;
    overflow: visible;
}

.reliability-meter .meter-indicator {
    position: absolute;
    top: -4px;
    width: 12px;
    height: 26px;
    background: #1a202c;
    border-radius: 4px;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    transform: translateX(-50%);
    transition: left 0.6s ease;
}

.reliability-card .reliability-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c5282;
}

.reliability-card .reliability-text {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 4px;
}

.reliability-main h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c5282;
    margin-bottom: 12px;
}

.reliability-meter-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s ease;
}

.reliability-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c5282;
    margin-top: 8px;
}

.reliability-score small {
    font-size: 0.7rem;
    font-weight: 400;
    color: #a0aec0;
}

.reliability-subs {
    margin-top: 16px;
}

.reliability-sub {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    text-align: left;
}

.reliability-sub-label {
    flex: 0 0 160px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a5568;
    text-align: right;
}

.reliability-sub-bar-track {
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.reliability-sub-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s ease;
}

.reliability-sub-value {
    flex: 0 0 36px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #2c5282;
    text-align: right;
}

.reliability-warning {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 8px;
    color: #c53030;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.reliability-reasons {
    margin-top: 8px;
    text-align: left;
}

.reliability-reasons ul {
    margin: 0;
    padding-left: 20px;
}

.reliability-reasons li {
    font-size: 0.82rem;
    color: #9b2c2c;
    line-height: 1.6;
}

/* ---------- Interpretation ---------- */
.interpretation-text {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-size: 0.95rem;
    line-height: 1.7;
    color: #2d3748;
}

.interpretation-text h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #2c5282;
    margin-bottom: 8px;
}

/* ---------- Export Buttons ---------- */
.export-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 24px 0;
}

.export-buttons .btn {
    min-width: 160px;
}

/* ---------- Debug Panel ---------- */
.debug-panel {
    margin-top: 32px;
    margin-bottom: 40px;
}

.debug-toggle {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: 1px dashed #cbd5e0;
    border-radius: 8px;
    background: transparent;
    font-size: 0.85rem;
    font-weight: 500;
    color: #a0aec0;
    cursor: pointer;
    transition: all 0.2s;
}

.debug-toggle:hover {
    border-color: #a0aec0;
    color: #718096;
    background: #f7fafc;
}

.debug-content {
    margin-top: 8px;
    background: #1a202c;
    border-radius: 10px;
    padding: 20px;
    overflow-x: auto;
}

.debug-content pre {
    font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
    font-size: 0.8rem;
    color: #a0aec0;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    .container {
        padding: 12px;
    }

    .home-card {
        padding: 32px 20px;
        margin-top: 16px;
    }

    .home-title {
        font-size: 1.5rem;
    }

    .home-subtitle {
        font-size: 1rem;
    }

    .home-info {
        gap: 20px;
    }

    .info-value {
        font-size: 1.25rem;
    }

    .card {
        padding: 18px;
    }

    .question-text {
        font-size: 1.05rem;
    }

    .option-btn {
        padding: 14px 16px;
        font-size: 0.95rem;
    }

    .nav-buttons {
        flex-wrap: wrap;
    }

    .nav-buttons .btn {
        flex: 1 1 100%;
    }

    .export-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .export-buttons .btn {
        min-width: auto;
    }

    .results-meta {
        flex-direction: column;
        gap: 4px;
    }

    .dimension-card .dim-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ============================================================
   PRINT / PDF STYLES
   ============================================================ */
@media print {
    body {
        background: #ffffff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .card,
    .dimension-card,
    .derived-card,
    .reliability-card,
    .interpretation-text {
        box-shadow: none;
        border: 1px solid #e2e8f0;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .nav-buttons,
    .test-footer,
    .export-buttons,
    .debug-panel,
    #btn-redo,
    #home-screen,
    #test-screen {
        display: none !important;
    }

    #results-screen {
        display: block !important;
    }

    .progress-bar,
    .score-bar {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .score-fill,
    .progress-fill,
    .reliability-meter {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .status-badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ============================================================
   ANIMATIONS / TRANSITIONS
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.screen.active {
    animation: fadeIn 0.3s ease;
}

.dimension-card,
.derived-card,
.interpretation-text {
    animation: fadeIn 0.35s ease both;
}
