/* ============================================
   NEX Sniper — Trading Dashboard Styles
   Minimal CSS for modals, notifications, toggles
   (Main layout is handled by Tailwind)
   ============================================ */

/* Hide number input spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* ============ WALLET GATE OVERLAY ============ */
.wallet-gate-overlay {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(11, 14, 17, 0.75);
    border-radius: inherit;
}
.wallet-gate-overlay.hidden { display: none; }
.wallet-gate-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 3rem;
    background: rgba(17, 20, 23, 0.95);
    border: 1px solid rgba(39, 42, 46, 0.8);
    box-shadow: 0 0 60px rgba(160, 32, 240, 0.08);
}

/* ============ MODAL OVERLAY ============ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
}
.modal-overlay.show {
    display: flex;
    animation: overlayFadeIn 0.3s ease;
}
@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============ MODAL CARD (settings) ============ */
.modal-card {
    background: #111417;
    border: 1px solid #272a2e;
    border-radius: 12px;
    width: 400px;
    max-width: 92vw;
    overflow: hidden;
    animation: modalIn 0.35s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 25px 80px rgba(0,0,0,0.6);
}
.modal-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #a020f0, #14F195);
}
.modal-card.modal-large { width: 560px; }
.modal-card.modal-wide { width: 880px; }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #272a2e;
}
.modal-header h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    color: #e1e2e7;
    margin: 0;
}
.modal-close {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid #272a2e;
    color: #9a8ca0;
    cursor: pointer;
    font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.modal-close:hover {
    background: rgba(255,71,87,0.1);
    color: #ffb4ab;
    border-color: rgba(255,71,87,0.3);
}
.modal-body { padding: 20px 24px; }

/* ============ WALLET CONNECT CARD ============ */
.wc-card {
    width: 370px;
    max-width: 92vw;
    background: #1a1d2e;
    border: 1px solid #272a2e;
    border-radius: 16px;
    box-shadow: 0 0 80px rgba(0,0,0,0.6);
    overflow: hidden;
    animation: modalIn 0.35s ease-out;
}
.wc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 14px;
    position: relative;
}
.wc-title {
    position: absolute;
    left: 50%; transform: translateX(-50%);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px; font-weight: 600;
    color: #fff;
    white-space: nowrap;
}
.wc-help {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0; transition: all 0.2s;
}
.wc-help:hover { border-color: rgba(255,255,255,0.3); color: rgba(255,255,255,0.7); }
.wc-help svg { width: 16px; height: 16px; }

.wc-close {
    width: 30px; height: 30px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0; transition: color 0.2s;
}
.wc-close svg { width: 16px; height: 16px; }
.wc-close:hover { color: #fff; }

.wc-list { padding: 2px 16px 10px; }
.wc-row {
    display: flex; align-items: center; gap: 14px;
    width: 100%; padding: 14px 16px;
    border-radius: 12px;
    background: #252838;
    border: none; color: #fff; cursor: pointer;
    text-align: left; margin-bottom: 6px;
    transition: background 0.15s;
    font-family: 'Space Grotesk', sans-serif;
    position: relative; overflow: hidden;
}
.wc-row:last-child { margin-bottom: 0; }
.wc-row:hover { background: #2e3245; }
.wc-icon {
    width: 42px; height: 42px; min-width: 42px;
    border-radius: 12px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.wc-icon svg { width: 42px; height: 42px; display: block; border-radius: 12px; }
.wc-connecting-icon {
    width: 56px; height: 56px; min-width: 56px;
    border-radius: 16px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.wc-connecting-icon svg { width: 56px; height: 56px; display: block; border-radius: 16px; }
.wc-icon-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
    width: 42px; height: 42px; min-width: 42px;
    border-radius: 12px; overflow: hidden;
}
.wc-icon-grid svg { width: 100%; height: 100%; border-radius: 3px; }
.wc-name { flex: 1; font-size: 15px; font-weight: 600; color: #fff; }
.wc-badge {
    font-size: 10px; font-weight: 700;
    padding: 4px 10px; border-radius: 6px;
    letter-spacing: 0.5px; text-transform: uppercase; line-height: 1;
}
.wc-badge-green { background: rgba(74,222,128,0.12); color: #4ade80; }
.wc-badge-purple { background: rgba(167,139,250,0.12); color: #a78bfa; }
.wc-badge-gray { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.45); }
.wc-footer {
    padding: 14px 20px 22px; text-align: center;
    font-size: 13px; color: rgba(255,255,255,0.35);
}
.wc-link { color: rgba(255,255,255,0.65); text-decoration: underline; font-weight: 600; transition: color 0.2s; }
.wc-link:hover { color: #fff; }

/* Stagger animation for wallet rows */
.modal-overlay.show .wc-row:nth-child(1) { animation: modalItemIn 0.4s ease 0.05s both; }
.modal-overlay.show .wc-row:nth-child(2) { animation: modalItemIn 0.4s ease 0.1s both; }
.modal-overlay.show .wc-row:nth-child(3) { animation: modalItemIn 0.4s ease 0.15s both; }
.modal-overlay.show .wc-row:nth-child(4) { animation: modalItemIn 0.4s ease 0.2s both; }
.modal-overlay.show .wc-row:nth-child(5) { animation: modalItemIn 0.4s ease 0.25s both; }
.modal-overlay.show .wc-row:nth-child(6) { animation: modalItemIn 0.4s ease 0.3s both; }
@keyframes modalItemIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ SETTINGS TABS ============ */
.settings-tabs {
    display: flex; gap: 6px;
    margin-bottom: 20px;
    border-bottom: 1px solid #272a2e;
    padding-bottom: 12px;
    position: relative;
}
.stab-btn {
    padding: 8px 16px; border-radius: 8px;
    background: transparent; border: none;
    color: #9a8ca0; font-size: 0.8rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.stab-btn.active {
    background: linear-gradient(135deg, #a020f0, #e3b5ff);
    color: #0b0e11;
    box-shadow: 0 2px 10px rgba(160,32,240,0.2);
}
.stab-btn:hover:not(.active) { color: #e1e2e7; background: rgba(255,255,255,0.05); }
.stab-content { display: none; animation: tabFadeIn 0.35s ease; }
.stab-content.active { display: block; }
@keyframes tabFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.settings-grid { display: flex; flex-direction: column; gap: 16px; }
.s-group label {
    display: block; font-size: 0.85rem; font-weight: 600;
    margin-bottom: 8px; color: #e1e2e7;
}
.s-group input,
.s-group select {
    width: 100%; padding: 11px 14px; border-radius: 8px;
    background: #0b0e11; border: 1px solid #272a2e;
    color: #e1e2e7; font-size: 0.85rem;
    font-family: 'Space Grotesk', sans-serif;
    transition: all 0.2s;
}
.s-group input:focus,
.s-group select:focus {
    outline: none;
    border-color: rgba(160,32,240,0.4);
    box-shadow: 0 0 10px rgba(160,32,240,0.1);
}
.s-group select {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.4)' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
}
.s-group select option { background: #0b0e11; color: #e1e2e7; }
.s-group small { display: block; margin-top: 6px; font-size: 0.7rem; color: #9a8ca0; }
.s-toggle {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px;
}
.s-toggle label { margin-bottom: 0; flex: 1; }
.s-toggle small { width: 100%; }

/* ============ MODAL ACTIONS ============ */
.modal-actions {
    display: flex; gap: 10px; margin-top: 24px;
    padding-top: 16px; border-top: 1px solid #272a2e;
}
.btn-modal-cancel,
.btn-modal-save {
    flex: 1; padding: 12px; border-radius: 8px;
    border: none; cursor: pointer;
    font-weight: 700; font-size: 0.85rem; transition: all 0.2s;
}
.btn-modal-cancel {
    background: rgba(255,255,255,0.03);
    border: 1px solid #272a2e; color: #9a8ca0;
}
.btn-modal-cancel:hover {
    background: rgba(255,71,87,0.08);
    border-color: rgba(255,71,87,0.3); color: #ffb4ab;
}
.btn-modal-save {
    background: linear-gradient(135deg, #a020f0, #e3b5ff);
    color: #0b0e11;
}
.btn-modal-save:hover {
    box-shadow: 0 0 25px rgba(160,32,240,0.3);
    filter: brightness(1.1);
}

/* ============ TOGGLE SWITCH ============ */
.toggle {
    width: 44px; height: 24px;
    border-radius: 12px;
    background: #3a3d42;
    border: 1px solid #555;
    cursor: pointer;
    position: relative;
    transition: background 0.3s, border-color 0.3s;
    flex-shrink: 0;
}
.toggle.active { background: #14F195; border-color: #14F195; }
.toggle-knob {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 2px; left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle.active .toggle-knob { transform: translateX(20px); }

/* ============ NOTIFICATIONS ============ */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
}
.notification {
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #fff;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    animation: notifIn 0.35s ease;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    font-family: 'Space Grotesk', sans-serif;
}
.notification.success {
    background: rgba(20,241,149,0.12);
    border-color: rgba(20,241,149,0.25);
    box-shadow: 0 4px 20px rgba(20,241,149,0.08);
}
.notification.error {
    background: rgba(255,71,87,0.12);
    border-color: rgba(255,71,87,0.25);
    box-shadow: 0 4px 20px rgba(255,71,87,0.08);
}
.notification.warning {
    background: rgba(255,193,7,0.12);
    border-color: rgba(255,193,7,0.25);
    box-shadow: 0 4px 20px rgba(255,193,7,0.08);
}
.notification.info {
    background: rgba(227,181,255,0.12);
    border-color: rgba(227,181,255,0.25);
    box-shadow: 0 4px 20px rgba(227,181,255,0.08);
}
.notification.fade-out {
    animation: notifOut 0.3s ease forwards;
}
@keyframes notifIn {
    from { opacity: 0; transform: translateX(60px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes notifOut {
    to { opacity: 0; transform: translateX(60px) scale(0.95); }
}
.notification-progress {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #14F195, #a0ffc3);
    animation: progressShrink 4s linear forwards;
}
.notification.error .notification-progress { background: linear-gradient(90deg, #ff4757, #ff6b6b); }
.notification.warning .notification-progress { background: linear-gradient(90deg, #ffc107, #ffdb4d); }
.notification.info .notification-progress { background: linear-gradient(90deg, #e3b5ff, #a020f0); }
@keyframes progressShrink {
    from { transform: scaleX(1); transform-origin: left; }
    to { transform: scaleX(0); transform-origin: left; }
}

/* ============ RIPPLE EFFECT ============ */
.topbar-btn,
.wc-row,
.btn-modal-save,
.btn-modal-cancel,
.toggle-grid-btn {
    position: relative;
    overflow: hidden;
}
.ripple-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transform: scale(0);
    animation: rippleExpand 0.5s ease-out forwards;
    pointer-events: none;
}
@keyframes rippleExpand {
    to { transform: scale(4); opacity: 0; }
}

/* ============ EXECUTION SLIDER ============ */
.exec-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #272a2e;
    outline: none;
    border-radius: 2px;
    cursor: pointer;
}
.exec-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 4px; height: 16px;
    background: #e1e2e7;
    cursor: pointer;
    border: none;
}
.exec-slider::-moz-range-thumb {
    width: 4px; height: 16px;
    background: #e1e2e7;
    cursor: pointer;
    border: none; border-radius: 0;
}

/* ============ TOKEN TABLE ROW ANIMATIONS ============ */
@keyframes fadeInRow {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* PnL flash */
.pnl-flash-green { animation: pnlPulseGreen 0.5s ease; }
@keyframes pnlPulseGreen {
    0% { text-shadow: 0 0 20px rgba(20,241,149,0.8); transform: scale(1.15); }
    100% { text-shadow: none; transform: scale(1); }
}
.pnl-flash-red { animation: pnlPulseRed 0.5s ease; }
@keyframes pnlPulseRed {
    0% { text-shadow: 0 0 20px rgba(255,71,87,0.8); transform: scale(1.15); }
    100% { text-shadow: none; transform: scale(1); }
}

/* Row state flash */
.token-list-item.state-flash { animation: rowStateFlash 0.6s ease; }
@keyframes rowStateFlash {
    0% { background: rgba(20,241,149,0.12); }
    100% { background: transparent; }
}
.token-list-item.state-flash-red { animation: rowStateFlashRed 0.6s ease; }
@keyframes rowStateFlashRed {
    0% { background: rgba(255,71,87,0.12); }
    100% { background: transparent; }
}

/* Background flash */
body.profit-flash { animation: bgFlashGreen 0.8s ease; }
@keyframes bgFlashGreen {
    0% { box-shadow: inset 0 0 200px rgba(20,241,149,0.06); }
    100% { box-shadow: none; }
}
body.loss-flash { animation: bgFlashRed 0.8s ease; }
@keyframes bgFlashRed {
    0% { box-shadow: inset 0 0 200px rgba(255,71,87,0.06); }
    100% { box-shadow: none; }
}

/* ============ SKELETON LOADING ============ */
.skeleton-row {
    display: flex; gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(39,42,46,0.3);
}
.skeleton-block {
    height: 14px; flex: 1;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.8s ease-in-out infinite;
}
.skeleton-block.wide { flex: 2; }
.skeleton-block.narrow { flex: 0.5; }
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============ NOISE OVERLAY ============ */
.noise-overlay {
    position: fixed; inset: 0;
    z-index: 1; pointer-events: none;
    opacity: 0.02; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat; background-size: 256px 256px;
}

/* ============ TAB INDICATOR ============ */
.tab-indicator {
    position: absolute; bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, #a020f0, #e3b5ff);
    border-radius: 2px;
    transition: left 0.35s cubic-bezier(0.4,0,0.2,1), width 0.35s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 0 10px rgba(160,32,240,0.4);
}

/* ============ WALLET CONNECT BUTTON (header icon) ============ */
.wallet-icon {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
}
.wallet-icon svg { width: 28px; height: 28px; border-radius: 6px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .notification-container { right: 10px; left: 10px; max-width: none; }
    .wc-card { width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; }
    .modal-card { width: 100%; max-width: 100%; }
}

/* ============ PREFERS REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .noise-overlay { display: none !important; }
}
