/* ============================================
   AUREUS GYM – Web Registration Form
   Mobile-first, Dark Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg: #050505;
    --surface: #0A0A0A;
    --card: #121212;
    --card-border: #2A2A2A;
    --input-bg: #1A1A1A;
    --input-border: #333333;
    --input-focus: #7B61FF;
    --primary: #7B61FF;
    --primary-glow: rgba(123, 97, 255, 0.28);
    --gold: #FFD700;
    --gold-glow: rgba(255, 215, 0, 0.15);
    --success: #10B981;
    --success-glow: rgba(16, 185, 129, 0.2);
    --error: #EF4444;
    --error-glow: rgba(239, 68, 68, 0.15);
    --warning: #FFA500;
    --text: #FFFFFF;
    --text-secondary: #A0A0A0;
    --text-dim: #6B6B6B;
    --radius: 16px;
    --radius-sm: 12px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* Fluid root so type/spacing scale across phones without overflow */
    font-size: clamp(14px, 3.7vw, 16px);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Universal text containment — headings never jump off-screen */
h1, h2, h3, h4, h5, h6,
.gym-name,
.gym-tagline,
.section-title,
.collapse-title,
.plan-name,
.success-title,
.error-title,
.toggle-label,
.subsection-label,
.input-label {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}

/* ---- Loading Screen ---- */
#loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-ring {
    width: 48px;
    height: 48px;
    border: 3px solid var(--card-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-text {
    margin-top: 16px;
    color: var(--text-dim);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* ---- Error Screen ---- */
#error-screen {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    padding: 32px;
    text-align: center;
}

#error-screen.visible {
    display: flex;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-title {
    font-size: clamp(1.05rem, 4.5vw, 1.25rem);
    font-weight: 700;
    margin-bottom: 8px;
    padding: 0 8px;
}

.error-message {
    color: var(--text-dim);
    font-size: clamp(0.8rem, 3.4vw, 0.9rem);
    max-width: 320px;
    padding: 0 12px;
}

/* ---- Success Screen ---- */
#success-screen {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    padding: 32px;
    text-align: center;
}

#success-screen.visible {
    display: flex;
}

.success-checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--success-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-checkmark svg {
    width: 40px;
    height: 40px;
    stroke: var(--success);
    stroke-width: 2.5;
    fill: none;
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.success-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 32px;
    max-width: 300px;
}

.success-info {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 20px 24px;
    max-width: 340px;
    width: 100%;
}

.success-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.success-info-row:not(:last-child) {
    border-bottom: 1px solid var(--card-border);
}

.success-info-icon {
    font-size: 1.25rem;
}

.success-info-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ---- Main Container ---- */
.app-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 max(16px, env(safe-area-inset-right, 0px)) calc(40px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* ---- Header ---- */
.gym-header {
    text-align: center;
    padding: clamp(20px, 6vw, 32px) 8px clamp(16px, 4vw, 24px);
    width: 100%;
}

.gym-logo {
    width: clamp(56px, 18vw, 72px);
    height: clamp(56px, 18vw, 72px);
    border-radius: 18px;
    object-fit: cover;
    border: 2px solid var(--card-border);
    margin: 0 auto 12px;
    background: var(--card);
}

.gym-logo.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(22px, 7vw, 28px);
    font-weight: 800;
    color: var(--primary);
    background: linear-gradient(135deg, var(--card), #1a1a2e);
}

.gym-name {
    font-size: clamp(1.05rem, 4.5vw, 1.35rem);
    font-weight: 700;
    margin: 0 auto 4px;
    line-height: 1.25;
    padding: 0 4px;
}

.gym-tagline {
    color: var(--text-dim);
    font-size: clamp(0.72rem, 3.2vw, 0.82rem);
    letter-spacing: 0.2px;
    line-height: 1.35;
    padding: 0 8px;
}

/* ---- Section ---- */
.form-section {
    margin-bottom: clamp(16px, 4vw, 24px);
    width: 100%;
    min-width: 0;
}

.section-title {
    font-size: clamp(0.65rem, 2.8vw, 0.75rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 12px;
    padding-left: 2px;
    padding-right: 2px;
    line-height: 1.3;
}

/* ---- Form Cards ---- */
.form-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: clamp(14px, 4vw, 18px) clamp(12px, 3.5vw, 16px);
    margin-bottom: 0;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

/* ---- Input Groups ---- */
.input-group {
    margin-bottom: 14px;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.input-label .required {
    color: var(--primary);
    font-weight: 700;
}

.input-wrapper {
    position: relative;
}

.input-field {
    width: 100%;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    min-height: 52px;
    font-size: 0.95rem;
    color: var(--text);
    font-family: var(--font);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

select.input-field {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.input-field::placeholder {
    color: var(--text-dim);
}

.input-field:focus {
    border-color: var(--input-focus);
    background: #1F1A2E;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-field:read-only {
    color: var(--text-secondary);
    opacity: 0.9;
}

.input-field.error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px var(--error-glow);
}

.input-row {
    display: flex;
    gap: 10px;
}

.input-row .input-group {
    flex: 1;
}

.vitals-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.vitals-row .input-group {
    margin-bottom: 0;
}

textarea.input-field {
    resize: vertical;
    min-height: 96px;
    padding-top: 14px;
}

/* ---- OTP Section ---- */
.otp-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    width: 100%;
    min-width: 0;
}

.otp-row .input-group {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.otp-btn {
    flex: 0 0 auto;
    max-width: 42%;
    height: 52px;
    margin-top: 0;
    padding: 0 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: clamp(0.7rem, 3vw, 0.8rem);
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: normal;
    line-height: 1.2;
    text-align: center;
}

.otp-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.otp-btn:not(:disabled):active {
    transform: scale(0.96);
}

.otp-verified {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--success);
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 4px;
}

/* ---- Plan Cards ---- */
.plans-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plan-card {
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 14px;
    user-select: none;
    -webkit-user-select: none;
}

.plan-card:active {
    transform: scale(0.985);
}

.plan-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(123, 97, 255, 0.06);
}

.plan-radio {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--input-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.plan-card.selected .plan-radio {
    border-color: var(--primary);
}

.plan-radio-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    transform: scale(0);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.plan-card.selected .plan-radio-dot {
    transform: scale(1);
}

.plan-info {
    flex: 1;
    min-width: 0;
}

.plan-name {
    font-size: clamp(0.85rem, 3.6vw, 0.95rem);
    font-weight: 600;
    margin-bottom: 2px;
    line-height: 1.3;
}

.plan-duration {
    font-size: clamp(0.7rem, 3vw, 0.78rem);
    color: var(--text-dim);
}

.plan-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

/* ---- File Upload ---- */
.file-upload {
    border: 2px dashed var(--input-border);
    border-radius: var(--radius-sm);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.file-upload:active {
    transform: scale(0.98);
}

.file-upload.has-file {
    border-color: var(--success);
    border-style: solid;
    background: var(--success-glow);
}

.file-upload-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.file-upload-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.file-upload-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.file-upload input[type="file"] {
    display: none;
}

/* ---- Checkbox (Medical Disclaimer) ---- */
.checkbox-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.custom-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--input-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-top: 2px;
}

.custom-checkbox.checked {
    background: var(--primary);
    border-color: var(--primary);
}

.custom-checkbox svg {
    width: 14px;
    height: 14px;
    stroke: #fff;
    stroke-width: 3;
    fill: none;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-checkbox.checked svg {
    opacity: 1;
    transform: scale(1);
}

.checkbox-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ---- Submit Button ---- */
.submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), #6248e0);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    margin-top: 20px;
}

.submit-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.submit-btn:not(:disabled):hover::before {
    transform: translateX(100%);
}

.submit-btn:not(:disabled):active {
    transform: scale(0.97);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.submit-btn .btn-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

/* ---- Toast notifications ---- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 14px 20px;
    font-size: 0.88rem;
    color: var(--text);
    z-index: 10000;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    max-width: 90vw;
    text-align: center;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.12);
}

.toast.success {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.12);
}

/* ---- Micro-animations ---- */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-section:nth-child(1) {
    animation-delay: 0.05s;
}

.form-section:nth-child(2) {
    animation-delay: 0.1s;
}

.form-section:nth-child(3) {
    animation-delay: 0.15s;
}

.form-section:nth-child(4) {
    animation-delay: 0.2s;
}

.form-section:nth-child(5) {
    animation-delay: 0.25s;
}

/* ---- Footer ---- */
.form-footer {
    text-align: center;
    padding: 24px 0 16px;
    color: var(--text-dim);
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

.form-footer a {
    color: var(--primary);
    text-decoration: none;
}

/* ---- Add Member parity: collapsibles / checks / toggles ---- */
.helper-text {
    color: var(--text-dim);
    font-size: 0.72rem;
    margin-top: 8px;
    line-height: 1.35;
}

.collapse-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
}

.collapse-summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    min-height: 64px;
    min-width: 0;
}

.collapse-summary::-webkit-details-marker { display: none; }

.collapse-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: clamp(0.85rem, 3.6vw, 0.95rem);
    color: var(--text);
    line-height: 1.3;
}

.collapse-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(123, 97, 255, 0.14);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.collapse-icon svg {
    width: 20px;
    height: 20px;
}

.collapse-chevron {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.2s ease;
}

.collapse-card[open] .collapse-chevron {
    transform: rotate(180deg);
}

.collapse-body {
    padding: 4px 16px 18px;
    border-top: 1px solid var(--card-border);
}

.subsection-label {
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin: 14px 0 10px;
}

.check-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.check-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    font-size: 0.84rem;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    user-select: none;
}

.check-chip:has(input:checked) {
    border-color: var(--primary);
    background: rgba(123, 97, 255, 0.12);
}

.check-chip input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.check-chip span {
    position: relative;
    padding-left: 28px;
    line-height: 1.3;
}

.check-chip span::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid #444;
    background: #151515;
}

.check-chip input:checked + span::before {
    border-color: var(--primary);
    background: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0 4px;
    cursor: pointer;
}

.toggle-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.toggle-sub {
    color: var(--text-dim);
    font-size: 0.75rem;
    margin-top: 3px;
}

.switch {
    position: relative;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #333;
    transition: background 0.2s ease;
}

.switch-track::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: transform 0.2s ease;
}

.switch input:checked + .switch-track {
    background: var(--primary);
}

.switch input:checked + .switch-track::after {
    transform: translateX(20px);
}

.warning-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 165, 0, 0.1);
    border: 1px solid rgba(255, 165, 0, 0.35);
    color: var(--warning);
    font-size: 0.8rem;
    line-height: 1.45;
}

.warning-box svg {
    flex-shrink: 0;
    margin-top: 1px;
}

.disclaimer-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 14px;
    padding: 14px;
    border-radius: 12px;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    cursor: pointer;
}

.disclaimer-box .checkbox-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.submit-btn {
    letter-spacing: 0.8px;
    font-weight: 700;
    min-height: 54px;
    border-radius: 14px;
    margin-top: 8px;
}

@media (max-width: 400px) {
    .check-grid {
        grid-template-columns: 1fr;
    }
    .vitals-row {
        grid-template-columns: 1fr 1fr;
    }
    .otp-row {
        flex-wrap: wrap;
    }
    .otp-btn {
        width: 100%;
        max-width: none;
        height: 48px;
    }
}

@media (max-width: 340px) {
    .vitals-row {
        grid-template-columns: 1fr;
    }
}

/* ---- Responsive (tablet+) ---- */
@media (min-width: 600px) {
    .app-container {
        padding-top: 20px;
    }

    .gym-header {
        padding-top: 48px;
    }
}