/* ==========================================================================
   Design Tokens
   ========================================================================== */
:root {
    /* Base Colors */
    --bg-main: #0b0b14;
    --bg-secondary: #11111d;
    --surface: #151525;
    --surface-alt: #1b1b2d;
    --surface-soft: #222238;

    /* Text Colors */
    --text-primary: #f6f7fb;
    --text-secondary: #c4c7d4;
    --text-muted: #8d91a6;

    /* Brand Colors */
    --accent-primary: #8b5cf6;
    --accent-secondary: #a855f7;
    --accent-tertiary: #6d28d9;
    --accent-gold: #f5c542;
    --accent-green: #22c55e;

    /* Borders */
    --border-light: rgba(255, 255, 255, 0.06);
    --border-soft: rgba(139, 92, 246, 0.18);

    /* Shadows */
    --shadow-outer: 0 18px 45px rgba(0, 0, 0, 0.55);
    --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.04),
        inset 0 -1px 0 rgba(255, 255, 255, 0.02);
    --shadow-hover: 0 24px 60px rgba(0, 0, 0, 0.68);
    --shadow-glow: 0 0 0 1px rgba(139, 92, 246, 0.12),
        0 0 30px rgba(139, 92, 246, 0.12);

    /* Radius */
    --radius-xl: 1.75rem;
    --radius-lg: 1.25rem;
    --radius-md: 0.9rem;
    --radius-sm: 0.65rem;

    /* Transitions */
    --transition-fast: 0.18s ease;
    --transition-normal: 0.28s ease;
    --transition-smooth: 0.4s ease;

    /* Gradients */
    --gradient-main: linear-gradient(145deg, #181828 0%, #12121d 100%);
    --gradient-card: linear-gradient(145deg, #1a1a2b 0%, #131321 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    --gradient-table-head: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(168, 85, 247, 0.12));
}

/* ==========================================================================
   Base Reset & Global Styles
   ========================================================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background:
        radial-gradient(circle at top left, rgba(139, 92, 246, 0.12), transparent 28%),
        radial-gradient(circle at top right, rgba(168, 85, 247, 0.08), transparent 22%),
        linear-gradient(180deg, #090911 0%, var(--bg-main) 100%);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(139, 92, 246, 0.35);
    color: #fff;
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.85), rgba(168, 85, 247, 0.55));
    border-radius: 999px;
    border: 2px solid var(--bg-main);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(168, 85, 247, 1), rgba(139, 92, 246, 0.78));
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.text-accent-gold {
    color: var(--accent-gold) !important;
}

.text-accent-green {
    color: var(--accent-green) !important;
}

.text-accent-primary {
    color: var(--accent-primary) !important;
}

.text-gradient {
    background: linear-gradient(135deg, #ffffff 0%, #d7c8ff 45%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.border-glow {
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-glow);
}

.soft-blur {
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

/* ==========================================================================
   Layout Cards
   ========================================================================== */
.element-3d {
    background: var(--gradient-main);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-outer);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.element-3d::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 35%);
    pointer-events: none;
}

.card-3d {
    background: var(--gradient-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-outer);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), border-color var(--transition-smooth);
    position: relative;
}

.card-3d:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(139, 92, 246, 0.25);
}

.card-3d::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.card-body-custom {
    padding: clamp(1rem, 2vw, 2rem);
}

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs-3d {
    display: inline-flex;
    gap: 0.75rem;
    padding: 0.65rem;
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-inner);
}

.tab-btn {
    min-width: 150px;
    padding: 0.85rem 1.35rem !important;
    border-radius: var(--radius-md) !important;
    background: transparent !important;
    color: var(--text-secondary) !important;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast) !important;
    border: 1px solid transparent !important;
}

.tab-btn:hover {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

.nav-pills .nav-link.active,
.nav-pills .show>.nav-link {
    background: var(--gradient-accent) !important;
    color: #fff !important;
    box-shadow: 0 10px 28px rgba(139, 92, 246, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-1px);
}

/* ==========================================================================
   Data Grid
   ========================================================================== */
.currency-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.data-item-3d {
    background: linear-gradient(145deg, rgba(27, 27, 45, 0.96), rgba(18, 18, 30, 0.96));
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-inner);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
    position: relative;
    overflow: hidden;
    color: var(--text-primary) !important;
}

.data-item-3d * {
    color: var(--text-primary) !important;
}

.data-item-3d::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 2px;
    width: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), transparent);
    opacity: 0.85;
}

.data-item-3d:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(139, 92, 246, 0.22);
}

/* ==========================================================================
   Table Wrapper
   ========================================================================== */
.table-3d-wrapper {
    background: linear-gradient(145deg, rgba(21, 21, 37, 0.98), rgba(17, 17, 29, 0.98));
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-outer);
    padding: 1rem;
    overflow: hidden;
    position: relative;
}

.table-3d-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), transparent 35%);
    pointer-events: none;
}

/* ==========================================================================
   Professional Table Styling
   ========================================================================== */
.custom-table-3d {
    width: 100%;
    margin: 0;
    color: var(--text-primary);
    background: transparent;
    border-collapse: separate;
    border-spacing: 0 10px;
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: rgba(255, 255, 255, 0.06);
}

.custom-table-3d thead th {
    padding: 1rem 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    background: var(--gradient-table-head);
    border-top: 1px solid rgba(139, 92, 246, 0.18);
    border-bottom: 1px solid rgba(139, 92, 246, 0.18);
    vertical-align: middle;
    white-space: nowrap;
}

.custom-table-3d thead th:first-child {
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
    padding-left: 1.15rem;
}

.custom-table-3d thead th:last-child {
    border-top-left-radius: 14px;
    border-bottom-left-radius: 14px;
}

.custom-table-3d tbody tr {
    background: rgba(255, 255, 255, 0.025);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.custom-table-3d tbody tr:hover {
    background: rgba(139, 92, 246, 0.08) !important;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.custom-table-3d tbody td {
    padding: 1rem 1rem;
    vertical-align: middle;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.custom-table-3d tbody td:first-child {
    padding-left: 1.15rem;
    border-left: 1px solid rgba(255, 255, 255, 0.04);
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
}

.custom-table-3d tbody td:last-child {
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    border-top-left-radius: 14px;
    border-bottom-left-radius: 14px;
    padding-right: 1.15rem;
}

.custom-table-3d tbody tr:hover td {
    border-color: rgba(139, 92, 246, 0.2);
}

/* Table content helpers */
.table-title {
    font-weight: 700;
    color: var(--text-primary);
}

.table-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.table-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.12);
    color: #d8c7ff;
    border: 1px solid rgba(139, 92, 246, 0.18);
}

.table-badge.success {
    background: rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.18);
}

.table-badge.warning {
    background: rgba(245, 197, 66, 0.12);
    color: #fde68a;
    border-color: rgba(245, 197, 66, 0.18);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .element-3d {
        padding: 1.25rem;
        border-radius: var(--radius-lg);
    }

    .tabs-3d {
        display: flex;
        width: 100%;
        overflow-x: auto;
        padding: 0.5rem;
    }

    .tab-btn {
        min-width: 130px;
        padding: 0.75rem 1rem !important;
    }

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

    .table-3d-wrapper {
        padding: 0.75rem;
        border-radius: var(--radius-lg);
    }

    .custom-table-3d {
        border-spacing: 0 8px;
    }

    .custom-table-3d thead th,
    .custom-table-3d tbody td {
        padding: 0.9rem 0.85rem;
    }

    .custom-table-3d tbody td .d-none {
        display: inline-block !important;
        font-size: 9px;
    }
}

@media (max-width: 576px) {
    .card-body-custom {
        padding: 1rem;
    }

    .tab-btn {
        min-width: 110px;
        font-size: 0.92rem;
    }

    .custom-table-3d thead th {
        font-size: 0.78rem;
    }

    body {
        font-size: 80% !important;
    }
}

/* ==========================================================================
   Accessibility & Motion
   ========================================================================== */
:focus-visible {
    outline: 2px solid rgba(139, 92, 246, 0.85);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}