@import url('https://fonts.cdnfonts.com/css/uber-move-text');

:root {
    --primary-color: #316cf4;
    --primary-hover: #2156d4;
    --bg-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #1c1c1e;
    --text-muted: #8e8e93;
    --border-color: #e5e7eb;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #10b981;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --font-main: 'Uber Move Text', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

html {
    font-size: 14px;
    /* Global reduction */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 1rem;
}

/* Status Bar */
.status-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.3s;
}

.status-bar.live {
    background-color: var(--success-color);
}

.status-bar.offline {
    background-color: var(--error-color);
}

.status-bar.warning {
    background-color: var(--warning-color);
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.blink {
    animation: blinker 1.5s linear infinite;
}

@keyframes blinker {
    50% {
        opacity: 0.4;
    }
}

.btn-warning-small {
    background: white;
    color: var(--error-color);
    border: none;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: bold;
}

/* Recovery Banner */
.recovery-banner {
    position: fixed;
    top: 40px;
    left: 0;
    right: 0;
    background: #eff6ff;
    border-bottom: 1px solid #bfdbfe;
    color: #1e3a8a;
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 999;
}

.btn-primary-small {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
}

.btn-secondary-small {
    background: #e5e7eb;
    color: #374151;
    border: none;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
}

/* Global Error Banner */
.error-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--error-color);
    color: white;
    text-align: center;
    padding: 1rem;
    z-index: 2000;
    font-weight: bold;
}

.container {
    background: var(--surface-color);
    width: 100%;
    max-width: 800px;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin: 6rem 1rem 2rem 1rem;
    /* Space for the status bar */
}

/* Page Transitions & Headers */
.main-portal-header {
    text-align: center;
    margin-bottom: 2rem;
}

/* .mt-status is applied when the recovery banner shifts the container down */
.mt-status {
    transition: margin-top 0.2s ease;
}

body:has(#step-1.active) .main-portal-header {
    display: none;
}

.step-header {
    margin-bottom: 2.5rem;
}

.step-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.icon-blue {
    color: var(--primary-color);
}

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

.header-divider {
    border: 0;
    border-top: 1px solid #f0f0f0;
    margin-top: 1.5rem;
}

/* Inputs & Forms */
.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

label.required::after {
    content: " *";
    color: var(--error-color);
}

span.required::after {
    content: " *";
    color: var(--error-color);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-wrapper input {
    padding-left: 2.75rem !important;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

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

input.invalid,
select.invalid,
textarea.invalid {
    border-color: var(--error-color);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}

.error-msg {
    display: block;
    color: var(--error-color);
    font-size: 0.75rem;
    margin-top: 0.3rem;
    min-height: 14px;
}

.readonly-input {
    background-color: #f3f4f6 !important;
    color: #6b7280 !important;
    border-style: dashed;
    cursor: not-allowed;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.input-group-compact {
    margin-bottom: 0.75rem;
}

.input-group-compact label {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-muted);
}

.input-group-compact input {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

/* Modern Radio Options */
.field-label {
    display: block;
    font-weight: 700;
    color: #4a4a4a;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.radio-options-modern {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.modern-radio {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: #4a4a4a;
    font-size: 1rem;
}

.modern-radio input {
    display: none;
}

.radio-custom {
    width: 22px;
    height: 22px;
    border: 2px solid #d1d1d1;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s;
}

.modern-radio input:checked+.radio-custom {
    border-color: var(--primary-color);
}

.modern-radio input:checked+.radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background-color: var(--primary-color);
    border-radius: 50%;
}

/* Modern Input Style */
.modern-input-wrapper {
    position: relative;
    margin-bottom: 2rem;
}

.search-icon-fancy {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #a0a0a0;
    font-size: 1.1rem;
}

.modern-input-wrapper input {
    width: 100%;
    padding: 1.25rem 1.25rem 1.25rem 3.5rem;
    background-color: #eff4ff;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.2s;
    color: #333;
}

.modern-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(49, 108, 244, 0.1);
}

.btn-full-width {
    width: 100%;
    padding: 1.1rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s;
}

.btn-full-width:hover {
    background-color: var(--primary-hover);
}

.btn-full-width:active {
    transform: scale(0.98);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-left: 4px solid var(--primary-color);
}

.radio-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    /* Allow groups to wrap if space is tight */
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
    /* Keep label text on one line */
}

/* Buttons */
button {
    cursor: pointer;
    border: none;
    border-radius: var(--radius);
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

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

.btn-secondary {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-submit {
    background: var(--success-color);
    color: white;
    flex: 1;
}

.btn-submit:hover:not(:disabled) {
    background: #059669;
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

/* Loading State */
.loading {
    pointer-events: none;
    color: transparent !important;
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.hidden {
    display: none !important;
}

/* Review List iOS style */
.ios-style-container {
    max-width: 600px;
    margin: 0 auto;
}

.ios-group {
    margin-bottom: 2rem;
}

.ios-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.ios-list {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.ios-row {
    display: flex;
    justify-content: space-between;
    padding: 0.9rem;
    border-bottom: 1px solid #f2f2f7;
}

.ios-row:last-child {
    border-bottom: none;
}

.ios-row .label {
    font-size: 0.9rem;
    font-weight: 500;
}

.ios-row .value {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: right;
}

.consent-section {
    background: #f8fafc;
    padding: 1.5rem;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
    margin-top: 2rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    margin-top: 1rem;
    font-size: 1rem;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    transform: scale(1.2);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #fff;
    border-left: 4px solid var(--primary-color);
    padding: 1.25rem 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 2000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success-color);
}

.toast.error {
    border-color: var(--error-color);
}

@media (max-width: 600px) {

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .search-container {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1rem;
    }

    .search-actions {
        justify-content: center;
    }

    .search-actions .btn-primary {
        width: 100%;
    }

    .status-bar {
        flex-direction: column;
        height: auto;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .container {
        margin-top: 5rem;
    }
}