/* ============================================================
   RXDT Theme Enhancements & Polish
   ============================================================ */

/* ---- Custom Scrollbar (Dark Theme) ---- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(0, 242, 254, 0.3), rgba(121, 40, 202, 0.3));
    border-radius: 8px;
    border: 2px solid var(--bg-dark);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(0, 242, 254, 0.5), rgba(121, 40, 202, 0.5));
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 242, 254, 0.3) var(--bg-dark);
}

/* ---- Text Selection ---- */
::selection {
    background: rgba(0, 242, 254, 0.3);
    color: #fff;
}

/* ---- Smooth Page Transitions ---- */
#page-content {
    animation: pageFadeIn 0.3s ease;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

/* ---- Focus States for Accessibility ---- */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--el-color-primary);
    outline-offset: 2px;
}

/* ---- Button Active States ---- */
.btn-primary:active,
.btn-dark:active,
.btn-outline:active,
.btn-success:active,
.btn-danger:active {
    transform: scale(0.97);
}

/* ---- Card Hover Elevation ---- */
.card {
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.card:hover {
    border-color: rgba(0, 242, 254, 0.2);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 15px rgba(0, 242, 254, 0.05);
}

/* ---- Skeleton Loading States ---- */
.skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    animation: skeletonShimmer 1.5s infinite;
}

@keyframes skeletonShimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.skeleton-line {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.medium {
    width: 80%;
}

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

/* ---- Tooltip ---- */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #1e293b;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid rgba(0, 242, 254, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 100;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}

.tooltip .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1e293b;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---- Toggle Switch ---- */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 26px;
    transition: all 0.3s;
}

.switch .slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.switch input:checked+.slider {
    background: linear-gradient(135deg, #00f2fe, #0284c7);
    border-color: transparent;
}

.switch input:checked+.slider::before {
    transform: translateX(22px);
}

.switch input:focus-visible+.slider {
    outline: 2px solid var(--el-color-primary);
    outline-offset: 2px;
}

/* ---- Progress Bar ---- */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00f2fe, #7928ca);
    border-radius: 6px;
    transition: width 0.5s ease;
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}

/* ---- Animated Gradient Border Card ---- */
.gradient-border {
    position: relative;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1px;
    overflow: hidden;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: conic-gradient(from 0deg, #00f2fe, #7928ca, #ff007a, #00f2fe);
    animation: rotateBorder 6s linear infinite;
}

.gradient-border>* {
    position: relative;
    z-index: 1;
    background: var(--bg-card);
    border-radius: 15px;
    margin: 1px;
}

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

/* ---- Glow Pulse Animation ---- */
@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
    }

    50% {
        box-shadow: 0 0 25px rgba(0, 242, 254, 0.5);
    }
}

.glow-pulse {
    animation: glowPulse 2s ease-in-out infinite;
}

/* ---- Floating Animation ---- */
@keyframes floatUp {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

.float-anim {
    animation: floatUp 3s ease-in-out infinite;
}

/* ---- Subtle Background Grid Pattern ---- */
.bg-grid-pattern {
    background-image:
        linear-gradient(rgba(0, 242, 254, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 242, 254, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* ---- Stat Card with Icon ---- */
.stat-card-icon {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.2s, transform 0.2s;
}

.stat-card-icon:hover {
    border-color: rgba(0, 242, 254, 0.3);
    transform: translateY(-2px);
}

.sci-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.2);
}

.sci-info {
    flex: 1;
    min-width: 0;
}

.sci-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.sci-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
}

/* ---- Notification Badge ---- */
.notif-badge {
    position: relative;
    display: inline-flex;
}

.notif-badge .notif-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #ff4d4d;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
    animation: notifPulse 2s infinite;
}

@keyframes notifPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(255, 77, 77, 0);
    }
}

/* ---- Divider with Gradient ---- */
.gradient-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 242, 254, 0.4), rgba(121, 40, 202, 0.4), transparent);
    border: none;
    margin: 20px 0;
}

/* ---- Tag / Chip ---- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-sub);
}

.chip-cyan {
    background: rgba(0, 242, 254, 0.1);
    border-color: rgba(0, 242, 254, 0.3);
    color: var(--el-color-primary);
}

.chip-purple {
    background: rgba(121, 40, 202, 0.1);
    border-color: rgba(121, 40, 202, 0.3);
    color: #a78bfa;
}

.chip-green {
    background: rgba(0, 196, 154, 0.1);
    border-color: rgba(0, 196, 154, 0.3);
    color: #00c49a;
}

.chip-red {
    background: rgba(255, 77, 77, 0.1);
    border-color: rgba(255, 77, 77, 0.3);
    color: #ff4d4d;
}

.chip-gold {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

/* ---- Empty State with Icon ---- */
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ---- Number Ticker Animation ---- */
@keyframes numberPulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

.price-flash-up {
    animation: flashUp 0.5s ease;
}

.price-flash-down {
    animation: flashDown 0.5s ease;
}

@keyframes flashUp {
    0% {
        color: #00c49a;
        text-shadow: 0 0 10px rgba(0, 196, 154, 0.5);
    }

    100% {
        color: inherit;
        text-shadow: none;
    }
}

@keyframes flashDown {
    0% {
        color: #ff4d4d;
        text-shadow: 0 0 10px rgba(255, 77, 77, 0.5);
    }

    100% {
        color: inherit;
        text-shadow: none;
    }
}

/* ---- Responsive Table Card ---- */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.table-card .table-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.table-card .table-card-body {
    overflow-x: auto;
}

/* ---- Action Icon Button ---- */
.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.icon-btn:hover {
    background: rgba(0, 242, 254, 0.1);
    border-color: rgba(0, 242, 254, 0.4);
    color: var(--el-color-primary);
}

.icon-btn.danger:hover {
    background: rgba(255, 77, 77, 0.1);
    border-color: rgba(255, 77, 77, 0.4);
    color: #ff4d4d;
}

/* ---- Page Loader (Inline) ---- */
.inline-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.inline-loader .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 242, 254, 0.2);
    border-top-color: var(--el-color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ---- Card with Left Accent Border ---- */
.accent-card {
    border-left: 3px solid var(--el-color-primary);
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--el-color-primary);
    margin-bottom: 12px;
}

.accent-card.purple {
    border-left-color: var(--accent-purple);
}

.accent-card.green {
    border-left-color: var(--color-up);
}

.accent-card.red {
    border-left-color: var(--color-down);
}

.accent-card.gold {
    border-left-color: #f59e0b;
}

/* ---- Responsive Grid Improvements ---- */
@media (max-width: 768px) {
    .stat-card-icon {
        padding: 12px;
    }

    .sci-value {
        font-size: 16px;
    }
}

/* ---- Reduced Motion Preference ---- */
@media (prefers-reduced-motion: reduce) {

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