:root {
    --bg-color: #000000;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --glass-bg: rgba(20, 20, 20, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-blue: #4F89F8;
    --accent-gold: #FFD700;
    --accent-cyan: #00FFFF;
    --accent-green: #00E676;
    --accent-red: #FF1744;

    --bid-color: #00E676;
    --ask-color: #FF1744;
    --blur-amount: 20px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* body doesn't scroll; grid-container does */
}

/* Animated background */
.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background:
        radial-gradient(circle at 10% 20%, rgba(0, 255, 255, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(255, 215, 0, 0.05) 0%, transparent 40%);
    filter: blur(40px);
}

/* Header */
.header-bar {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(var(--blur-amount));
    border-bottom: 1px solid var(--glass-border);
    z-index: 100;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-width: max-content;
    max-width: 1800px;
    margin: 0 auto;
    gap: 24px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-weight: 700;
    font-size: 16px;
    background: linear-gradient(90deg, #fff, #bbb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-subtitle {
    font-size: 10px;
    color: var(--text-secondary);
}

.controls-section {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
    justify-content: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

/* Token Filter */
.token-filter-compact {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 2px 8px;
    gap: 6px;
    transition: 0.2s;
}

.token-filter-compact.active-filter,
.token-filter-compact:focus-within {
    border-color: var(--accent-cyan);
    background: rgba(0, 255, 255, 0.05);
}

.token-input-compact {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 13px;
    width: 100px;
    outline: none;
}

.token-clear-compact {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    display: none;
}

.token-clear-compact.active {
    display: block;
}

/* Exchange filter dropdown */
.ex-filter-wrap {
    position: relative;
}

.ex-filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 0 12px;
    height: 32px;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: 0.2s;
}

.ex-filter-btn:hover {
    border-color: var(--accent-cyan);
    background: rgba(0, 255, 255, 0.05);
}

.ex-filter-arrow {
    font-size: 10px;
    opacity: 0.5;
    transition: transform 0.2s;
}

.ex-filter-wrap.open .ex-filter-arrow {
    transform: rotate(180deg);
}

.ex-filter-dropdown {
    position: fixed;
    min-width: 200px;
    background: #1a1a1a;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 6px 0;
    z-index: 2000;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.ex-filter-dropdown.open {
    display: block;
    animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ex-filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #ccc;
    transition: background 0.15s;
}

.ex-filter-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ex-filter-item img {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    object-fit: contain;
}

.ex-filter-item input[type="checkbox"] {
    accent-color: var(--accent-cyan);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* Sort Wrapper */
.sort-wrapper {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 0 8px;
    height: 32px;
    display: flex;
    align-items: center;
}

.toolbar-select {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
}

.toolbar-select option {
    background: #111;
    color: #fff;
}

/* Slider Container */
.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 12px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.slider {
    appearance: none;
    width: 100px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.slider::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-cyan);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.slider.slider-yellow {
    background: rgba(255, 215, 0, 0.15);
}

.slider.slider-yellow::-webkit-slider-thumb {
    background: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.slider-value {
    font-size: 12px;
    font-weight: 600;
    min-width: 30px;
    text-align: right;
}

/* Right Section */
.right-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-section {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
}

.status-dot.connected {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.icon-action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.icon-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Stats Bar */
.stats-bar-dom {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 8px 0;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--glass-border);
    font-size: 12px;
    color: var(--text-secondary);
}

.stat-label {
    margin-right: 6px;
}

.stat-value {
    color: #fff;
    font-weight: 600;
}

/* Grid Container - Masonry columns */
.grid-container {
    padding: 16px;
    column-width: 280px;
    column-gap: 12px;
    column-fill: auto;
    flex: 1;
    height: 0;
    /* height:0 + flex:1 gives a definite height so CSS columns break correctly */
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 0;
    position: relative;
}

/* Right edge scroll hint — gradient + animated chevron */
.grid-container::after {
    content: '›';
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 36px;
    height: 60px;
    background: linear-gradient(to right, transparent, rgba(79, 137, 248, 0.25) 70%);
    border-radius: 8px 0 0 8px;
    pointer-events: none;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: rgba(79, 137, 248, 0.8);
    animation: pulseRight 2s ease-in-out infinite;
}

@keyframes pulseRight {
    0%, 100% { opacity: 0.6; transform: translateY(-50%) translateX(0); }
    50% { opacity: 1; transform: translateY(-50%) translateX(4px); }
}

.grid-container.scrolled-end::after {
    opacity: 0 !important;
    animation: none;
    transition: opacity 0.3s ease;
}

/* Coin Card */
.coin-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    margin-bottom: 12px;
    break-inside: avoid;
    display: inline-block;
    width: 100%;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.3s ease,
        box-shadow 0.3s ease;
    will-change: transform;
    contain: layout;
}

.coin-card:hover {
    border-color: rgba(79, 137, 248, 0.4);
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 8px 24px rgba(79, 137, 248, 0.12), 0 0 0 1px rgba(79, 137, 248, 0.15);
    z-index: 10;
}

/* Favorite star button */
.fav-btn {
    opacity: 0.3;
    transition: opacity 0.2s, transform 0.2s;
}

.fav-btn:hover {
    opacity: 0.7;
    transform: scale(1.2);
}

.fav-btn.active {
    opacity: 1;
}

.fav-btn.active svg {
    fill: #FFD700;
    stroke: #FFD700;
}

.coin-card.is-fav {
    border-color: rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.08);
}

.coin-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.coin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--glass-border);
    background: linear-gradient(135deg, rgba(79, 137, 248, 0.15) 0%, rgba(255, 255, 255, 0.03) 40%, rgba(0, 255, 200, 0.1) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -1px 0 rgba(79, 137, 248, 0.05);
    border-radius: 16px 16px 0 0;
    cursor: pointer;
}

.coin-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
}

.coin-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.coin-stat {
    font-size: 11px;
    color: var(--accent-cyan);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Fix width for timer to prevent layout jumping */
.coin-updated {
    font-variant-numeric: tabular-nums;
}

.coin-orders {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
    /* Removed overflow: hidden to allow exchange tooltips to overlap header */
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.coin-orders .order-row:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.coin-orders .order-row:last-child .order-bg {
    border-bottom-left-radius: 8px;
}

.order-row {
    display: grid;
    grid-template-columns: minmax(0, auto) 18px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 5px 14px;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.order-exchange {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Exchange logo image */
.ex-logo-img {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    object-fit: contain;
    display: block;
}

/* Fallback text badge */
.ex-logo-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
}

/* Tooltip wrapper */
.ex-tooltip-wrap {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.ex-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: var(--tt-color, #444);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
}

.ex-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--tt-color, #444);
}

.ex-tooltip-wrap:hover .ex-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.order-bg {
    position: absolute;
    top: 1px;
    bottom: 1px;
    left: 0;
    z-index: 0;
    transition: width 0.3s;
}

.order-size {
    font-weight: 700;
    position: relative;
    z-index: 1;
    border-radius: 2px;
    padding: 0 4px;
}

.order-price {
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.order-dist {
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: 0.2s;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: #111;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    width: 950px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
    font-size: 18px;
    color: #fff;
}

.close-modal-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    overflow-x: auto;
}

.d-flex {
    display: flex;
}

.settings-left {
    width: 360px;
    flex-shrink: 0;
}

.settings-middle {
    width: 260px;
    flex-shrink: 0;
}

.settings-right {
    min-width: 280px;
    flex-shrink: 0;
}

.settings-group {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    margin-bottom: 16px;
}

.settings-group h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.ex-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ex-row .input-field {
    width: 90px;
    flex: none;
}

.ex-icon-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #222;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ex-market-toggle {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
}

.ex-market-toggle.active {
    background: #fff;
    color: #000;
}

.input-field {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 8px 12px;
    color: #fff;
    outline: none;
    transition: 0.2s;
}

.input-field:focus {
    border-color: var(--accent-cyan);
}

.input-field-sm {
    width: 60px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 4px 8px;
    color: #fff;
    outline: none;
}

.exchanges-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ex-toggle-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
}

.btn {
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: 0.2s;
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(79, 137, 248, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

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

@keyframes spin {
    0% {
        transform: rotate(0);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Settings Modal */
@media (max-width: 900px) {
    .modal-body .d-flex {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
    }

    .settings-left,
    .settings-middle,
    .settings-right {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .modal-content {
        width: 100%;
        max-height: 95vh;
        margin: 10px;
    }
}

/* Mobile: single column cards, vertical scroll */
@media (max-width: 768px) {
    body {
        height: 100dvh;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .header-bar {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        flex-shrink: 0;
    }

    .stats-bar-dom {
        flex-shrink: 0;
    }

    .grid-container {
        columns: unset !important;
        column-width: unset !important;
        display: flex !important;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 12px;
    }

    .grid-container::after {
        display: none;
    }

    .coin-card {
        display: block;
        width: 100%;
        flex-shrink: 0;
        break-inside: auto;
        contain: none;
        will-change: auto;
    }

    .coin-card:hover {
        transform: none;
    }

    .controls-section {
        gap: 12px;
    }

    #scaleGroup {
        display: none;
    }
}

.loading-text {
    color: #fff;
}

/* Chart Modal */
.chart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease-out;
}

.chart-modal.show {
    display: flex;
}

.chart-modal-content {
    background: rgba(30, 30, 35, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    width: 90%;
    max-width: 1000px;
    height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chart-modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-container {
    flex: 1;
    width: 100%;
    background: #1E1E23;
    position: relative;
}

.chart-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    display: flex;
    gap: 6px;
}

.chart-zoom-btn {
    height: 28px;
    min-width: 28px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.chart-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.chart-reset-btn {
    font-size: 11px;
    font-weight: 600;
}

.chart-modal-footer {
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    align-items: center;
    justify-content: space-between;
}

.chart-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.chart-ctrl-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.chart-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.bid {
    background: rgba(0, 255, 127, 0.5);
}

.dot.ask {
    background: rgba(255, 69, 96, 0.5);
}

/* Animated Tooltips */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before,
[data-tooltip]::after {
    position: absolute;
    visibility: hidden;
    opacity: 0;
    transition: all 0.2s ease-out;
    transition-delay: 0.1s;
    z-index: 1000;
    pointer-events: none;
}

[data-tooltip]::before {
    content: '';
    border: 5px solid transparent;
    border-top-color: rgba(30, 30, 30, 0.95);
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    background: rgba(30, 30, 30, 0.95);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Refresh Button Styles */
.refresh-card-btn {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.refresh-card-btn.cooldown {
    opacity: 0.3;
    cursor: not-allowed;
}

.refresh-card-btn.spinning svg {
    animation: spin 1s linear infinite;
}

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