/* Prevent iOS Safari auto-zoom on input focus.
   Browsers zoom in when font-size < 16px and never zoom back out. */
input, textarea, select {
    font-size: 16px;
}
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

:root {
    --bg-dark: #0a0b10;
    --sidebar-bg: #12141d;
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-w: 260px;
    --content-max: 1280px;
    --content-pad: clamp(16px, 3vw, 36px);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

h1, h2, h3, .logo {
    font-family: 'Outfit', sans-serif;
    line-height: 1.25;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background Blobs — fixed so they never extend the document and never cause shake */
body::before, body::after {
    content: '';
    position: fixed;
    width: 280px;
    height: 280px;
    background: var(--accent-primary);
    filter: blur(140px);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.18;
    pointer-events: none;
    will-change: transform;
    animation: blobMove 18s infinite alternate ease-in-out;
}

body::after {
    background: var(--accent-secondary);
    right: 0;
    bottom: 0;
    animation-delay: -6s;
}

@keyframes blobMove {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(80px, 60px, 0); }
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-w);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding: 20px 14px;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    transition: var(--transition);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.logo-container {
    margin-bottom: 25px;
}

.logo {
    font-size: 1.8rem;
    font-weight: 900;
}

.logo span {
    color: var(--accent-primary);
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav a {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-nav li.active a,
.sidebar-nav a:hover {
    background: var(--glass-bg);
    color: var(--text-main);
}

.sidebar-nav li.active a {
    color: var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
    border-radius: 0 12px 12px 0;
}

.nav-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 10px 0;
}

.badge {
    background: var(--accent-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    margin-left: auto;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.user-brief {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.user-info .name { font-weight: 600; font-size: 0.9rem; }
.user-info .role { font-size: 0.75rem; color: var(--text-muted); }

/* Main Content Area — consistent across every page */
.main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    padding: clamp(20px, 3vw, 40px) var(--content-pad);
    max-width: calc(var(--content-max) + var(--sidebar-w));
    width: 100%;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: clamp(20px, 3vw, 36px);
    flex-wrap: wrap;
}

.header-left h2 { font-size: clamp(1.4rem, 2.4vw, 2rem); margin-bottom: 4px; }
.date-today { color: var(--text-muted); font-size: 0.9rem; }

.header-right {
    display: flex;
    align-items: center;
    gap: 25px;
}

.search-bar {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-main);
    outline: none;
}

.notifications {
    font-size: 1.2rem;
    color: var(--text-muted);
    position: relative;
    cursor: pointer;
}

.notifications .dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: min-content;
    gap: 25px;
}

.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: clamp(18px, 2.4vw, 28px);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transition: border-color .25s ease, box-shadow .25s ease;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.card:hover {
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.card-header h3 { font-size: 1.1rem; color: var(--text-muted); font-weight: 500; }

/* Balance Card Specific */
.balance-card { grid-column: span 8; }

.balance-amount {
    margin-bottom: 20px;
}

.balance-amount .currency { font-size: clamp(1.4rem, 2.4vw, 2rem); color: var(--text-muted); margin-right: 5px; }
.balance-amount .value { font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.1; }

.balance-stats { margin-bottom: 30px; display: flex; align-items: center; gap: 10px; }
.stat.positive { color: var(--success); font-weight: 600; }
.stat-period { color: var(--text-muted); font-size: 0.9rem; }

.quick-actions { display: flex; gap: 15px; }

.btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn.primary { background: var(--accent-primary); color: white; border: none; }
.btn.primary:hover { background: #2563eb; transform: translateY(-2px); }

.btn.secondary { background: var(--glass-bg); color: var(--text-main); border: 1px solid var(--glass-border); }
.btn.secondary:hover { background: var(--glass-border); }

/* Market Prices Specific */
.market-card { grid-column: span 4; overflow: hidden; }

.live-indicator {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
}

.crypto-list { display: flex; flex-direction: column; gap: 20px; }

.crypto-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
}

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

.crypto-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--glass-bg); display: flex; align-items: center; justify-content: center; }

.crypto-info { flex: 1; }
.crypto-info .symbol { font-weight: 700; display: block; }
.crypto-info .name { font-size: 0.8rem; color: var(--text-muted); }

.crypto-price { text-align: right; }
.crypto-price .price { font-weight: 700; display: block; }
.crypto-price .change { font-size: 0.8rem; font-weight: 600; }
.crypto-price .change.positive { color: var(--success); }
.crypto-price .change.negative { color: var(--danger); }

/* Activity Specific */
.activity-card { grid-column: span 8; }
.transaction-list { display: flex; flex-direction: column; gap: 20px; }
.transaction { display: flex; align-items: center; gap: 15px; }

.transaction .icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.transaction .icon.deposit { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.transaction .icon.withdraw { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.transaction .icon.transfer { background: rgba(139, 92, 246, 0.1); color: var(--accent-secondary); }

.transaction .details { flex: 1; }
.transaction .details .title { font-weight: 600; }
.transaction .details .date { font-size: 0.8rem; color: var(--text-muted); }

.transaction .amount { font-weight: 700; }
.transaction .amount.positive { color: var(--success); }
.transaction .amount.negative { color: var(--danger); }

/* Support Widget */
.support-widget { grid-column: span 4; background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1)); }
.support-widget h3 { color: var(--text-main); margin-bottom: 10px; }
.support-widget p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 25px; }
.support-btns { display: flex; flex-direction: column; gap: 10px; }
.btn-sm { padding: 10px 20px; font-size: 0.85rem; }
.outline { background: transparent; border: 1px solid var(--accent-primary); color: var(--accent-primary); }

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--sidebar-bg);
    border-top: 1px solid var(--glass-border);
    justify-content: space-around;
    padding: 15px;
    z-index: 200;
}

.mobile-nav a { color: var(--text-muted); font-size: 1.4rem; }
.mobile-nav a.active { color: var(--accent-primary); }

/* Pagination Buttons */
.pagination-controls button {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 38px;
    transition: var(--transition);
    font-family: inherit;
}
.pagination-controls button:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}
.pagination-controls button.active,
.pagination-controls button[aria-current="page"] {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}
.pagination-controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Skeleton Loading */
.skeleton {
    height: 60px;
    background: linear-gradient(90deg, var(--glass-bg) 25%, var(--glass-border) 50%, var(--glass-bg) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 12px;
}

@keyframes loading {
    to { background-position: -200% 0; }
}

/* Responsive Scaling */
@media (max-width: 1200px) {
    .balance-card, .activity-card { grid-column: span 12; }
    .market-card, .support-widget { grid-column: span 6; }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 12px 0 40px rgba(0,0,0,0.5);
    }
        .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop {
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.55);
        backdrop-filter: blur(2px);
        z-index: 90;
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
    }
    .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding-bottom: 90px; /* room for mobile nav */
    }
    .menu-toggle { display: inline-flex; }
    .mobile-nav { display: flex; }
    .header-right .search-bar { display: none; }
}

@media (max-width: 720px) {
    .market-card, .support-widget { grid-column: span 12; }
    .dashboard-grid { gap: 16px; }
    .header-right { gap: 14px; }
}

@media (max-width: 520px) {
    :root { --content-pad: 14px; }
    .quick-actions { flex-direction: column; }
    .quick-actions .btn { width: 100%; justify-content: center; }
    .card { border-radius: 16px; }
    .top-header { margin-bottom: 18px; }
    .balance-stats { flex-wrap: wrap; }
}

/* Reduced motion: disable blob animation for users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
    body::before, body::after { animation: none; }
    * { transition-duration: 0.01ms !important; }
}
/* Virtual Assistant Drawer Styles */
.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 2000;
}
.chat-toggle {
    width: 60px;
    height: 60px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
    transition: var(--transition);
}
.chat-toggle:hover { transform: scale(1.1) rotate(15deg); }

.chat-semipage {
    position: fixed;
    top: 0;
    right: -450px; /* Start off-screen */
    width: 450px;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(30px);
    border-left: 1px solid var(--glass-border);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -20px 0 50px rgba(0,0,0,0.5);
}
.chat-semipage.active { right: 0; }

.chat-header {
    padding: 30px;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header h2 { font-family: 'Outfit', sans-serif; font-size: 1.2rem; }

.chat-messages {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.msg {
    max-width: 85%;
    padding: 15px 20px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.msg.bot {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}
.msg.user {
    background: var(--accent-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.chat-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 15px;
}
.chat-option-btn {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--accent-primary);
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}
.chat-option-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateX(5px);
}

.chat-input-area {
    padding: 30px;
    border-top: 1px solid var(--glass-border);
}
.chat-input-wrapper {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 5px 15px;
    display: flex;
    align-items: center;
}
.chat-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 15px 0;
    color: var(--text-main);
    outline: none;
}

@media (max-width: 500px) {
    .chat-semipage { width: 100%; right: -100%; }
}

