/* ===========================================================
   THEME 1 — SISTEMA DE INDICAÇÃO
   Arquivo refatorado (Opção 3)
   Mantém fidelidade visual com grande limpeza estrutural
   =========================================================== */

/* -----------------------------------------------------------
   ROOT TOKENS
----------------------------------------------------------- */
:root {
    --ref-bg: #f3f5fb;
    --ref-bg-accent: #e5edff;
    --ref-card-bg: #ffffff;
    --ref-border-soft: rgba(18, 42, 118, 0.08);
    --ref-shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.12);
    --ref-radius-xl: 24px;
    --ref-radius-lg: 18px;
    --ref-radius-pill: 999px;
    --ref-step-bg: rgba(255, 255, 255, 0.7);
    --ref-input-bg: #f9fafb;
    --ref-input-border: rgba(0, 0, 0, 0.12);
    --ref-focus-ring: rgba(37, 99, 235, 0.18);
    --ref-primary: #1d4ed8;
    --ref-primary-dark: #0f172a;
}

/* -----------------------------------------------------------
   BASE
----------------------------------------------------------- */
.referral-body {
    min-height: 100vh;
    margin: 0;
    font-family: system-ui, sans-serif;
    background: radial-gradient(circle at top left, var(--ref-bg-accent), var(--ref-bg));
    color: var(--ref-primary-dark);
    display: flex;
    flex-direction: column;
}

.referral-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* -----------------------------------------------------------
   HEADER
----------------------------------------------------------- */
.referral-header {
    padding: 16px 0;
}

.referral-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.referral-logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.referral-logo-area img {
    height: 142px;
}

.referral-system-title {
    display: flex;
    flex-direction: column;
}

.referral-system-title span:first-child {
    font-size: .85rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-weight: 600;
    color: #6b7280;
}

.referral-system-title span:last-child {
    font-size: .95rem;
    font-weight: 500;
}

/* Badge */
.referral-badge {
    padding: 6px 14px;
    border-radius: var(--ref-radius-pill);
    background: rgba(37, 99, 235, 0.06);
    color: var(--ref-primary);
    font-size: .8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* -----------------------------------------------------------
   CARD PRINCIPAL
----------------------------------------------------------- */
.referral-main {
    padding: 24px 0 40px;
}

.referral-card {
    background: var(--ref-card-bg);
    border-radius: var(--ref-radius-xl);
    border: 1px solid var(--ref-border-soft);
    box-shadow: var(--ref-shadow-soft);
    padding: 28px;
    position: relative;
    overflow: hidden;
}

.referral-card::before {
    content: "";
    position: absolute;
    inset: auto -40%;
    top: -120px;
    height: 220px;
    background: radial-gradient(circle at top, rgba(37, 99, 235, 0.10), transparent);
    opacity: .6;
}

/* Card inner */
.referral-card-inner {
    position: relative;
    z-index: 2;
}

/* -----------------------------------------------------------
   CAMPANHA HEADER
----------------------------------------------------------- */
.referral-campaign-header {
    display: grid;
    grid-template-columns: 1.8fr 1.2fr;
    gap: 32px;
    margin-bottom: 24px;
}

@media (max-width: 992px) {
    .referral-campaign-header {
        grid-template-columns: 1fr;
    }
}

.referral-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: var(--ref-radius-pill);
    background: rgba(15, 23, 42, 0.03);
    font-size: .8rem;
    color: #6b7280;
    margin-bottom: 10px;
}

.referral-pill strong {
    color: var(--ref-primary);
}

.referral-title {
    font-size: clamp(1.6rem, 3vw, 2rem);
    font-weight: 700;
    margin-bottom: 8px;
}

.referral-subtitle {
    font-size: .98rem;
    color: #4b5563;
    max-width: 520px;
}

/* Highlight banner */
.referral-highlight-banner {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--ref-radius-lg);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.04), rgba(16, 185, 129, 0.03));
    display: flex;
    gap: 10px;
}

/* -----------------------------------------------------------
   BLOCO DO DONO DA CAMPANHA
----------------------------------------------------------- */
.referral-owner-block {
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--ref-radius-lg);
    border: 1px solid rgba(15, 23, 42, 0.06);
    padding: 14px 16px;
}

.referral-owner-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #9ca3af;
}

.referral-owner-type {
    font-size: .85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.referral-owner-name {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Escolas participantes */
.referral-owner-extra {
    margin-top: 8px;
    border-top: 1px dashed rgba(148, 163, 184, .6);
    padding-top: 8px;
}

.referral-school-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 140px;
    overflow-y: auto;
}

.select2-container {
    width: 100% !important;
    display: block;
}

.select2-container--default .select2-selection--single {
    height: 46px;
    border-radius: var(--ref-radius-pill);
    border: 1px solid var(--ref-input-border);
    background: var(--ref-input-bg);
    padding: 0 42px 0 14px;
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    background: #fff;
    border-color: var(--ref-primary);
    box-shadow: 0 0 0 3px var(--ref-focus-ring);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--ref-primary-dark);
    line-height: 44px;
    padding: 0;
    font-size: .92rem;
    font-weight: 500;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #6b7280;
    font-weight: 400;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 44px;
    right: 14px;
    width: 16px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #64748b transparent transparent transparent;
    border-width: 5px 4px 0 4px;
    margin-left: -4px;
    margin-top: -2px;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #64748b transparent;
    border-width: 0 4px 5px 4px;
}

.select2-dropdown {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.16);
    overflow: hidden;
    margin-top: 8px;
}

.select2-search--dropdown {
    padding: 12px;
    background: linear-gradient(180deg, rgba(241, 245, 249, .85), rgba(255, 255, 255, 0));
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--ref-input-border);
    border-radius: 14px;
    padding: 11px 14px;
    background: #fff;
    font-size: .92rem;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    outline: none;
    border-color: var(--ref-primary);
    box-shadow: 0 0 0 3px var(--ref-focus-ring);
}

.select2-results__option {
    padding: 11px 14px;
    font-size: .92rem;
    transition: background-color .15s ease, color .15s ease;
}

.select2-results {
    padding: 0 8px 8px;
}

.select2-container--default .select2-results__option--selected {
    background: rgba(29, 78, 216, .10);
    color: #1e3a8a;
    font-weight: 600;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: rgba(29, 78, 216, .12);
    color: #1e3a8a;
    font-weight: 600;
}

.select2-container--default .select2-results__option--selectable:active {
    background: rgba(29, 78, 216, .16);
    color: #1e3a8a;
}

/* -----------------------------------------------------------
   LOGIN ALERT
----------------------------------------------------------- */
.referral-login-alert {
    margin: 16px 0;
    border-radius: var(--ref-radius-lg);
    border: 1px solid rgba(37, 99, 235, .18);
    background: rgba(239, 246, 255, .85);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

/* -----------------------------------------------------------
   BLOCO DO USUÁRIO
----------------------------------------------------------- */
.referral-user-block {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--ref-radius-lg);
    background: rgba(248, 250, 252, .9);
    border: 1px solid rgba(148, 163, 184, .4);
}

.referral-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    color: #fff;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* -----------------------------------------------------------
   STEPS
----------------------------------------------------------- */
.referral-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.referral-step {
    flex: 1 1 120px;
    padding: 10px 12px;
    background: var(--ref-step-bg);
    border-radius: var(--ref-radius-lg);
    border: 1px solid rgba(148, 163, 184, .4);
    display: flex;
    gap: 10px;
}

.referral-step-number {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 999px;
    background: var(--ref-primary-dark);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* -----------------------------------------------------------
   FORM SECTIONS
----------------------------------------------------------- */
.referral-section-card {
    background: white;
    border-radius: var(--ref-radius-lg);
    border: 1px solid rgba(148, 163, 184, .35);
    padding: 18px;
    margin-bottom: 14px;
}

.referral-hidden {
    display: none !important;
}

.input-field,
.form-control {
    border-radius: var(--ref-radius-pill);
    border: 1px solid var(--ref-input-border);
    background: var(--ref-input-bg);
    padding: 10px 14px;
    font-size: .92rem;
}

.input-field:focus {
    background: #fff;
    border-color: var(--ref-primary);
    box-shadow: 0 0 0 3px var(--ref-focus-ring);
}

/* Radios customizados */
.custom-radio {
    display: flex;
    gap: 10px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: var(--ref-radius-pill);
}

.custom-radio:hover {
    background: rgba(248, 250, 252, .9);
}

.custom-radio input {
    display: none;
}

.radio-mark {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(148, 163, 184, .9);
    border-radius: 50%;
}

input:checked+.radio-mark {
    background: var(--ref-primary);
    border-color: var(--ref-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .35);
}

input:checked+.radio-mark::after {
    content: "";
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
}

/* Submit */
.referral-submit-btn {
    padding: 10px 22px;
    border-radius: var(--ref-radius-pill);
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff;
    font-weight: 600;
    border: none;
    box-shadow: 0 14px 30px rgba(37, 99, 235, .4);
}

/* -----------------------------------------------------------
   FOOTER
----------------------------------------------------------- */
.referral-footer {
    background: white;
    border-top: 1px solid rgba(0, 0, 0, .06);
    padding: 38px 0 24px;
    margin-top: 40px;
}

.referral-footer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.referral-footer-links a {
    font-size: .9rem;
    font-weight: 500;
    color: var(--ref-primary);
}

/* -----------------------------------------------------------
   SWEETALERT OVERRIDES
----------------------------------------------------------- */
.swal-title-lg {
    font-size: 1.5rem !important;
    font-weight: 700;
}

.swal-text-lg {
    font-size: 1.05rem !important;
}

.swal-popup-lg {
    border-radius: 20px !important;
}

/* -----------------------------------------------------------
   REGULAMENTO
----------------------------------------------------------- */

.referral-regulation-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(
        135deg,
        rgba(13, 110, 253, 0.06),
        rgba(13, 110, 253, 0.02)
    );
    border: 1px solid rgba(13, 110, 253, 0.15);
}

.referral-regulation-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(13, 110, 253, 0.12);
    color: #0d6efd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.referral-regulation-content {
    flex: 1;
}

.referral-regulation-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #0d6efd;
}

.referral-regulation-text {
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.3;
}

.referral-regulation-action .btn {
    padding: 6px 14px;
    font-size: 0.8rem;
}

/* -----------------------------------------------------------
   TELA DE SUCESSO — MODO AFILIADO
----------------------------------------------------------- */
.referral-success-screen {
    padding: 56px 24px 48px;
    text-align: center;
    animation: refSuccessFadeUp 0.5s ease both;
}

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

.referral-success-icon-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.referral-success-circle {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 20px rgba(16, 185, 129, 0.10), 0 10px 30px rgba(16, 185, 129, 0.28);
    animation: refSuccessScale 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes refSuccessScale {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.referral-success-check {
    font-size: 2.2rem;
    color: #fff;
    animation: refCheckPop 0.3s ease 0.35s both;
}

@keyframes refCheckPop {
    from { transform: scale(0) rotate(-20deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg);  opacity: 1; }
}

.referral-success-title {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    font-weight: 700;
    color: var(--ref-primary-dark);
    margin-bottom: 14px;
}

.referral-success-text {
    font-size: 1.05rem;
    color: #4b5563;
    max-width: 480px;
    margin: 0 auto 36px;
    line-height: 1.7;
}

.referral-success-actions {
    margin-bottom: 18px;
}

.referral-success-hint {
    font-size: .85rem;
    color: #9ca3af;
    margin: 0;
}

@media(max-width: 768px) {
    .referral-header-inner {
        display: flex;
        flex-direction: column;
    }

    .referral-logo-area {
        display: flex;
        flex-direction: column;
    }

    .referral-badge {
        width: 100%;
        display: flex;
        justify-content: center;
    }
}