/**
 * My-Trade - Main Stylesheet
 * Crypto Analytics Platform
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --bg-light: #F6F8FB;
    --bg-dark: #101622;
    --card-light: #FFFFFF;
    --card-dark: #1A2234;
    --text-main: #111318;
    --text-sec: #616f89;
    --accent-blue: #2563EB;
    --accent-slate: #64748B;
    --accent-purple: #7C3AED;
    --accent-gold: #D97706;
    --transition-fast: 150ms;
    --transition-normal: 300ms;
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   SCROLLBAR STYLES
   ============================================ */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #374151;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #4B5563;
}

/* Hide scrollbar for main content on mobile */
@media (max-width: 1023px) {
    main {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    main::-webkit-scrollbar {
        display: none;
    }
}

/* ============================================
   NAVIGATION STYLES
   ============================================ */
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.75rem;
    color: var(--text-sec);
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.dark .nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.nav-item .material-symbols-outlined {
    font-size: 24px;
    transition: all var(--transition-fast);
}

.nav-item.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

.nav-label {
    display: none;
}

@media (min-width: 1024px) {
    .nav-label {
        display: inline;
    }
}

/* ============================================
   CARD STYLES
   ============================================ */
.card {
    background: var(--card-light);
    border-radius: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all var(--transition-normal);
}

.dark .card {
    background: var(--card-dark);
    border-color: rgba(255, 255, 255, 0.05);
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* ============================================
   GAUGE COMPONENT
   ============================================ */
.gauge-container {
    position: relative;
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
}

.gauge-svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.gauge-bg {
    fill: none;
    stroke: #E5E7EB;
    stroke-width: 20;
    stroke-linecap: round;
}

.dark .gauge-bg {
    stroke: #374151;
}

.gauge-fill {
    fill: none;
    stroke-width: 20;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease-out;
}

.gauge-gradient {
    fill: none;
    stroke: url(#gaugeGradient);
    stroke-width: 20;
    stroke-linecap: round;
}

.gauge-needle {
    transition: transform 1s ease-out;
    transform-origin: center;
}

.gauge-center {
    fill: #1F2937;
}

.dark .gauge-center {
    fill: #E5E7EB;
}

.gauge-label {
    font-size: 10px;
    font-weight: bold;
    fill: #9CA3AF;
}

/* ============================================
   SPARKLINE CHARTS
   ============================================ */
.sparkline {
    width: 100%;
    height: 40px;
    overflow: visible;
}

.sparkline-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sparkline-area {
    opacity: 0.1;
}

.sparkline-positive {
    stroke: var(--success);
    fill: var(--success);
}

.sparkline-negative {
    stroke: var(--danger);
    fill: var(--danger);
}

/* ============================================
   PRICE DISPLAY
   ============================================ */
.price-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
}

.price-change.positive {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.price-change.negative {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.price-change .material-symbols-outlined {
    font-size: 14px;
}

/* ============================================
   EXCHANGE BADGES
   ============================================ */
.exchange-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
}

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

.exchange-bitvavo .dot { background: var(--accent-blue); }
.exchange-okx .dot { background: var(--accent-slate); }
.exchange-kraken .dot { background: var(--accent-purple); }
.exchange-binance .dot { background: var(--accent-gold); }

/* ============================================
   SIGNAL BADGES
   ============================================ */
.signal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.signal-accumulatie,
.signal-koop {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.signal-verkoop {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.signal-neutraal {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-sec);
}

/* ============================================
   TREND INDICATORS
   ============================================ */
.trend-bullish {
    color: var(--success);
}

.trend-bearish {
    color: var(--danger);
}

.trend-crabish {
    color: var(--warning);
}

.trend-icon {
    font-size: 24px;
}

/* ============================================
   TOOLTIPS
   ============================================ */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before,
[data-tooltip]::after {
    position: absolute;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-fast);
    z-index: 9999;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: #1F2937;
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    width: max-content;
    max-width: 220px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    text-align: left;
}

[data-tooltip]::after {
    content: '';
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1F2937;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    visibility: visible;
    opacity: 1;
}

/* Tooltip positioning - prevent overflow */
@media (max-width: 640px) {
    [data-tooltip]::before {
        max-width: 180px;
        font-size: 0.625rem;
        left: auto;
        right: -10px;
        transform: translateX(0);
    }
    [data-tooltip]::after {
        left: auto;
        right: 5px;
        transform: translateX(0);
    }
}

/* ============================================
   INDICATOR DISPLAYS
   ============================================ */
.indicator-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.indicator-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-sec);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.indicator-bar {
    height: 6px;
    border-radius: 3px;
    background: #E5E7EB;
    overflow: hidden;
}

.dark .indicator-bar {
    background: #374151;
}

.indicator-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width var(--transition-normal);
}

/* RSI Indicator */
.rsi-bar {
    position: relative;
}

.rsi-bar::before,
.rsi-bar::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(0, 0, 0, 0.2);
}

.dark .rsi-bar::before,
.dark .rsi-bar::after {
    background: rgba(255, 255, 255, 0.2);
}

.rsi-bar::before { left: 30%; }
.rsi-bar::after { right: 30%; }

/* ============================================
   LOADING STATES
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, #E5E7EB 25%, #F3F4F6 50%, #E5E7EB 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 0.375rem;
}

.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4B5563 50%, #374151 75%);
    background-size: 200% 100%;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from { 
        opacity: 0;
        transform: scale(0.95);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.animate-fadeIn { animation: fadeIn var(--transition-normal) ease-out; }
.animate-slideUp { animation: slideUp var(--transition-normal) ease-out; }
.animate-scaleIn { animation: scaleIn var(--transition-normal) ease-out; }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--card-light);
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-width: 300px;
    max-width: 400px;
    animation: slideUp var(--transition-normal) ease-out;
}

.dark .toast {
    background: var(--card-dark);
    border-color: rgba(255, 255, 255, 0.05);
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--primary); }

/* ============================================
   TABLE STYLES
   ============================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-sec);
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dark .data-table th {
    background: rgba(255, 255, 255, 0.02);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dark .data-table td {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.dark .data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ============================================
   CHATBOT STYLES
   ============================================ */
#tradoChat {
    font-size: 14px;
}

#tradoGreeting.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#tradoWindow.show {
    display: flex !important;
    animation: scaleIn var(--transition-normal) ease-out;
}

.trado-message {
    animation: slideUp var(--transition-fast) ease-out;
}

.trado-message-user {
    margin-left: auto;
}

.trado-message-user .trado-message-content {
    background: var(--primary);
    color: white;
    border-radius: 1rem 1rem 0 1rem;
}

.trado-message-assistant .trado-message-content {
    background: #F3F4F6;
    border-radius: 1rem 1rem 1rem 0;
}

.dark .trado-message-assistant .trado-message-content {
    background: #374151;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 640px) {
    .gauge-container {
        max-width: 160px;
    }
    
    [data-tooltip]::before {
        max-width: 200px;
        font-size: 0.7rem;
    }
    
    .toast {
        min-width: auto;
        max-width: calc(100vw - 3rem);
    }
    
    #tradoWindow {
        width: calc(100vw - 1.5rem);
        height: calc(100vh - 120px);
        right: -0.75rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    #sidebar,
    #tradoChat,
    header {
        display: none !important;
    }
    
    main {
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), #7C3AED);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.dark .glass {
    background: rgba(26, 34, 52, 0.8);
}

.no-select {
    user-select: none;
    -webkit-user-select: none;
}

.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Focus styles for accessibility */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
