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

/* ===== VARIABLES - DARK ===== */
[data-theme="dark"] {
    --bg: #050505;
    --bg-header: rgba(5,5,5,0.92);
    --surface: rgba(255,255,255,0.03);
    --surface-hover: rgba(255,255,255,0.06);
    --border: rgba(255,255,255,0.08);
    --border-focus: rgba(255,255,255,0.25);
    --text: #f5f5f5;
    --text-secondary: #888;
    --text-muted: #555;
    --accent: #fff;
    --accent-text: #050505;
    --highlight: #f5f5f5;
    --red: #ef4444;
    --grid-line: rgba(255,255,255,0.02);
    --radial-1: rgba(255,255,255,0.015);
    --radial-2: rgba(255,255,255,0.008);
    --input-bg: rgba(255,255,255,0.03);
    --tag-bg: rgba(255,255,255,0.06);
    --bullet-color: rgba(255,255,255,0.25);
    --sidebar-bg: #0a0a0a;
    --overlay-bg: rgba(0,0,0,0.6);
    --wallet-bar-bg: rgba(255,255,255,0.03);
    --dot-color: #888;
}

/* ===== VARIABLES - LIGHT ===== */
[data-theme="light"] {
    --bg: #f5f5f5;
    --bg-header: rgba(245,245,245,0.92);
    --surface: rgba(0,0,0,0.03);
    --surface-hover: rgba(0,0,0,0.06);
    --border: rgba(0,0,0,0.1);
    --border-focus: rgba(0,0,0,0.3);
    --text: #111;
    --text-secondary: #555;
    --text-muted: #888;
    --accent: #111;
    --accent-text: #f5f5f5;
    --highlight: #111;
    --red: #dc2626;
    --grid-line: rgba(0,0,0,0.03);
    --radial-1: rgba(0,0,0,0.02);
    --radial-2: rgba(0,0,0,0.01);
    --input-bg: rgba(0,0,0,0.03);
    --tag-bg: rgba(0,0,0,0.06);
    --bullet-color: rgba(0,0,0,0.25);
    --sidebar-bg: #eee;
    --overlay-bg: rgba(0,0,0,0.3);
    --wallet-bar-bg: rgba(0,0,0,0.03);
    --dot-color: #888;
}

/* ===== BASE ===== */
body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

/* ===== BACKGROUND ===== */
.bg-pattern {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        radial-gradient(ellipse 80% 60% at 50% 0%, var(--radial-1) 0%, transparent 60%),
        radial-gradient(circle at 20% 80%, var(--radial-2) 0%, transparent 40%);
    pointer-events: none;
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

/* ===== LAYOUT ===== */
.container {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== HEADER ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s;
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo img { width: 32px; height: 32px; }

.logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.5px;
}

.desktop-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
    transition: color 0.2s;
}

.nav-link:hover { color: var(--text); }

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    width: 36px;
    height: 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--border-focus);
    color: var(--text);
}

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ===== HAMBURGER ===== */
.mobile-header-actions {
    display: none;
    align-items: center;
    gap: 8px;
}

.hamburger-btn {
    width: 36px;
    height: 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}

.hamburger-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger-btn:hover { border-color: var(--border-focus); }
.hamburger-btn:hover span { background: var(--text); }

/* ===== SIDEBAR ===== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--overlay-bg);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay.open { opacity: 1; visibility: visible; }

.mobile-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 300;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: var(--sidebar-bg);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.3s ease, background 0.3s;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-sidebar.open { transform: translateX(0); }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-close {
    width: 36px;
    height: 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.sidebar-close:hover { border-color: var(--border-focus); color: var(--text); }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    gap: 4px;
}

.sidebar-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-family: 'JetBrains Mono', monospace;
    padding: 12px 14px;
    border-radius: 10px;
    transition: all 0.2s;
}

.sidebar-nav a:hover { background: var(--surface); color: var(--text); }

.sidebar-connected { margin-bottom: 8px; }
.sidebar-disconnect { margin-bottom: 8px; width: 100%; text-align: center; }

/* ===== CONNECTED BADGE ===== */
.connected-badge {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text);
}

.dot-status {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--dot-color);
    flex-shrink: 0;
}

.connected-badge.show { display: flex; }

/* ===== WALLET BAR ===== */
.wallet-bar {
    margin-top: 16px;
    margin-bottom: -16px;
}

.wallet-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--wallet-bar-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.wallet-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== DISCONNECT ===== */
.disconnect-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.disconnect-btn:hover {
    border-color: #ff4444;
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

[data-theme="light"] .disconnect-btn:hover {
    border-color: #dc2626;
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

/* ===== HERO ===== */
.hero {
    padding: 64px 0 40px;
    text-align: center;
}

.hero h1 {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 700;
    letter-spacing: -2px;
    line-height: 1.1;
    margin-bottom: 16px;
}

.hero-description {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ===== PROTOCOL STATS ===== */
.protocol-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 40px;
}

.protocol-stat {
    background: var(--bg);
    padding: 24px 20px;
    text-align: center;
    transition: background 0.3s;
}

.protocol-stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.protocol-stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.highlight { color: var(--highlight); }

/* ===== SECTION LABEL ===== */
.section-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

/* ===== POSITION CARD ===== */
.position-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 40px;
    transition: background 0.3s, border-color 0.3s;
}

.position-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.position-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.position-label {
    font-size: 12px;
    color: var(--text-muted);
}

.position-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    word-break: break-word;
}

.position-value.highlight { color: var(--highlight); }

.position-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

/* ===== WITHDRAW PARTIAL ===== */
.withdraw-partial {
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.input-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.input-row .input-wrapper { flex: 1; }
.input-row .btn-outline { white-space: nowrap; }

/* ===== STAKE FORM ===== */
.stake-form { margin-bottom: 48px; }

/* ===== INPUT ===== */
.input-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.clickable { cursor: pointer; transition: color 0.2s; }
.clickable:hover { color: var(--text); }

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within { border-color: var(--border-focus); }

.input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 600;
    padding: 12px 16px;
    min-width: 0;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.input-wrapper input::-webkit-outer-spin-button,
.input-wrapper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-wrapper input[type=number] { -moz-appearance: textfield; }

.token-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--tag-bg);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    margin-right: 4px;
}

/* ===== STAKE INFO ===== */
.stake-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-top: 12px;
    margin-bottom: 16px;
}

.stake-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.stake-info-row .label { color: var(--text-muted); }

.stake-info-row .value {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== BUTTONS ===== */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

.btn-action {
    flex: 1;
    padding: 12px 16px;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-action:hover { opacity: 0.9; }
.btn-action:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-outline {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-outline:hover { border-color: var(--border-focus); background: var(--surface); }
.btn-outline:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== INFO SECTION ===== */
.info-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 48px;
}

.info-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.info-item .bullet {
    width: 8px;
    height: 8px;
    min-width: 8px;
    background: var(--bullet-color);
    border-radius: 50%;
    margin-top: 6px;
}

.info-item .info-text h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.info-item .info-text p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===== NOTIFICATION ===== */
.notification {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    padding: 14px 20px;
    border-radius: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 400px;
}

.notification.show { transform: translateX(0); }

.notification.success {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    color: var(--text);
}

.notification.error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    color: var(--red);
}

[data-theme="light"] .notification.success {
    background: rgba(0,0,0,0.04);
    border: 1px solid var(--border);
    color: var(--text);
}

/* ===== SPINNER ===== */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== FOOTER ===== */
.footer {
    padding: 32px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .desktop-nav { display: none; }
    .mobile-header-actions { display: flex; }
    .hero { padding: 48px 0 32px; }

    .position-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .header-inner { padding: 14px 16px; }
    .container { padding: 0 16px; }
    .hero { padding: 40px 0 24px; }
    .hero h1 { letter-spacing: -1px; }
    .hero-description { font-size: 13px; }

    .protocol-stats {
        grid-template-columns: 1fr;
    }

    .protocol-stat {
        padding: 14px 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
    }

    .protocol-stat-label { margin-bottom: 0; }

    .position-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .position-card { padding: 20px; }
    .position-actions { flex-direction: column; }
    .input-row { flex-direction: column; }

    .input-wrapper input {
        font-size: 16px;
        padding: 10px 12px;
    }

    .btn-primary { font-size: 13px; padding: 14px; }

    .connected-badge {
        padding: 6px 10px;
        font-size: 11px;
    }

    .wallet-bar-inner {
        padding: 8px 12px;
    }

    .wallet-info {
        font-size: 12px;
    }
}

@media (max-width: 380px) {
    .header-inner { padding: 12px; }
    .logo img { width: 28px; height: 28px; }
    .logo-text { font-size: 16px; }
    .position-value { font-size: 14px; }
    .protocol-stat-value { font-size: 15px; }
}