/* Affiliate Portal - extends shared.css (uses purple as primary) */

/* --- Login Page --- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { background: var(--bg-card); padding: 40px; border-radius: var(--radius-xl); width: 420px; max-width: 90vw; }
.login-box h2 { margin-bottom: 25px; text-align: center; color: var(--purple); }
.login-box input { width: 100%; padding: 12px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-input); color: var(--text-primary); font-size: 14px; }
.login-box input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); }
.login-box button { width: 100%; padding: 14px; background: var(--purple); color: #fff; border: none; border-radius: var(--radius-md); font-size: 16px; font-weight: 600; cursor: pointer; transition: background var(--transition-fast); }
.login-box button:hover { background: var(--purple-hover); }
.error { color: var(--red); text-align: center; margin-bottom: 10px; font-size: 14px; }
.success { color: var(--green); text-align: center; margin-bottom: 10px; font-size: 14px; }

/* --- Tabs --- */
.tabs { display: flex; margin-bottom: 20px; }
.tabs button { flex: 1; padding: 10px; background: var(--bg-elevated); border: none; color: var(--text-secondary); cursor: pointer; font-size: 14px; transition: all var(--transition-fast); }
.tabs button.active { background: var(--purple); color: #fff; }
.tabs button:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.tabs button:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* --- Portal Layout --- */
.portal { display: none; max-width: 1000px; margin: 0 auto; padding: 20px; padding-bottom: 80px; }
.portal h1 { margin-bottom: 5px; font-size: 1.4em; }
.subtitle { color: var(--text-muted); margin-bottom: 20px; font-size: 14px; }

/* --- Stats Grid (Portal) --- */
.portal .stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.portal .stat-card { text-align: center; padding: var(--space-lg); }
.portal .stat-card .label { font-size: 11px; }
.portal .stat-card .value { font-size: 1.5em; }

/* --- Link Box --- */
.link-box { background: var(--bg-card); padding: var(--space-lg); border-radius: var(--radius-lg); margin-bottom: var(--space-lg); }
.link-box h3 { margin-bottom: 10px; color: var(--purple); font-size: 15px; }
.link-box .link {
    background: var(--bg-base); padding: 10px; border-radius: var(--radius-md);
    font-family: var(--font-mono); font-size: 12px; word-break: break-all;
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.link-box .link button {
    background: var(--purple); color: #fff; border: none; padding: 8px 16px;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
    white-space: nowrap; min-height: 36px; font-weight: 600;
    transition: background var(--transition-fast), transform var(--transition-fast);
}
.link-box .link button:hover { background: var(--purple-hover); }
.link-box .link button:active { transform: scale(0.95); }
.link-box select, .link-box input {
    width: 100%; padding: 12px; border: 1px solid var(--border);
    border-radius: var(--radius-md); background: var(--bg-input);
    color: var(--text-primary); margin-bottom: 10px; font-size: 14px;
}
.link-box select:focus, .link-box input:focus { outline: none; border-color: var(--purple); }

/* --- Wallet Card --- */
.wallet-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-base) 100%);
    border: 1px solid var(--border); border-radius: var(--radius-xl);
    padding: var(--space-xl); margin-bottom: var(--space-xl);
}
.wallet-card .wallet-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md);
    margin: var(--space-lg) 0;
}
.wallet-card .wallet-item .wallet-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.wallet-card .wallet-item .wallet-value { font-size: 1.3em; font-weight: 700; margin-top: 2px; }
.wallet-card .wallet-actions { display: flex; gap: 10px; margin-top: var(--space-lg); }
.wallet-card .wallet-actions button {
    flex: 1; padding: 12px; border: none; border-radius: var(--radius-md);
    font-size: 14px; font-weight: 600; cursor: pointer; transition: all var(--transition-fast);
}

/* --- Logout Button --- */
.logout-btn {
    position: fixed; top: 12px; right: 12px;
    background: var(--bg-elevated); color: var(--text-secondary);
    border: none; padding: 8px 14px; border-radius: var(--radius-md);
    cursor: pointer; font-size: 13px; z-index: 10;
    transition: all var(--transition-fast);
}
.logout-btn:hover { background: var(--red-bg); color: var(--red); }

/* --- Bottom Nav (Mobile) --- */
.bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-card); border-top: 1px solid var(--border); padding: 8px 0; z-index: 20; }
.bottom-nav .nav-items { display: flex; justify-content: space-around; align-items: center; }
.bottom-nav .nav-item { display: flex; flex-direction: column; align-items: center; color: var(--text-muted); font-size: 10px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-md); text-decoration: none; transition: color var(--transition-fast); }
.bottom-nav .nav-item.active { color: var(--purple); }
.bottom-nav .nav-item i { font-size: 20px; margin-bottom: 2px; }

/* --- Chat --- */
.chat-container { background: var(--bg-card); border-radius: var(--radius-lg); overflow: hidden; }
.chat-messages { height: 300px; overflow-y: auto; padding: var(--space-lg); }
.chat-input-bar { display: flex; gap: var(--space-sm); padding: var(--space-md); border-top: 1px solid var(--border); }
.chat-input-bar input { flex: 1; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-input); color: var(--text-primary); font-size: 14px; }
.chat-input-bar input:focus { outline: none; border-color: var(--purple); }
.chat-input-bar button { background: var(--purple); color: #fff; border: none; padding: 12px 20px; border-radius: var(--radius-md); cursor: pointer; font-weight: 600; }
.chat-bubble { margin-bottom: 8px; max-width: 85%; }
.chat-bubble.user { margin-left: auto; text-align: right; }
.chat-bubble .bubble { display: inline-block; padding: 10px 14px; border-radius: var(--radius-lg); font-size: 13px; line-height: 1.5; }
.chat-bubble.user .bubble { background: var(--purple); color: #fff; border-radius: var(--radius-lg) var(--radius-lg) 0 var(--radius-lg); }
.chat-bubble.bot .bubble { background: var(--bg-card); color: var(--text-primary); border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 0; border: 1px solid var(--border); }

/* --- Portal Sections --- */
.portal-tab { display: none; }
.portal-tab.active-tab { display: block; animation: sectionIn 0.25s ease-out; }

/* --- Team Tree --- */
.tree-node { margin: 6px 0; position: relative; }
.tree-node-content {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; background: var(--bg-base); border-radius: var(--radius-md);
}
.tree-children { padding-left: 20px; }

/* --- Responsive: Mobile --- */
@media (max-width: 600px) {
    .portal .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .portal .stat-card { padding: 12px; }
    .portal .stat-card .value { font-size: 1.3em; }
    .link-box .link { flex-direction: column; }
    .portal { padding: 15px; padding-bottom: 90px; }
    .portal h1 { font-size: 1.2em; }
    .bottom-nav { display: block; }
    .logout-btn { top: 8px; right: 8px; padding: 6px 12px; font-size: 12px; }
    .wallet-card .wallet-grid { grid-template-columns: 1fr; }
    .wallet-card .wallet-actions { flex-direction: column; }
    .chat-messages { height: 250px; }
}
