/* ============================================
   HIRADC Questionnaire — Premium Design System
   Bapelkes Cikarang
   ============================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@600;700;800&display=swap');

/* ---- CSS Variables / Design Tokens ---- */
:root {
    /* Backgrounds */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2035;
    --bg-glass: rgba(17, 24, 39, 0.75);
    --bg-glass-light: rgba(255, 255, 255, 0.04);
    --bg-input: #1f2937;
    --bg-input-focus: #243044;

    /* Accents */
    --accent-primary: #f59e0b;
    --accent-primary-hover: #d97706;
    --accent-secondary: #10b981;
    --accent-danger: #ef4444;
    --accent-warning: #f97316;
    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;

    /* Text */
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-accent: #fbbf24;

    /* Borders */
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-input: rgba(255, 255, 255, 0.12);
    --border-focus: rgba(245, 158, 11, 0.5);

    /* Shadows */
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 30px rgba(245, 158, 11, 0.12);
    --shadow-button: 0 4px 15px rgba(245, 158, 11, 0.3);
    --shadow-input-focus: 0 0 0 3px rgba(245, 158, 11, 0.15);

    /* Sizing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;

    /* Risk Colors */
    --risk-low: #22c55e;
    --risk-medium: #eab308;
    --risk-high: #f97316;
    --risk-extreme: #dc2626;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(245, 158, 11, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #fcd34d 50%, var(--text-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---- Layout ---- */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* ==============================
   DEADLINE BANNER
   ============================== */
.deadline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 10px 20px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.15), rgba(16, 185, 129, 0.15));
    border-bottom: 1px solid var(--border-glass);
    backdrop-filter: blur(12px);
    color: var(--text-accent);
    display: none;
}
.deadline-banner.active { display: block; }
.deadline-banner.urgent {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.2), rgba(249, 115, 22, 0.2));
    color: var(--accent-danger);
    animation: urgentPulse 2s ease-in-out infinite;
}
.deadline-banner .countdown-icon { margin-right: 6px; }

body.has-deadline { padding-top: 42px; }

/* ==============================
   PROGRESS BAR & STEPS
   ============================== */
.progress-container {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 0 20px;
    background: linear-gradient(180deg, var(--bg-primary) 60%, transparent);
}

body.has-deadline .progress-container {
    top: 42px;
}

.progress-bar-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
    transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.step-indicators {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding: 0 10px;
}

.step-indicators::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 24px;
    right: 24px;
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-50%);
}

.step-dot {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--bg-secondary);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    z-index: 2;
}

.step-dot.completed {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    color: white;
}

.step-dot.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--bg-primary);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2), var(--shadow-glow);
    animation: stepPulse 2s ease-in-out infinite;
}

.step-dot .step-check {
    display: none;
}
.step-dot.completed .step-number { display: none; }
.step-dot.completed .step-check { display: block; font-size: 14px; }

.step-dot .step-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.step-dot:hover .step-label,
.step-dot.active .step-label {
    opacity: 1;
}

/* ==============================
   GLASS CARD (Form Sections)
   ============================== */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

/* ==============================
   FORM STEP SECTIONS
   ============================== */
.form-step {
    display: none;
    animation: stepFadeIn 400ms ease forwards;
}

.form-step.active {
    display: block;
}

.step-header {
    margin-bottom: 32px;
}

.step-header .step-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-primary);
    background: rgba(245, 158, 11, 0.1);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    margin-bottom: 12px;
}

.step-header h2 {
    font-size: 28px;
    margin-bottom: 8px;
}

.step-header p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* ==============================
   FORM CONTROLS
   ============================== */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-label .required {
    color: var(--accent-danger);
    margin-left: 2px;
}

.form-label .help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 10px;
    cursor: help;
    margin-left: 6px;
    position: relative;
    vertical-align: middle;
    transition: all var(--transition-fast);
}

.form-label .help-icon:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

/* Tooltip */
.tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-primary);
    white-space: normal;
    width: 260px;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    line-height: 1.5;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--bg-tertiary);
}

.help-icon:hover .tooltip {
    opacity: 1;
}

/* Text Input */
.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
    box-shadow: var(--shadow-input-focus);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.6;
}

/* Select */
.form-select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* Checkbox & Radio */
.checkbox-group,
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-group.horizontal,
.radio-group.horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 14px;
    background: var(--bg-glass-light);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-size: 14px;
    user-select: none;
}

.checkbox-label:hover,
.radio-label:hover {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.05);
}

.checkbox-label input,
.radio-label input {
    display: none;
}

.checkbox-label .custom-check,
.radio-label .custom-radio {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.radio-label .custom-radio {
    border-radius: 50%;
}

.checkbox-label input:checked ~ .custom-check {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    animation: checkBounce 300ms ease;
}

.radio-label input:checked ~ .custom-radio {
    border-color: var(--accent-primary);
    animation: checkBounce 300ms ease;
}

.radio-label input:checked ~ .custom-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-primary);
}

.checkbox-label input:checked ~ .custom-check::after {
    content: '✓';
    color: var(--bg-primary);
    font-size: 13px;
    font-weight: 700;
}

.checkbox-label input:checked ~ span:last-child,
.radio-label input:checked ~ span:last-child {
    color: var(--text-accent);
}

/* ==============================
   ACTIVITY CARDS (Dynamic)
   ============================== */
.activity-cards-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    animation: cardSlideIn 400ms ease forwards;
}

.activity-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.activity-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-glass);
    cursor: pointer;
    user-select: none;
}

.activity-card-header .card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 15px;
}

.activity-card-header .card-number {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--bg-primary);
}

.activity-card:nth-child(4n+1) .card-number { background: var(--accent-primary); }
.activity-card:nth-child(4n+2) .card-number { background: var(--accent-secondary); }
.activity-card:nth-child(4n+3) .card-number { background: var(--accent-blue); }
.activity-card:nth-child(4n+4) .card-number { background: var(--accent-purple); }

.activity-card:nth-child(4n+1) { border-left: 3px solid var(--accent-primary); }
.activity-card:nth-child(4n+2) { border-left: 3px solid var(--accent-secondary); }
.activity-card:nth-child(4n+3) { border-left: 3px solid var(--accent-blue); }
.activity-card:nth-child(4n+4) { border-left: 3px solid var(--accent-purple); }

.activity-card-header .card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-toggle-btn,
.card-delete-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.card-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.card-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

.activity-card-body {
    padding: 24px 20px;
    display: block;
}

.activity-card.collapsed .activity-card-body {
    display: none;
}

.activity-card.collapsed .card-toggle-btn {
    transform: rotate(-90deg);
}

/* Add Activity Button */
.add-activity-btn {
    width: 100%;
    padding: 18px;
    background: transparent;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.add-activity-btn:hover {
    border-color: var(--accent-primary);
    border-style: solid;
    color: var(--accent-primary);
    background: rgba(245, 158, 11, 0.05);
}

.add-activity-btn:active {
    transform: scale(0.98);
}

/* ==============================
   RISK MATRIX WIDGET
   ============================== */
.risk-matrix-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.risk-sliders {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-value {
    font-size: 28px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--accent-primary);
}

.slider-desc {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Custom Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-input);
    outline: none;
    transition: background var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
    transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

/* Risk Matrix Grid */
.risk-matrix-grid {
    display: grid;
    grid-template-columns: 30px repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr) 30px;
    gap: 3px;
    aspect-ratio: 1;
}

.matrix-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    transition: all var(--transition-fast);
    cursor: default;
    position: relative;
}

.matrix-cell.risk-low { background: rgba(34, 197, 94, 0.3); color: var(--risk-low); }
.matrix-cell.risk-medium { background: rgba(234, 179, 8, 0.3); color: var(--risk-medium); }
.matrix-cell.risk-high { background: rgba(249, 115, 22, 0.3); color: var(--risk-high); }
.matrix-cell.risk-extreme { background: rgba(220, 38, 38, 0.3); color: var(--risk-extreme); }

.matrix-cell.active-cell {
    animation: matrixPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 15px currentColor;
    transform: scale(1.1);
    z-index: 5;
}

.matrix-label-y,
.matrix-label-x {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Risk Result Badge */
.risk-result-badge {
    margin-top: 20px;
    padding: 20px;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all var(--transition-normal);
}

.risk-result-badge .risk-score-number {
    font-size: 48px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    line-height: 1;
}

.risk-result-badge .risk-level-label {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 4px;
}

.risk-result-badge.level-low {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--risk-low);
}
.risk-result-badge.level-medium {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: var(--risk-medium);
}
.risk-result-badge.level-high {
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.3);
    color: var(--risk-high);
}
.risk-result-badge.level-extreme {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: var(--risk-extreme);
}

/* ==============================
   CONDITIONAL FIELDS
   ============================== */
.conditional-fields {
    display: none;
    padding: 20px;
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    animation: fadeSlideDown 300ms ease forwards;
}

.conditional-fields.visible {
    display: block;
}

/* ==============================
   NAVIGATION BUTTONS
   ============================== */
.step-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-glass);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    text-decoration: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
    color: var(--bg-primary);
    box-shadow: var(--shadow-button);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(245, 158, 11, 0.05);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-danger), #dc2626);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.btn-submit {
    background: linear-gradient(135deg, var(--accent-secondary), #059669);
    color: white;
    padding: 16px 40px;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled:hover {
    box-shadow: none;
}

/* ==============================
   MODAL / POPUP
   ============================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 36px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-normal);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-card {
    transform: scale(1) translateY(0);
}

.modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
}

.modal-icon.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-secondary);
}

.modal-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-primary);
}

.modal-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-actions .btn {
    flex: 1;
    justify-content: center;
}

/* Success Animation */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.success-checkmark svg {
    width: 100%;
    height: 100%;
}

.success-checkmark .checkmark-circle {
    stroke: var(--accent-secondary);
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: checkmarkStroke 600ms cubic-bezier(0.65, 0, 0.45, 1) 300ms forwards;
}

.success-checkmark .checkmark-check {
    stroke: var(--accent-secondary);
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: checkmarkStroke 400ms cubic-bezier(0.65, 0, 0.45, 1) 700ms forwards;
}

/* Confetti */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10000;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    animation: confettiFall 3s ease-in-out forwards;
}

/* ==============================
   TOAST NOTIFICATIONS
   ============================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: toastSlideIn 300ms ease forwards;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast.success::before { background: var(--accent-secondary); }
.toast.error::before { background: var(--accent-danger); }
.toast.warning::before { background: var(--accent-warning); }
.toast.info::before { background: var(--accent-blue); }

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast.success .toast-icon { color: var(--accent-secondary); }
.toast.error .toast-icon { color: var(--accent-danger); }
.toast.warning .toast-icon { color: var(--accent-warning); }
.toast.info .toast-icon { color: var(--accent-blue); }

.toast-message {
    flex: 1;
    font-size: 13px;
    line-height: 1.5;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    animation: toastProgress 4s linear forwards;
}

.toast.success .toast-progress { background: var(--accent-secondary); }
.toast.error .toast-progress { background: var(--accent-danger); }
.toast.warning .toast-progress { background: var(--accent-warning); }
.toast.info .toast-progress { background: var(--accent-blue); }

.toast.removing {
    animation: toastSlideOut 300ms ease forwards;
}

/* ==============================
   AUTO-SAVE INDICATOR
   ============================== */
.autosave-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 90;
    transition: all var(--transition-fast);
}

.autosave-indicator.saved {
    color: var(--accent-secondary);
    border-color: rgba(16, 185, 129, 0.2);
}

.autosave-indicator .spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
    display: none;
}

.autosave-indicator.saving .spinner {
    display: block;
}

/* ==============================
   COMPLETION WIDGET
   ============================== */
.completion-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    z-index: 90;
}

.completion-circle {
    transform: rotate(-90deg);
    width: 56px;
    height: 56px;
}

.completion-circle .bg-ring {
    stroke: rgba(255, 255, 255, 0.06);
}

.completion-circle .progress-ring {
    transition: stroke-dashoffset 600ms ease;
}

.completion-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

/* ==============================
   LANDING PAGE (Step 1)
   ============================== */
.landing-content {
    text-align: center;
    padding: 20px 0;
}

.landing-content .hero-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(16, 185, 129, 0.15));
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    animation: floatIcon 3s ease-in-out infinite;
}

.landing-content h1 {
    font-size: 36px;
    margin-bottom: 8px;
}

.landing-content .subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.instruction-list {
    text-align: left;
    margin: 24px 0;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-glass);
}

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

.instruction-item .inst-number {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.instruction-item p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.start-btn-container {
    margin-top: 36px;
}

/* ==============================
   REVIEW SECTION
   ============================== */
.review-section {
    margin-bottom: 20px;
}

.review-section .review-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.review-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.review-item {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border-glass);
}

.review-item .review-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.review-item .review-value {
    font-size: 14px;
    color: var(--text-primary);
    margin-top: 2px;
}

/* ==============================
   FORM VALIDATION
   ============================== */
.form-input.error,
.form-textarea.error,
.form-select.error {
    border-color: var(--accent-danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.field-error {
    font-size: 12px;
    color: var(--accent-danger);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: fadeSlideDown 200ms ease;
}

/* Shake animation for validation failure */
.shake {
    animation: shake 400ms ease;
}

/* ==============================
   ANIMATIONS
   ============================== */
@keyframes stepPulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2); }
    50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.1); }
}

@keyframes stepFadeIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes stepFadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-30px); }
}

@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes checkBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

@keyframes matrixPulse {
    0%, 100% { box-shadow: 0 0 8px currentColor; opacity: 1; }
    50% { box-shadow: 0 0 20px currentColor; opacity: 0.85; }
}

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

@keyframes checkmarkStroke {
    to { stroke-dashoffset: 0; }
}

@keyframes confettiFall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes urgentPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

    .glass-card {
        padding: 24px 18px;
        border-radius: var(--radius-lg);
    }

    .step-header h2 {
        font-size: 22px;
    }

    .landing-content h1 {
        font-size: 26px;
    }

    .risk-matrix-container {
        grid-template-columns: 1fr;
    }

    .step-dot {
        width: 30px;
        height: 30px;
        font-size: 10px;
    }

    .step-dot .step-label {
        display: none;
    }

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

    .modal-card {
        padding: 24px;
        margin: 16px;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        max-width: none;
    }

    .completion-widget {
        bottom: 12px;
        right: 12px;
    }

    .autosave-indicator {
        bottom: 12px;
        left: 12px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 13px;
    }

    .step-navigation {
        gap: 10px;
    }

    .checkbox-group.horizontal,
    .radio-group.horizontal {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .step-indicators {
        padding: 0 4px;
    }
    
    .step-dot {
        width: 26px;
        height: 26px;
        font-size: 9px;
    }

    .landing-content .hero-icon {
        width: 72px;
        height: 72px;
        font-size: 36px;
    }
}
