/* ==========================================================================
   TDC Referral Site — Public Styles
   ========================================================================== */

/* ---------- Reset / Base ---------- */
.tdc-rs-form-wrap,
.tdc-rs-dashboard-wrap,
.tdc-rs-prizes-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
    box-sizing: border-box;
}

.tdc-rs-form-wrap *,
.tdc-rs-dashboard-wrap *,
.tdc-rs-prizes-wrap * {
    box-sizing: border-box;
}

/* ---------- Sections ---------- */
.tdc-rs-section {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.tdc-rs-section:last-of-type {
    border-bottom: none;
}

.tdc-rs-section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: #1a1a1a;
}

/* ---------- Form Fields ---------- */
.tdc-rs-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.tdc-rs-field {
    margin-bottom: 16px;
    width: 100%;
}

.tdc-rs-field-half {
    flex: 1 1 calc(50% - 8px);
    min-width: 200px;
}

.tdc-rs-field-third {
    flex: 1 1 calc(33.333% - 11px);
    min-width: 150px;
}

.tdc-rs-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 14px;
    color: #374151;
}

.tdc-rs-req {
    color: #dc2626;
}

.tdc-rs-field input[type="text"],
.tdc-rs-field input[type="email"],
.tdc-rs-field input[type="tel"],
.tdc-rs-field select {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 15px;
    color: #1f2937;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.tdc-rs-field input:focus,
.tdc-rs-field select:focus {
    border-color: #3fa2f7;
    box-shadow: 0 0 0 3px rgba(63, 162, 247, 0.15);
    outline: none;
}

.tdc-rs-field input.tdc-rs-error,
.tdc-rs-field select.tdc-rs-error {
    border-color: #dc2626;
}

.tdc-rs-field-error {
    display: none;
    font-size: 13px;
    color: #dc2626;
    margin-top: 4px;
}

.tdc-rs-field-error.tdc-rs-visible {
    display: block;
}

.tdc-rs-hint {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    font-style: italic;
}

/* ---------- Consent ---------- */
.tdc-rs-consent-field {
    margin-bottom: 0;
}

.tdc-rs-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: 400 !important;
    font-size: 14px !important;
    line-height: 1.5;
    color: #4b5563 !important;
}

.tdc-rs-checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* ---------- Lead Rows ---------- */
.tdc-rs-lead-row {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
}

.tdc-rs-lead-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tdc-rs-lead-number {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
}

.tdc-rs-remove-lead {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 4px;
}

.tdc-rs-remove-lead:hover {
    background: #fef2f2;
}

/* ---------- Buttons ---------- */
.tdc-rs-btn {
    display: inline-block;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.15s, opacity 0.15s;
    line-height: 1.4;
}

.tdc-rs-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tdc-rs-btn-primary {
    background: #3fa2f7;
    color: #fff;
}

.tdc-rs-btn-primary:hover:not(:disabled) {
    background: #2b8ee0;
}

.tdc-rs-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.tdc-rs-btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
}

.tdc-rs-form-actions {
    margin-top: 20px;
    text-align: center;
}

#tdc-rs-add-lead {
    font-size: 14px;
    padding: 8px 16px;
}

/* ---------- Messages ---------- */
.tdc-rs-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-top: 16px;
    font-size: 14px;
}

.tdc-rs-message-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.tdc-rs-message-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ---------- Success State ---------- */
.tdc-rs-success-wrap {
    text-align: center;
    padding: 40px 20px;
}

.tdc-rs-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: #22c55e;
    color: #fff;
    border-radius: 50%;
    font-size: 32px;
    margin-bottom: 16px;
}

.tdc-rs-success-wrap h3 {
    font-size: 22px;
    margin: 0 0 8px 0;
    color: #1a1a1a;
}

.tdc-rs-success-wrap p {
    font-size: 16px;
    color: #4b5563;
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

/* ---------- Auth Card ---------- */
.tdc-rs-auth-card {
    max-width: 460px;
    margin: 40px auto;
    padding: 32px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    text-align: center;
}

.tdc-rs-auth-card h2 {
    font-size: 22px;
    margin: 0 0 8px 0;
}

.tdc-rs-auth-card > p {
    color: #6b7280;
    margin: 0 0 24px 0;
    font-size: 14px;
}

.tdc-rs-auth-card .tdc-rs-field {
    text-align: left;
}

/* ---------- Dashboard Greeting ---------- */
.tdc-rs-dashboard-greeting {
    font-size: 24px;
    margin: 0 0 24px 0;
    color: #1a1a1a;
}

/* ---------- Dashboard Sections ---------- */
.tdc-rs-dashboard-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.tdc-rs-dashboard-section:last-child {
    border-bottom: none;
}

.tdc-rs-dashboard-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: #1a1a1a;
}

.tdc-rs-empty {
    color: #6b7280;
    font-style: italic;
}

/* ---------- Table ---------- */
.tdc-rs-table-wrap {
    overflow-x: auto;
}

.tdc-rs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tdc-rs-table th {
    background: #f9fafb;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.tdc-rs-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}

.tdc-rs-table tbody tr:hover {
    background: #f9fafb;
}

/* ---------- Status Pills ---------- */
.tdc-rs-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.tdc-rs-pill-grey {
    background: #f3f4f6;
    color: #6b7280;
}

.tdc-rs-pill-green {
    background: #dcfce7;
    color: #166534;
}

.tdc-rs-pill-red {
    background: #fef2f2;
    color: #991b1b;
}

.tdc-rs-pill-yellow {
    background: #fef9c3;
    color: #854d0e;
}

/* ---------- Points Display ---------- */
.tdc-rs-points-display {
    text-align: center;
    padding: 20px;
    background: #eff6ff;
    border-radius: 12px;
    margin-bottom: 20px;
}

.tdc-rs-points-number {
    font-size: 48px;
    font-weight: 700;
    color: #3fa2f7;
    line-height: 1;
}

.tdc-rs-points-label {
    font-size: 14px;
    color: #6b7280;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---------- Progress Bar ---------- */
.tdc-rs-tier-progress {
    text-align: center;
}

.tdc-rs-progress-bar {
    width: 100%;
    height: 12px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}

.tdc-rs-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3fa2f7, #5bb8ff);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.tdc-rs-tier-message {
    font-size: 15px;
    color: #374151;
}

.tdc-rs-next-prize-preview {
    margin-top: 16px;
}

.tdc-rs-next-prize-preview img {
    max-width: 200px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ---------- Prize Grid ---------- */
.tdc-rs-prize-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 900px) {
    .tdc-rs-prize-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

.tdc-rs-prize-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.15s;
}

.tdc-rs-prize-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.tdc-rs-prize-card.tdc-rs-locked {
    opacity: 0.55;
}

.tdc-rs-prize-image {
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.tdc-rs-prize-image img,
.tdc-rs-prize-card .tdc-rs-prize-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    object-position: center;
    max-width: 100% !important;
    max-height: 100% !important;
    padding: 10px;
    box-sizing: border-box;
}

.tdc-rs-prize-info {
    padding: 14px;
}

.tdc-rs-prize-name {
    font-weight: 600;
    font-size: 15px;
    color: #1f2937;
    margin-bottom: 4px;
}

.tdc-rs-prize-desc {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
}

.tdc-rs-prize-tier {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 10px;
}

.tdc-rs-locked-label {
    display: inline-block;
    font-size: 13px;
    color: #9ca3af;
    font-weight: 500;
}

.tdc-rs-redeem-btn {
    width: 100%;
    padding: 8px 16px;
    font-size: 14px;
}

/* ---------- Dashboard Tagline ---------- */
.tdc-rs-dashboard-tagline {
    font-size: 16px;
    color: #4b5563;
    margin: -16px 0 24px 0;
    font-weight: 500;
}

/* ---------- Dashboard Tabs ---------- */
.tdc-rs-tabs {
    margin-top: 8px;
}

.tdc-rs-tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 24px;
}

.tdc-rs-tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.tdc-rs-tab-btn:hover {
    color: #1f2937;
}

.tdc-rs-tab-btn.active {
    color: #3fa2f7;
    border-bottom-color: #3fa2f7;
}

.tdc-rs-tab-panel {
    display: none;
}

.tdc-rs-tab-panel.active {
    display: block;
}

/* ---------- Nudge Button ---------- */
.tdc-rs-btn-nudge {
    display: inline-block;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #3fa2f7;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.tdc-rs-btn-nudge:hover {
    background: #dbeafe;
    color: #2b8ee0;
}

/* ---------- Dashboard Add Referral ---------- */
.tdc-rs-dashboard-add-referral {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.tdc-rs-dashboard-add-referral h4 {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: #1a1a1a;
}

.tdc-rs-dashboard-form-wrap {
    padding: 0;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.tdc-rs-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tdc-rs-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.tdc-rs-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.tdc-rs-modal-content h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
}

.tdc-rs-modal-content p {
    color: #4b5563;
    margin: 0 0 24px 0;
}

.tdc-rs-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ---------- Form Modal Header ---------- */
.tdc-rs-modal-header {
    text-align: center;
    margin-bottom: 8px;
}

.tdc-rs-modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: #1a1a1a;
}

.tdc-rs-modal-header h2 a {
    color: #3fa2f7;
    text-decoration: underline;
}

.tdc-rs-modal-header p {
    font-size: 15px;
    color: #6b7280;
    margin: 0;
}

/* ---------- Form Modal (popup form via button) ---------- */
.tdc-rs-form-modal-content {
    max-width: 680px;
    width: calc(100% - 40px);
    max-height: calc(100dvh - 80px);
    overflow-y: auto;
    padding: 40px 32px 32px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
}

.tdc-rs-modal-close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    padding: 8px 10px;
    border-radius: 4px;
    z-index: 10;
}

.tdc-rs-modal-close-btn:hover {
    color: #1f2937;
    background: #f3f4f6;
}

/* ---------- Error Block ---------- */
.tdc-rs-error {
    color: #dc2626;
    font-weight: 500;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 600px) {
    .tdc-rs-field-half,
    .tdc-rs-field-third {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .tdc-rs-prize-grid {
        grid-template-columns: 1fr;
    }

    .tdc-rs-auth-card {
        margin: 20px auto;
        padding: 24px 16px;
    }

    .tdc-rs-modal-content {
        padding: 24px 16px;
    }

    .tdc-rs-form-modal-content {
        width: calc(100% - 32px);
        max-height: calc(100dvh - 80px);
        margin: 40px 16px;
        padding: 24px 16px;
        padding-top: 40px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
        border-radius: 12px;
    }

    .tdc-rs-modal-actions {
        flex-direction: column;
    }

    .tdc-rs-points-number {
        font-size: 36px;
    }
}

/* ═════════════════════════════════════════════════════════════════ */
/*  ACCOUNT SETTINGS + SELF-DELETE                                    */
/* ═════════════════════════════════════════════════════════════════ */

.tdc-rs-account-settings {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.tdc-rs-account-settings summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    padding: 6px 0;
    user-select: none;
}

.tdc-rs-account-settings summary:hover { color: #374151; }

.tdc-rs-account-settings__body {
    margin-top: 14px;
    padding: 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
}

.tdc-rs-account-settings__lead {
    margin: 0 0 10px;
    font-size: 14px;
    color: #7f1d1d;
}

.tdc-rs-account-settings__hint {
    margin: 10px 0 0;
    font-size: 12px;
    color: #991b1b;
    line-height: 1.5;
}

.tdc-rs-btn-danger {
    background: #dc2626;
    color: #fff;
    border: 0;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: background .15s;
}

.tdc-rs-btn-danger:hover { background: #b91c1c; }
.tdc-rs-btn-danger:disabled { background: #fca5a5; cursor: not-allowed; }

.tdc-rs-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 2px solid #fca5a5;
    border-radius: 4px;
    margin: 12px 0;
    box-sizing: border-box;
    font-family: monospace;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.tdc-rs-input:focus {
    outline: none;
    border-color: #dc2626;
}

.tdc-rs-message {
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin: 10px 0;
}

.tdc-rs-message.tdc-rs-message-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.tdc-rs-message.tdc-rs-message-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
