*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root { --blue: #2B3D91; --blue-dk: #1b275e; --orange: #ff4d00; --gold: #FDC12F; --black: #111; --border: #e0e0e0; --grey: #f5f5f5; --mid: #666; --radius: 10px; }
body { font-family: 'DM Sans', sans-serif; background: var(--grey); min-height: 100vh; }

/* Global SVG Constraint - Prevent massive icons on large screens */
svg:not(.iti__country-list svg):not(.nav-logo svg) {
    max-width: 1.5rem; 
    height: auto;
    vertical-align: middle;
}
nav { background: var(--blue); height: 80px; display: flex; align-items: center; justify-content: space-between; padding: 0 40px; border-bottom: 3px solid var(--gold); }
.nav-logo { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 24px; color: #fff; text-decoration: none; }
.nav-logo span { color: var(--gold); }
.nav-menu { display: flex; align-items: center; gap: 24px; }
.nav-link { color: rgba(255, 255, 255, 0.85); text-decoration: none; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; transition: color 0.2s, opacity 0.2s; }
.nav-link i { font-size: 16px; color: var(--gold); }
.nav-link:hover { color: #fff; opacity: 1; }
.nav-link.logout { color: var(--orange); }
.nav-link.logout i { color: var(--orange); }
.nav-login-link { background: var(--gold); color: var(--blue); padding: 8px 24px; border-radius: 5px; font-family: 'Syne', sans-serif; font-weight: 700; text-decoration: none; font-size: 14px; transition: transform 0.1s; }
.nav-login-link:hover { transform: scale(1.05); }

/* Mobile Nav Adjustments */
@media (max-width: 900px) {
    nav { height: auto; flex-direction: column; padding: 20px 16px; gap: 16px; }
    .nav-menu { flex-wrap: wrap; justify-content: center; gap: 12px 20px; }
}
.page-wrap { max-width: 440px; margin: 60px auto; padding: 0 16px 60px; }
.card { background: #fff; border-radius: var(--radius); box-shadow: 0 4px 28px rgba(0, 0, 0, .08); overflow: visible; border: 1px solid var(--border); }
.card-header { background: var(--blue); color: #fff; padding: 20px 28px; font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; text-align: center; border-bottom: 2px solid var(--gold); }
.card-body { padding: 28px 28px 32px; }
.field-group { margin-bottom: 18px; }
.field-group label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: #444; margin-bottom: 6px; }
.field-group label .req { color: var(--orange); }
.field-group input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 7px; font-size: 15px; font-family: 'DM Sans', sans-serif; outline: none; transition: border-color .2s; }
.field-group input:focus { border-color: var(--orange); }
.btn-login, .btn-register, .btn-submit { width: 100%; background: var(--gold); color: var(--blue); border: none; padding: 14px; border-radius: 7px; font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 800; cursor: pointer; transition: background .2s, transform .1s; box-shadow: 0 4px 0 #d4a327; }
.btn-login:hover, .btn-register:hover, .btn-submit:hover { background: #ffca4a; }
.btn-login:active, .btn-register:active, .btn-submit:active { transform: translateY(2px); box-shadow: 0 2px 0 #d4a327; }
.btn-login:disabled, .btn-register:disabled, .btn-submit:disabled { background: #ccc; cursor: not-allowed; box-shadow: none; }
.links, .back-link, .login-link { text-align: center; margin-top: 18px; font-size: 14px; color: var(--mid); }
.links a, .back-link a, .login-link a { color: var(--orange); font-weight: 600; text-decoration: none; }
.links .divider { margin: 0 8px; color: #ccc; }

.alert { border-radius: 7px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert.show { display: block; }

/* Register specific */
.invite-banner { background: linear-gradient(90deg, var(--blue) 0%, var(--blue-dk) 100%); color: #fff; padding: 18px 24px; text-align: center; border-bottom: 3px solid var(--gold); }
.invite-banner h2 { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.invite-banner p { font-size: 14px; opacity: .85; }
.invite-banner .discount-pill { display: inline-block; background: var(--gold); color: var(--blue); font-family: 'Syne', sans-serif; font-weight: 800; font-size: 22px; padding: 4px 18px; border-radius: 30px; margin: 10px 0 4px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.field-group .field-error { display: none; font-size: 12px; color: #c00; margin-top: 4px; }
.field-group.has-error input { border-color: #c00; }
.field-group.has-error .field-error { display: block; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.terms { font-size: 12px; color: #888; margin-top: 14px; text-align: center; line-height: 1.5; }

/* Refer specific */
.hero { background: linear-gradient(135deg, var(--blue) 0%, #1b275e 60%, #111 100%); color: #fff; padding: 64px 24px 80px; text-align: center; position: relative; overflow: hidden; border-bottom: 4px solid var(--gold); }
.hero-badge { display: inline-block; background: rgba(253, 193, 47, .15); border: 1px solid var(--gold); color: var(--gold); font-size: 13px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; padding: 5px 16px; border-radius: 20px; margin-bottom: 20px; }
.hero h1 { font-family: 'Syne', sans-serif; font-size: clamp(32px, 5vw, 54px); font-weight: 800; line-height: 1.1; margin-bottom: 16px; }
.hero h1 span { color: var(--gold); }
.hero p { font-size: 18px; opacity: .8; max-width: 520px; margin: 0 auto; line-height: 1.6; }
.how-section { padding: 56px 24px; background: #fff; border-bottom: 1px solid var(--border); }
.how-section h2 { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 40px; }
.steps { display: flex; gap: 20px; max-width: 860px; margin: 0 auto; flex-wrap: wrap; justify-content: center; }
.step { flex: 1; min-width: 180px; max-width: 200px; text-align: center; }
.step-num { width: 52px; height: 52px; border-radius: 50%; background: var(--blue); color: #fff; border: 2px solid var(--gold); font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.step h4 { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.step p { font-size: 13px; color: var(--mid); line-height: 1.5; }
.rewards { display: flex; gap: 16px; max-width: 580px; margin: 0 auto 48px; flex-wrap: wrap; justify-content: center; }
.reward-badge { background: #fff; border: 2px solid var(--blue); border-radius: var(--radius); padding: 16px 28px; text-align: center; flex: 1; min-width: 200px; box-shadow: 0 4px 12px rgba(43, 61, 145, 0.08); }
.reward-badge .amount { font-family: 'Syne', sans-serif; font-size: 36px; font-weight: 800; color: var(--blue); }
.reward-badge .label { font-size: 13px; color: var(--mid); margin-top: 4px; }
.form-section { padding: 56px 24px 72px; background: var(--grey); }
.form-card { max-width: 560px; margin: 0 auto; background: #fff; border-radius: var(--radius); box-shadow: 0 4px 32px rgba(0, 0, 0, .08); overflow: visible; }
.form-header { background: var(--blue); color: #fff; padding: 22px 28px; font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 700; border-bottom: 2px solid var(--gold); }
.form-body { padding: 32px 28px; }
.referrals-section { max-width: 860px; margin: 0 auto; padding: 0 24px 64px; }
.referrals-section h3 { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 700; margin-bottom: 20px; margin-top: 48px; }
.ref-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 12px rgba(0, 0, 0, .06); }
.ref-table th { background: var(--black); color: #fff; padding: 12px 16px; text-align: left; font-family: 'Syne', sans-serif; font-size: 13px; }
.ref-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.ref-table tr:last-child td { border-bottom: none; }
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.s-Pending { background: #fff3cd; color: #856404; }
.s-Registered { background: #cce5ff; color: #004085; }
.s-Completed { background: #d4edda; color: #155724; }
.s-Rewarded { background: #d1ecf1; color: #0c5460; }
.wallet-bar { background: linear-gradient(90deg, var(--blue), var(--blue-dk)); color: #fff; padding: 14px 24px; display: flex; align-items: center; justify-content: center; gap: 12px; font-family: 'Syne', sans-serif; border-bottom: 2px solid var(--gold); }
.wallet-bar .wallet-amount { font-size: 24px; font-weight: 800; color: var(--gold); }
footer { background: var(--black); color: #888; text-align: center; padding: 20px; font-size: 13px; }
@media (max-width: 600px) { .steps { flex-direction: column; align-items: center; } .step { max-width: 100%; } }

/* Extra specific parts */
.info-box { background: #e7f3ff; border: 1px solid #b6d4fe; border-radius: 7px; padding: 14px; margin-bottom: 20px; font-size: 13px; color: #084298; }
.info-box strong { color: #052c65; }
.warning-box { background: #fff3cd; border: 1px solid #ffc107; border-radius: 7px; padding: 14px; margin-bottom: 20px; font-size: 13px; color: #856404; }
.warning-box strong { color: #664d03; }
.password-rules { background: #f8f9fa; border-radius: 7px; padding: 14px; margin-bottom: 20px; font-size: 13px; color: #495057; }
.password-rules ul { margin: 8px 0 0 18px; }
.password-rules li { margin-bottom: 4px; }

/* AJAX loading states */
.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Password Toggle Support */
.pw-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.pw-wrapper input {
    padding-right: 40px !important; /* Make room for the eye icon */
}
.toggle-password {
    position: absolute;
    right: 12px;
    cursor: pointer;
    color: #888;
    z-index: 10;
    transition: color 0.2s;
    user-select: none;
}
.toggle-password:hover {
    color: var(--orange);
}

/* ── Action Buttons for Referrals ── */
.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: #fff !important;
    text-decoration: none;
    font-size: 14px;
    transition: transform 0.2s, opacity 0.2s;
}

.act-btn:hover {
    transform: scale(1.1);
    opacity: 0.9;
}

.act-btn.wa { background: #25D366; } /* WhatsApp Green */
.act-btn.mail { background: #0078D4; } /* Email Blue */
.act-btn.call { background: #2B3D91; } /* Sutton Cars Navy */

.ref-table th:last-child {
    text-align: right;
    padding-right: 15px;
}

/* ── intl-tel-input Overrides ── */
.iti { 
    width: 100% !important; 
    display: block !important; 
    margin-bottom: 0; 
}

/* Ensure the input inside ITI matches other inputs */
.iti input {
    display: block !important;
    width: 100% !important;
    padding: 10px 10px 10px 43px !important; 
    line-height: normal !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    border: 1px solid #cccccc !important;
    background-color: white !important;
    box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.1) !important;
    outline: none !important;
    height: 42px !important; /* Force height matching */
}

/* Fix dropdown overlap and styling */
.iti__country-list {
    z-index: 1000 !important;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid var(--border);
    max-height: 200px;
    background-color: #fff;
}

.iti__selected-country {
    border-radius: 7px 0 0 7px;
}
