/* ── PipriseTrader Global Styles ────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --bg-input: #1a1a25;
    --border: #2a2a3a;
    --border-focus: #c9a84c;
    --text-primary: #f0ede6;
    --text-secondary: #8a8a9a;
    --text-muted: #5a5a6a;
    --gold: #c9a84c;
    --gold-light: #dfc06a;
    --gold-dark: #a68a30;
    --green: #22c55e;
    --green-bg: rgba(34,197,94,0.1);
    --red: #ef4444;
    --red-bg: rgba(239,68,68,0.1);
    --blue: #3b82f6;
    --blue-bg: rgba(59,130,246,0.1);
    --orange: #f59e0b;
    --orange-bg: rgba(245,158,11,0.1);
    --purple: #8b5cf6;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-gold: 0 0 30px rgba(201,168,76,0.15);
    --font-body: 'DM Sans', sans-serif;
    --font-display: 'DM Sans', sans-serif;
    --font-numeric: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; background: var(--bg-primary); }
/* FIX: html element needs matching bg — on mobile where viewport > body (sub-pixel
   rounding / scrollbar gap), the browser default bg bleeds as a dark strip on the right. */
html, body { overflow-x: hidden; max-width: 100vw; }

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--gold-light); }

/* ── Typography ──────────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.125rem; }

.text-gold { color: var(--gold); }
.text-muted { color: var(--text-secondary); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-mono { font-family: var(--font-mono); }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 28px; border-radius: var(--radius);
    font-family: var(--font-body); font-size: 0.9rem; font-weight: 600;
    letter-spacing: 0.03em; text-transform: uppercase;
    border: none; cursor: pointer; transition: var(--transition);
    text-decoration: none;
}
.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #0a0a0f; box-shadow: var(--shadow-gold);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 0 40px rgba(201,168,76,0.3); color: #0a0a0f; }
.btn-outline {
    background: transparent; border: 1.5px solid var(--border);
    color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 8px 16px; font-size: 0.8rem; }
.btn-lg { padding: 16px 40px; font-size: 1rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Cards ───────────────────────────────────────────── */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 28px;
    transition: var(--transition); min-width: 0;
}
.card:hover { border-color: rgba(201,168,76,0.2); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-header h3 { font-size: 1.1rem; font-family: var(--font-body); font-weight: 600; }

/* ── Forms ────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; font-size: 0.85rem; font-weight: 500;
    color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase;
    letter-spacing: 0.05em;
}
.form-control {
    width: 100%; padding: 12px 16px; background: var(--bg-input);
    border: 1.5px solid var(--border); border-radius: var(--radius);
    color: var(--text-primary); font-family: var(--font-body);
    font-size: 0.95rem; transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,168,76,0.1); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238a8a9a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }

/* ── Tables ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); min-width: 0; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 14px 16px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); background: var(--bg-secondary); border-bottom: 1px solid var(--border); font-weight: 600; }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(201,168,76,0.03); }

/* ── Badges ──────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; padding: 4px 12px;
    border-radius: 20px; font-size: 0.75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-gold { background: rgba(201,168,76,0.12); color: var(--gold); }
.badge-purple { background: rgba(139,92,246,0.12); color: #8b5cf6; }

/* ── Layout: Auth Pages ──────────────────────────────── */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg-primary);
    background-image: radial-gradient(ellipse at 20% 50%, rgba(201,168,76,0.04) 0%, transparent 60%);
}
.auth-box {
    width: 100%; max-width: 440px; padding: 40px;
}
.auth-logo { text-align: center; margin-bottom: 36px; }
.auth-logo img { height: 48px; }
.auth-logo h1 { font-size: 1.6rem; margin-top: 12px; }
.auth-logo p { color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px; }
.auth-footer { text-align: center; margin-top: 24px; color: var(--text-secondary); font-size: 0.88rem; }

/* ── Layout: Dashboard ───────────────────────────────── */
.dashboard { display: flex; min-height: 100vh; overflow-x: hidden; }
.sidebar {
    width: 260px; background: var(--bg-secondary); border-right: 1px solid var(--border);
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 50;
    display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0;
}
.sidebar-logo { padding: 24px 20px; border-bottom: 1px solid var(--border); }
.sidebar-logo img { height: 32px; }
.sidebar-logo span { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; margin-left: 10px; }
.sidebar-nav { padding: 16px 12px; flex: 1; }
.nav-section { margin-bottom: 24px; }
.nav-section-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 0 12px; margin-bottom: 8px; }
.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border-radius: 8px; color: var(--text-secondary); font-size: 0.9rem;
    font-weight: 500; transition: var(--transition); margin-bottom: 2px;
}
.nav-link:hover { color: var(--text-primary); background: rgba(201,168,76,0.06); }
.nav-link.active { color: var(--gold); background: rgba(201,168,76,0.1); }
.nav-link svg { width: 18px; height: 18px; opacity: 0.7; }
.nav-link.active svg { opacity: 1; }

.main-content { flex: 1; margin-left: 260px; overflow-x: hidden; min-width: 0; }
.topbar {
    height: 64px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px; background: var(--bg-secondary);
    position: sticky; top: 0; z-index: 40; gap: 12px;
}
.topbar-left { display: none; flex-shrink: 0; }
.topbar-title { font-family: var(--font-body); font-size: 1.1rem; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.topbar-email { }

.page-content { padding: 32px; max-width: 100%; overflow-x: hidden; }

/* ── Stats Grid ──────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px; overflow: hidden; min-width: 0;
}
.stat-card .stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; margin-top: 6px; font-family: var(--font-numeric); font-feature-settings: 'tnum' 1, 'lnum' 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-card .stat-change { font-size: 0.82rem; margin-top: 4px; }

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 32px; width: 100%;
    max-width: 520px; max-height: 90vh; overflow-y: auto;
    transform: translateY(20px); transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h3 { font-family: var(--font-body); font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.4rem; }

/* ── Alert ───────────────────────────────────────────── */
.alert { padding: 14px 20px; border-radius: var(--radius); margin-bottom: 20px; font-size: 0.9rem; }
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.alert-info { background: var(--blue-bg); color: var(--blue); border: 1px solid rgba(59,130,246,0.2); }

/* ── Responsive ──────────────────────────────────────── */
.sidebar-toggle{display:none;background:none;border:1px solid var(--border);cursor:pointer;color:var(--text-primary);padding:0;border-radius:8px;transition:var(--transition)}
.sidebar-toggle:hover{border-color:var(--gold);color:var(--gold)}
.sidebar-toggle svg{width:20px;height:20px;min-width:20px;min-height:20px;display:block;flex-shrink:0}
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:45}
.sidebar-overlay.open{display:block}
.sidebar{transition:transform .25s cubic-bezier(.4,0,.2,1)}

@media (max-width: 768px) {
    /* ── Sidebar: off-screen by default ── */
    .sidebar { transform: translateX(-100%); position: fixed; z-index: 50; }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.4); }
    .main-content { margin-left: 0 !important; }
    
    /* ── Topbar: [☰] ---- Title ---- [Badge] ── */
    .topbar { padding: 0 12px; height: 54px; gap: 0; }
    .topbar-left { display: flex !important; align-items: center; width: 48px; flex-shrink: 0; }
    .sidebar-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }
    .sidebar-toggle svg {
        width: 22px;
        height: 22px;
        min-width: 22px;
        min-height: 22px;
    }
    .topbar-title { flex: 1; text-align: center; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .topbar-right { gap: 6px; min-width: 48px; justify-content: flex-end; flex-shrink: 0; }
    .topbar-email { display: none !important; }
    .topbar-right .text-sm { display: none !important; }
    .topbar-right .badge { font-size: .65rem; padding: 3px 8px; }
    
    /* ── Stats Grid ── */
    .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; margin-bottom: 16px; }
    .stat-card { padding: 14px 16px; }
    .stat-card .stat-value { font-size: 1.3rem; }
    .stat-card .stat-label { font-size: .65rem; letter-spacing: .03em; }
    .stat-card .stat-change { font-size: .72rem; }
    
    /* ── Page Content ── */
    .page-content { padding: 14px; }
    .card { padding: 16px; }
    .card-header { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
    .card-header h3 { font-size: .95rem; }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.15rem; }
    .grid-2 { grid-template-columns: 1fr !important; gap: 16px; }
    .mb-6 { margin-bottom: 16px; }
    
    /* ── Force all inline grid styles to stack on mobile ── */
    [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns:repeat(auto-fit,minmax(200px"] { grid-template-columns: 1fr 1fr !important; }
    
    /* ── Tables ── */
    .table-wrap { margin: 0 -16px; border-radius: 0; border-left: none; border-right: none; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { font-size: .78rem; }
    th, td { padding: 10px 12px; }
    
    /* ── Buttons/Forms ── */
    .btn { padding: 10px 16px; font-size: .8rem; }
    .btn-sm { padding: 6px 12px; font-size: .72rem; }
    .form-control { padding: 10px 12px; font-size: .88rem; }
    .modal { padding: 20px; margin: 10px; max-width: calc(100vw - 20px); }
    .auth-box { padding: 24px 20px; margin: 10px; }
    .flex.gap-2 { flex-wrap: wrap; }
    .login-tabs .login-tab { font-size: .8rem; padding: 10px 14px; }
    
    /* ── Client dashboard: notification rows ── */
    [style*="display:flex;justify-content:space-between"] { flex-direction: column !important; gap: 4px; }
    
    /* ── Team dashboard feature grid ── */
    .dashboard [style*="grid-template-columns:repeat(auto-fit,minmax(200px,1fr))"] { grid-template-columns: 1fr 1fr !important; gap: 12px !important; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
    .stat-card { padding: 12px 14px; }
    .stat-card .stat-value { font-size: 1.1rem; }
    .stat-card .stat-label { font-size: .6rem; }
    .page-content { padding: 10px; }
    .card { padding: 14px; }
    .topbar-title { font-size: .85rem; }
    th, td { padding: 8px 10px; font-size: .74rem; }
    
    /* ── Stack team feature cards to 1 column on very small screens ── */
    .dashboard [style*="grid-template-columns:repeat(auto-fit,minmax(200px,1fr))"] { grid-template-columns: 1fr !important; }
}

@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 6px; }
    .stat-card { padding: 10px 12px; }
    .stat-card .stat-value { font-size: 1rem; }
    .stat-card .stat-label { font-size: .55rem; }
    .topbar-title { font-size: .8rem; }
    .page-content { padding: 8px; }
    .card { padding: 12px; }
}

/* ── Animations ──────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp 0.5s ease forwards; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.2s; }
.animate-in:nth-child(4) { animation-delay: 0.3s; }

/* ── Utility ─────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > * { min-width: 0; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.85rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-text { cursor: pointer; position: relative; }
.copy-text:hover { color: var(--gold); }

/* ── Landing Page Specific ───────────────────────────── */
.hero {
    min-height: 100vh; display: flex; align-items: center;
    position: relative; overflow: hidden;
    background: radial-gradient(ellipse at 50% -20%, rgba(201,168,76,0.08) 0%, transparent 60%);
}
.hero::before {
    content: ''; position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h60v60H0z' fill='none'/%3E%3Cpath d='M30 0v60M0 30h60' stroke='%23ffffff' stroke-opacity='0.02' stroke-width='0.5'/%3E%3C/svg%3E");
    pointer-events: none;
}
.hero-content { max-width: 1200px; margin: 0 auto; padding: 0 40px; position: relative; z-index: 1; }

.nav-main {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    padding: 20px 40px; display: flex; align-items: center; justify-content: space-between;
    background: rgba(10,10,15,0.8); backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(201,168,76,0.08);
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-brand img { height: 32px; }
.nav-brand span { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; color: var(--text-primary); }
.nav-links { display: flex; gap: 32px; }
.nav-links a { color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; }
.nav-links a:hover { color: var(--gold); }

.pricing-section { padding: 120px 40px; background: var(--bg-secondary); }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; max-width: 1400px; margin: 0 auto; }
.price-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 36px;
    position: relative; transition: var(--transition);
}
.price-card:hover { border-color: rgba(201,168,76,0.3); transform: translateY(-4px); }
.price-card.featured { border-color: var(--gold); }
.price-card.featured::before {
    content: 'MOST POPULAR'; position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #0a0a0f; padding: 4px 16px; border-radius: 20px; font-size: 0.7rem;
    font-weight: 700; letter-spacing: 0.06em;
}
.price-name { font-size: 1.1rem; font-weight: 600; color: var(--text-secondary); }
.price-amount { font-size: 2.8rem; font-weight: 700; font-family: var(--font-numeric); font-feature-settings: 'tnum' 1, 'lnum' 1; margin: 12px 0 4px; }
.price-amount span { font-size: 1rem; color: var(--text-muted); }
.price-features { list-style: none; margin: 24px 0; }
.price-features li { padding: 8px 0; font-size: 0.9rem; color: var(--text-secondary); display: flex; align-items: center; gap: 10px; }
.price-features li::before { content: '✓'; color: var(--gold); font-weight: 700; }
.price-features li.disabled { opacity: 0.4; }
.price-features li.disabled::before { content: '✕'; color: var(--text-muted); }

.features-section { padding: 120px 40px; max-width: 1200px; margin: 0 auto; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 32px; margin-top: 60px; }
.feature-card {
    padding: 32px; border-radius: var(--radius-lg);
    border: 1px solid var(--border); transition: var(--transition);
}
.feature-card:hover { border-color: rgba(201,168,76,0.2); background: rgba(201,168,76,0.02); }
.feature-icon { width: 48px; height: 48px; border-radius: 12px; background: rgba(201,168,76,0.1); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; color: var(--gold); font-size: 1.4rem; }

.footer {
    padding: 40px; border-top: 1px solid var(--border);
    text-align: center; color: var(--text-muted); font-size: 0.85rem;
}
