@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #0a0e1a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-glass: rgba(255, 255, 255, 0.06);
    --text: #e8eaf0;
    --text-secondary: #8b8fa3;
    --text-muted: #5a5e72;
    --accent: #4f8cff;
    --accent-light: #6ba1ff;
    --accent-glow: rgba(79, 140, 255, 0.25);
    --gradient-start: #2d5fe5;
    --gradient-end: #6c5ce7;
    --success: #34d399;
    --success-glow: rgba(52, 211, 153, 0.2);
    --warning: #fbbf24;
    --danger: #f87171;
    --border: rgba(255, 255, 255, 0.06);
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 88px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============ HERO SECTION ============ */
.header {
    position: relative;
    padding: 40px 20px 28px;
    text-align: center;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -60%;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(79, 140, 255, 0.3) 0%, rgba(108, 92, 231, 0.15) 40%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: pulse-glow 4s ease-in-out infinite;
}

.header::after {
    content: '';
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(108, 92, 231, 0.2) 0%, transparent 60%);
    border-radius: 50%;
    pointer-events: none;
    animation: pulse-glow 4s ease-in-out infinite reverse;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.balance-label {
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    position: relative;
}

.balance-value {
    font-size: 56px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 4px 0;
    position: relative;
    line-height: 1.1;
}

.balance-sub {
    font-size: 14px;
    font-weight: 500;
    color: var(--success);
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.balance-sub.inactive {
    color: var(--text-muted);
}

.balance-sub::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success-glow);
    animation: status-pulse 2s ease-in-out infinite;
}

.balance-sub.inactive::before {
    background: var(--text-muted);
    box-shadow: none;
    animation: none;
}

@keyframes status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============ BADGES ============ */
.badges {
    display: flex;
    gap: 8px;
    padding: 0 16px 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.badge {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.badge.clickable {
    cursor: pointer;
    border-style: dashed;
}

.badge.clickable:active {
    background: rgba(79, 140, 255, 0.15);
}

.badge.active {
    background: rgba(79, 140, 255, 0.1);
    border-color: rgba(79, 140, 255, 0.3);
    color: var(--accent-light);
    box-shadow: 0 0 20px rgba(79, 140, 255, 0.08);
}

/* ============ ACTIONS GRID ============ */
.actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 16px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 8px 14px;
    color: var(--text);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(79, 140, 255, 0.3), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.action-btn:active {
    transform: scale(0.95);
    background: var(--bg-card-hover);
}

.action-btn:active::before {
    opacity: 1;
}

.action-icon {
    font-size: 22px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.12), rgba(108, 92, 231, 0.08));
    border-radius: var(--radius-sm);
    transition: transform 0.2s;
}

/* ============ REFERRAL BANNER ============ */
.referral-banner {
    margin: 4px 16px 0;
    background: linear-gradient(135deg, #2d5fe5 0%, #6c5ce7 100%);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.referral-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    pointer-events: none;
}

.referral-banner::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: 10%;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    pointer-events: none;
}

.referral-banner:active {
    transform: scale(0.98);
}

.referral-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: #fff;
    font-size: 13px;
    flex: 1;
    position: relative;
    z-index: 1;
}

.referral-text strong {
    font-size: 14px;
    font-weight: 600;
}

.referral-btn {
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 8px 16px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    margin-left: 12px;
    position: relative;
    z-index: 1;
    transition: background 0.2s;
}

.referral-btn:active {
    background: rgba(255, 255, 255, 0.25);
}

/* ============ SECTIONS ============ */
.section {
    margin: 16px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============ KEY BOX ============ */
.key-box {
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.key-box code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
    word-break: break-all;
    color: var(--text-secondary);
    line-height: 1.5;
}

.copy-btn {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #fff;
    border: none;
    border-radius: var(--radius-xs);
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.copy-btn:active {
    opacity: 0.8;
    transform: scale(0.98);
}

/* ============ SERVER ITEMS ============ */
.server-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.server-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.server-item:first-child {
    padding-top: 0;
}

.server-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.server-flag {
    width: 32px;
    height: 24px;
    border-radius: 4px;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.server-name {
    font-size: 14px;
    font-weight: 500;
}

.server-status {
    font-size: 12px;
    font-weight: 500;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 6px;
}

.server-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success-glow);
}

/* ============ SKELETON ============ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.06) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.8s ease-in-out infinite;
    height: 48px;
    border-radius: var(--radius-xs);
    border: none;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============ TRAFFIC ============ */
.traffic-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.traffic-info strong {
    color: var(--accent-light);
    font-weight: 700;
}

/* ============ PAGES ============ */
.page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 100;
    overflow-y: auto;
    padding-bottom: 88px;
    animation: page-in 0.25s ease;
}

@keyframes page-in {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.page-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(10, 14, 26, 0.92);
    backdrop-filter: blur(16px);
    z-index: 10;
}

.page-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.back-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px;
    font-family: 'Inter', sans-serif;
}

/* ============ TARIFFS ============ */
.tariffs-grid {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tariff-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.tariff-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: border-color 0.3s;
}

.tariff-card:active {
    transform: scale(0.98);
    border-color: var(--accent);
}

.tariff-info h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.tariff-info span {
    font-size: 12px;
    color: var(--text-secondary);
}

.tariff-price {
    text-align: right;
}

.tariff-price .price {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tariff-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--success), #10b981);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 8px;
    vertical-align: middle;
}

/* ============ SETUP ============ */
.setup-content {
    padding: 16px;
}

.setup-step {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.setup-step:last-child {
    border-bottom: none;
}

.step-num {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(45, 95, 229, 0.25);
}

.setup-step strong {
    font-weight: 600;
}

.setup-step p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.5;
}

.setup-step a {
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 500;
}

/* ============ PAYMENTS ============ */
#payments-list {
    padding: 16px;
}

.payment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.payment-item:last-child {
    border-bottom: none;
}

.payment-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.payment-tariff {
    font-size: 14px;
    font-weight: 500;
}

.payment-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.payment-amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--success);
}

/* ============ REFERRAL PAGE ============ */
.referral-content {
    padding: 24px 16px;
    text-align: center;
}

.referral-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 24px;
}

.ref-stat-value {
    font-size: 40px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ref-stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.ref-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.ref-link-box {
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.ref-link-box code {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
    word-break: break-all;
    color: var(--text-secondary);
}

/* ============ PRIMARY BUTTON ============ */
.primary-btn {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 16px rgba(45, 95, 229, 0.3);
}

.primary-btn:active {
    opacity: 0.85;
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(45, 95, 229, 0.2);
}

.primary-btn.wide {
    width: 100%;
}

/* ============ BOTTOM NAV ============ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 14, 26, 0.92);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 env(safe-area-inset-bottom, 8px);
    z-index: 200;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 16px;
    transition: color 0.2s;
    font-family: 'Inter', sans-serif;
    position: relative;
}

.nav-item.active {
    color: var(--accent);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
}

.nav-icon {
    font-size: 20px;
}

/* ============ TOAST ============ */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(52, 211, 153, 0.9);
    backdrop-filter: blur(12px);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    z-index: 300;
    animation: toast-in 0.3s ease;
    box-shadow: 0 8px 24px rgba(52, 211, 153, 0.25);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(0.95); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 52px;
    margin-bottom: 16px;
    filter: grayscale(0.3);
}

.empty-state p {
    font-size: 14px;
    font-weight: 500;
}

/* ============ PROFILE ============ */
.profile-content {
    padding: 0 0 20px;
}

.profile-header {
    text-align: center;
    padding: 28px 20px 20px;
}

.profile-avatar {
    display: inline-block;
    margin-bottom: 14px;
}

.profile-avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    box-shadow: 0 0 24px var(--accent-glow);
}

.profile-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 4px 20px rgba(45, 95, 229, 0.3);
}

.profile-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 2px;
}

.profile-username {
    font-size: 14px;
    color: var(--text-secondary);
}

.profile-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.profile-stat-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.profile-stat-row:first-child {
    padding-top: 0;
}

.profile-stat-value {
    font-weight: 600;
    color: var(--text);
}

.profile-stat-value.active {
    color: var(--success);
}

.profile-stat-value.inactive {
    color: var(--text-muted);
}

.profile-actions {
    margin: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.profile-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
    font-family: 'Inter', sans-serif;
    border-bottom: 1px solid var(--border);
}

.profile-action-btn:last-child {
    border-bottom: none;
}

.profile-action-btn:active {
    background: var(--bg-card-hover);
}

.profile-action-btn span:nth-child(2) {
    flex: 1;
}

.profile-action-arrow {
    color: var(--text-muted);
    font-size: 16px;
}
