/* ============================================
   REFERRAL PAGE STYLES
   ============================================ */

/* Referral Grid Layout - Side by Side */
.referral-grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.referral-stats-section,
.referral-code-section {
    margin-bottom: 0;
}

/* Referral Stats */
.referral-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    transition: all 0.3s var(--ease-smooth);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.stat-icon.green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-icon.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-icon i {
    font-size: var(--icon-size-md);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: var(--font-size-h3);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Referral Code Card */
.referral-code-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem;
    text-align: center;
}

.code-header {
    margin-bottom: 1rem;
}

.code-header h3 {
    font-size: var(--font-size-h3);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.code-header p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.code-display {
    margin-bottom: 1rem;
}

.code-box {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
}

.referral-code {
    font-size: var(--font-size-h4);
    font-weight: 800;
    font-family: 'Courier New', monospace;
    color: var(--primary-purple);
    letter-spacing: 1.5px;
}

.btn-copy {
    padding: 0.5rem 1rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: var(--font-size-small);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-copy:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--glow-primary);
}

.btn-copy i {
    font-size: var(--icon-size-xs);
}

.code-footer .btn {
    min-width: 200px;
}

/* Referral Link (old page design – adapted with level colors) */
.referral-link-container {
    margin-top: 1.5rem;
    text-align: left;
}

.referral-link-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.referral-link-label::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, #fbbf24 0%, #f97316 50%, #6366f1 100%);
    /* gold → bronze → purple */
}

.referral-link-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.5);
}

.referral-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.8rem;
    padding: 0.25rem 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.referral-input::selection {
    background: rgba(139, 92, 246, 0.35);
}

.btn-copy.small {
    padding: 0.45rem 0.75rem;
    font-size: 0.7rem;
    border-radius: 999px;
    background: var(--gradient-primary);
    min-width: auto;
}

.btn-copy.small i {
    font-size: 0.7rem;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.share-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 0.8rem;
    transition: all 0.25s ease;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.3);
}

.share-btn i {
    font-size: 0.8rem;
}

/* Use level-card palette for share buttons */
.share-btn.whatsapp {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    /* same as green stat / commission */
}

.share-btn.facebook {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    /* similar to blue stat & silver tone */
}

.share-btn.twitter {
    background: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
    /* like silver active progress */
}

.share-btn.telegram {
    background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
}

.share-btn.instagram {
    background: radial-gradient(circle at 30% 30%, #facc15 0, #e11d48 30%, #7c3aed 60%, #1d4ed8 100%);
}

.share-btn.email {
    background: linear-gradient(135deg, #e5e7eb 0%, #9ca3af 45%, #6b7280 100%);
    /* platinum-like */
    color: #020617;
}

.share-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: var(--shadow-md);
}

/* Filter Tabs */
#referral-list-wrapper {
    transition: opacity 0.3s ease;
}

.filter-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: var(--font-size-tiny);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
}

.filter-tab i {
    font-size: var(--icon-size-xs);
}

.filter-tab:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-purple);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.filter-tab.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
    box-shadow: var(--glow-primary);
}

/* Referrals List - Using activity-card.css component */
/* Additional referral-specific styles only */
.referral-item {
    margin-bottom: 0;
}

/* Responsive Styles */
/* Break grid at 1000px */
@media (max-width: 1000px) {
    .referral-grid-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .referral-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.875rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .stat-value {
        font-size: var(--font-size-h4);
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .referral-code-card {
        padding: 1.5rem;
    }

    .code-box {
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-tabs {
        gap: 0.625rem;
    }

    .filter-tab {
        padding: 0.625rem 1rem;
    }

}

@media (max-width: 480px) {
    .referral-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.875rem;
        text-align: center;
    }

    .stat-card {
        flex-direction: column;
        gap: 0.5rem;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
    }

    .stat-icon i {
        font-size: var(--icon-size-sm);
    }

    .stat-value {
        font-size: var(--font-size-body);
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .referral-code-card {
        padding: 1.25rem;
    }

    .code-header h3 {
        font-size: var(--font-size-h3);
    }

    .referral-code {
        font-size: var(--font-size-h4);
    }

    .code-footer .btn {
        width: 100%;
        min-width: auto;
    }

    .filter-tabs {
        gap: 0.5rem;
    }

    .filter-tab {
        padding: 0.5rem 0.875rem;
        font-size: var(--font-size-tiny);
    }

    .referral-link-box {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-copy.small {
        width: 100%;
        justify-content: center;
    }

    .share-buttons {
        justify-content: flex-start;
    }
}

/* ============================================
   REFERRAL LEVELS SECTION
   ============================================ */

.referral-section-header {
    margin-bottom: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.referral-section-header .section-title {
    font-size: var(--font-size-h3);
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.referral-section-header .section-title i {
    font-size: var(--icon-size-md);
    color: var(--primary-purple);
}

.referral-section-header .section-subtitle {
    font-size: var(--font-size-small);
    color: var(--text-muted);
    margin: 0;
}

.referral-levels {
    margin-bottom: 2.5rem;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}

.level-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem 1.25rem 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.level-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.level-card.silver.active {
    border-color: rgba(226, 232, 240, 0.35);
    box-shadow: 0 0 0 1px rgba(226, 232, 240, 0.08), var(--shadow-md);
}

.level-card.platinum:hover {
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.18), var(--shadow-md);
}

.level-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(148, 163, 184, 0.22);
}

/* level-top-bar color comes from inline style (levelColor) in PHP - same as icon */

.level-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary-purple);
}

.level-badge.current {
    background: rgba(226, 232, 240, 0.14);
    color: #e5e7eb;
}

.level-badge.next {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.level-badge.premium {
    background: rgba(139, 92, 246, 0.16);
    color: #c4b5fd;
}

.level-badge i {
    font-size: 0.7rem;
}

.level-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    margin-top: 0.5rem;
}

.level-icon-wrapper {
    flex-shrink: 0;
}

.level-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

/* icon color comes from inline style (levelColor) in PHP - same as level-top-bar */

.level-icon i {
    font-size: var(--icon-size-md);
}

.level-info .level-name {
    font-size: var(--font-size-h4);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.15rem;
}

.level-requirement {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.level-requirement i {
    font-size: 0.75rem;
}

.level-body {
    margin-top: 0.75rem;
}

.commission-highlight {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.commission-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
}

.commission-icon i {
    font-size: var(--icon-size-sm);
}

.commission-rate {
    font-size: var(--font-size-h3);
    font-weight: 800;
    color: #10b981;
    line-height: 1;
}

.commission-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.level-progress {
    margin-top: 0.75rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8 0%, #6366f1 100%);
    border-radius: 999px;
    position: relative;
}

.level-card.silver .progress-fill {
    background: linear-gradient(90deg, #e5e7eb 0%, #94a3b8 55%, #64748b 100%);
}

.progress-percentage {
    position: absolute;
    right: 6px;
    top: -18px;
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* ============================================
   HOW IT WORKS SECTION
   ============================================ */

.referral-how-it-works {
    margin: 3rem 0 2rem;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.step-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.step-number {
    position: absolute;
    top: 1rem;
    left: 1.25rem;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
}

.step-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.step-icon.purple {
    background: var(--gradient-primary);
}

.step-icon.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.step-icon.green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.step-icon i {
    font-size: var(--icon-size-sm);
}

.step-body {
    flex: 1;
    min-width: 0;
}

.step-title {
    font-size: var(--font-size-h4);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
}

.step-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 0.5rem;
    line-height: 1.4;
}

.step-highlight {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.08);
    color: #6ee7b7;
    font-size: 0.7rem;
    font-weight: 600;
}

.step-highlight i {
    font-size: 0.7rem;
}

.quick-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.quick-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.quick-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-purple);
}

.quick-stat-icon i {
    font-size: var(--icon-size-sm);
}

.quick-stat-value {
    font-size: var(--font-size-h4);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}

.quick-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Referral extra sections responsive */
@media (max-width: 1024px) {
    .levels-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .steps-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quick-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .referral-section-header {
        margin-bottom: 1.5rem;
    }

    .referral-how-it-works {
        margin: 2rem 0 1.5rem;
    }

    .steps-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .step-card {
        padding: 0.875rem 1rem;
        gap: 0.75rem;
    }

    .step-number {
        top: 0.875rem;
        left: 1rem;
        width: 26px;
        height: 26px;
        font-size: 0.65rem;
    }

    .step-icon {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

    .step-icon i {
        font-size: 0.875rem;
    }

    .step-body {
        margin-top: 0.5rem;
    }

    .step-title {
        font-size: var(--font-size-h4);
    }

    .step-desc {
        font-size: 0.75rem;
        margin: 0 0 0.5rem;
    }

    .step-highlight {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
    }

    .quick-stats {
        gap: 0.75rem;
    }

    .quick-stat-card {
        padding: 0.875rem;
    }

    .quick-stat-icon {
        width: 32px;
        height: 32px;
    }

    .quick-stat-value {
        font-size: var(--font-size-small);
    }

    .quick-stat-label {
        font-size: 0.7rem;
    }

    .levels-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .level-card {
        padding: 1rem 1rem 1.25rem;
    }

    .level-top-bar {
        height: 3px;
    }

    .level-badge {
        top: 0.65rem;
        right: 0.65rem;
        padding: 0.2rem 0.5rem;
        font-size: 0.6rem;
        gap: 0.3rem;
    }

    .level-header {
        gap: 0.75rem;
    }

    .level-icon-wrapper {
        width: 44px;
        height: 44px;
    }

    .level-icon {
        width: 36px;
        height: 36px;
    }

    .level-icon i {
        font-size: 1rem;
    }

    .level-name {
        font-size: 0.95rem;
        margin-bottom: 0.15rem;
    }

    .level-requirement {
        font-size: 0.7rem;
        gap: 0.35rem;
    }

    .commission-highlight {
        padding: 0.65rem 0.75rem;
        gap: 0.65rem;
        border-radius: 12px;
    }

    .commission-icon {
        width: 28px;
        height: 28px;
    }

    .commission-icon i {
        font-size: 0.9rem;
    }

    .commission-rate {
        font-size: 1.25rem;
    }

    .commission-label {
        font-size: 0.7rem;
    }

    .level-progress {
        margin-top: 0.6rem;
    }

    .progress-info {
        font-size: 0.7rem;
        margin-bottom: 0.35rem;
    }

    .progress-bar {
        height: 7px;
    }
}

@media (max-width: 480px) {
    .levels-grid {
        grid-template-columns: 1fr;
    }

    .level-card {
        padding: 0.9rem 0.9rem 1.1rem;
        border-radius: 14px;
    }

    .level-badge {
        top: 0.6rem;
        right: 0.6rem;
        font-size: 0.58rem;
    }

    .level-icon-wrapper {
        width: 42px;
        height: 42px;
    }

    .level-icon {
        width: 34px;
        height: 34px;
        border-radius: 12px;
    }

    .level-name {
        font-size: 0.9rem;
    }

    .level-requirement {
        font-size: 0.68rem;
    }

    .commission-highlight {
        padding: 0.6rem 0.7rem;
        border-radius: 12px;
    }

    .commission-rate {
        font-size: 1.2rem;
    }

    .progress-bar {
        height: 6px;
    }

    .referral-how-it-works {
        margin: 1.5rem 0 1.25rem;
    }

    .referral-section-header .section-title {
        font-size: var(--font-size-h4);
    }

    .referral-section-header .section-subtitle {
        font-size: 0.75rem;
    }

    .steps-grid {
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .step-card {
        padding: 0.625rem 0.75rem 0.75rem;
        gap: 0.5rem;
        border-radius: 10px;
    }

    .step-header {
        gap: 0.4rem;
    }

    .step-number {
        top: 0.625rem;
        left: 0.75rem;
        width: 22px;
        height: 22px;
        font-size: 0.6rem;
    }

    .step-icon {
        width: 30px;
        height: 30px;
        border-radius: 8px;
    }

    .step-icon i {
        font-size: 0.75rem;
    }

    .step-body {
        margin-top: 0.35rem;
    }

    .step-title {
        font-size: 0.875rem;
        margin: 0 0 0.25rem;
    }

    .step-desc {
        font-size: 0.7rem;
        margin: 0 0 0.4rem;
        line-height: 1.4;
    }

    .step-highlight {
        padding: 0.2rem 0.45rem;
        font-size: 0.6rem;
    }

    .step-highlight i {
        font-size: 0.6rem;
    }

    .quick-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .quick-stat-card {
        padding: 0.625rem 0.75rem;
        gap: 0.5rem;
        border-radius: 10px;
    }

    .quick-stat-icon {
        width: 28px;
        height: 28px;
    }

    .quick-stat-icon i {
        font-size: 0.75rem;
    }

    .quick-stat-value {
        font-size: 0.8rem;
        margin-bottom: 0.1rem;
    }

    .quick-stat-label {
        font-size: 0.65rem;
    }
}