/* CSS Design System - Automated Form Builder */

:root {
    --bg-dark: #09090e;
    --bg-card: rgba(18, 18, 29, 0.7);
    --border-glass: rgba(255, 255, 255, 0.08);
    --primary-color: #6366f1; /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary-color: #4b5563;
    --success-color: #10b981;
    --error-color: #f43f5e;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --font-stack: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-stack);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
    padding: 40px 20px;
}

/* Glowing Ambient Backgrounds */
.glow-bg {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, var(--primary-glow) 0%, rgba(99, 102, 241, 0) 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
}

.container {
    width: 100%;
    max-width: 950px;
    z-index: 10;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.pulse-icon {
    width: 14px;
    height: 14px;
    background-color: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--primary-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Stepper Stepper Indicators */
.stepper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    position: relative;
    padding: 0 10px;
}

.stepper::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 40px;
    right: 40px;
    height: 2px;
    background: rgba(255, 255, 255, 0.05);
    z-index: -1;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    text-align: center;
    position: relative;
}

.step-num {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #161625;
    border: 2px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-title {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: color 0.3s;
}

.step.active .step-num {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
}

.step.active .step-title {
    color: var(--primary-color);
}

.step.completed .step-num {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.step.completed .step-title {
    color: var(--success-color);
}

/* Glassmorphism Form Card */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(16px);
    transition: all 0.3s ease;
}

/* Form Steps */
.form-step {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.form-step.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.form-step h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.step-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    line-height: 1.5;
}

/* Form Layout Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 24px;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .form-group.full-width {
        grid-column: span 1;
    }
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e5e7eb;
    display: inline-flex;
    align-items: center;
}

.required {
    color: var(--error-color);
    margin-left: 4px;
}

/* Inputs & Form Controls */
input, select, textarea {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px 16px;
    color: white;
    font-family: var(--font-stack);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.25s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
    background-color: rgba(255, 255, 255, 0.05);
}

.input-with-toggle {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-with-toggle input {
    width: 100%;
    padding-right: 44px;
}

.toggle-visibility-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.2s, background-color 0.2s;
}

.toggle-visibility-btn:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.08);
}

select option {
    background-color: var(--bg-dark);
    color: white;
}

.readonly-input {
    background-color: rgba(255, 255, 255, 0.01) !important;
    border-color: rgba(255, 255, 255, 0.03) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
}

.hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.field-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: -8px;
    margin-bottom: 5px;
}

.grid-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 10px 0;
}

/* Validation styling */
input.invalid, select.invalid {
    border-color: var(--error-color) !important;
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.15) !important;
}

.error-text {
    font-size: 0.75rem;
    color: var(--error-color);
    margin-top: 4px;
}

/* Stepper Progress Bar */
.progress-bar-container {
    width: 100%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: 2px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 16.66%;
    background: linear-gradient(90deg, var(--primary-color) 0%, #a5b4fc 100%);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Checkbox and radio grid for Step 4 & 5 */
.checkbox-options-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* OF-306 Background Information instruction block */
.background-info-notice {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 4px;
}

.background-info-notice p {
    font-size: 0.78rem;
    color: rgba(209, 213, 219, 0.85);
    line-height: 1.6;
    margin-bottom: 8px;
}

.background-info-notice p:last-child {
    margin-bottom: 0;
}


.question-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px 20px;
    gap: 20px;
    transition: all 0.2s;
}

.question-row:hover {
    background-color: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.06);
}

.question-text strong {
    font-size: 0.95rem;
    font-weight: 600;
    color: #e5e7eb;
    display: block;
    margin-bottom: 4px;
}

.question-text p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.question-inputs select {
    min-width: 120px;
}

.conditional-section {
    background-color: rgba(99, 102, 241, 0.02);
    border: 1px dashed rgba(99, 102, 241, 0.15);
    border-radius: 14px;
    padding: 24px;
    margin: 10px 0;
    animation: fadeIn 0.4s ease;
}

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

/* Consent Box */
.consent-box {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 20px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.consent-box h3 {
    color: white;
    font-size: 1rem;
    font-weight: 600;
}

/* Signature Pad Canvas */
.canvas-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

canvas {
    background-color: #0b0b14;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    cursor: crosshair;
    touch-action: none;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Form Footer & Buttons */
.form-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn {
    border-radius: 10px;
    font-family: var(--font-stack);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 12px 24px;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background-color: #4f46e5;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: #e5e7eb;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background-color: #059669;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Modals & Overlays */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(9, 9, 14, 0.85);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background-color: #12121d;
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 35px 30px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

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

.modal h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.modal p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Success Modal Details */
.success-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--success-color);
    color: var(--success-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.7rem;
    font-weight: bold;
    margin: 0 auto 20px;
}

.success-modal a {
    text-decoration: none;
    display: inline-block;
    width: 100%;
}
