/* static/css/main.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-color: #080604;
    --card-bg: rgba(20, 12, 6, 0.75);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-color: #f3f4f6;
    --text-muted: #9ca3af;
    --primary: #e05a0a;
    --primary-glow: rgba(224, 90, 10, 0.4);
    --secondary: #ff8c3a;
    --secondary-glow: rgba(255, 140, 58, 0.3);
    --danger: #ff4d6d;
    --warning: #ff9f1c;
    --success: #2ec4b6;
    --font-family: 'Outfit', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: #000000;
    color: var(--text-color);
    min-height: 100vh;
}

/* Effet de verre (Glassmorphism) */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.55);
}

/* En-tête personnalisé avec bannière */
header.glass-card {
    display: flex;
    align-items: flex-end;
    padding: 0;
    width: 100%;
    min-height: 160px;
    position: relative;
    overflow: hidden;
    background: #000;
}

@media (min-width: 768px) {
    header.glass-card {
        min-height: 260px;
    }
}

/* Background image layer */
header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/static/twitterbanner5.png') center/cover no-repeat;
    pointer-events: none;
    z-index: 0;
}

/* Gradient overlay to make text readable */
header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(8, 6, 4, 0.95) 0%,
        rgba(8, 6, 4, 0.70) 45%,
        rgba(0, 0, 0, 0.00) 80%
    );
    pointer-events: none;
    z-index: 1;
}

header > * {
    position: relative;
    z-index: 2;
}

/* Animations et transitions micro-interactions */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #b84000 100%);
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: all 0.2s ease-in-out;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
    opacity: 0.95;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Style de tableau */
table th {
    font-weight: 600;
    color: var(--text-muted);
}
table tr {
    transition: background-color 0.15s ease;
}
table tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* ============================================================
   RESPONSIVE LAYOUT
   ============================================================ */

/* Mobile/tablet: only active tab section visible */
.tab-section {
    display: none;
}
.tab-section.tab-active {
    display: block;
}
/* Desktop: always show all sections */
@media (min-width: 768px) {
    .tab-section {
        display: flex !important;
        flex-direction: column;
        gap: 1.5rem; /* Equivaut à gap-6 pour harmoniser les espacements */
    }
}

/* Slim header (mobile/tablet) */
#slim-header {
    height: 52px;
    background: rgba(8, 6, 4, 0.96);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* Body padding to clear bottom tabs on mobile & tablet (< 1024px) */
@media (max-width: 1023px) {
    body {
        padding-top: 12px;
        padding-bottom: 72px;
        padding-left: 12px;
        padding-right: 12px;
    }
}
@media (min-width: 1024px) {
    body {
        padding: 32px;
    }
}

/* Bottom tab bar */
#bottom-tabs {
    height: 56px;
    background: rgba(8, 6, 4, 0.97);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
#bottom-tabs .tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    transition: color 0.15s ease;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
}
#bottom-tabs .tab-btn.active {
    color: #e05a0a;
}
#bottom-tabs .tab-btn i {
    font-size: 16px;
}

/* Top tabs (tablet 640-1023px) */
#top-tabs {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(20, 12, 6, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 4px;
    gap: 4px;
}
#top-tabs .tab-btn {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border: none;
    background: none;
    transition: all 0.15s ease;
}
#top-tabs .tab-btn.active {
    background: rgba(224, 90, 10, 0.15);
    color: #e05a0a;
}

/* Responsive table columns */
.holder-col-share,
.holder-col-trends,
.holder-col-updated {
    display: none;
}
@media (min-width: 768px) {
    .holder-col-share,
    .holder-col-trends {
        display: table-cell;
    }
}
@media (min-width: 1024px) {
    .holder-col-updated {
        display: table-cell;
    }
}

/* Account ID truncation on mobile */
.account-id-cell {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}
@media (min-width: 640px) {
    .account-id-cell {
        max-width: none;
    }
}

/* Holder expand detail row */
.holder-detail-row td {
    background: rgba(255, 255, 255, 0.015);
}

/* KPI expand */
#kpi-secondary.kpi-hidden {
    display: none;
}

/* Chart toggle (mobile) */
#chart-toggle .toggle-btn {
    flex: 1;
    text-align: center;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: none;
    color: #6b7280;
    transition: all 0.15s ease;
}
#chart-toggle .toggle-btn.active {
    background: #e05a0a;
    color: white;
}

/* Toast: above bottom tabs on mobile */
@media (max-width: 767px) {
    #toast {
        bottom: 68px;
    }
}

/* ============================================================
   LIGHT MODE STYLES
   ============================================================ */
html.light-mode {
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(148, 163, 184, 0.16);
    --text-color: #0f172a;
    --text-muted: #475569;
    --primary-glow: rgba(224, 90, 10, 0.15);
    --secondary-glow: rgba(255, 140, 58, 0.12);
}

html.light-mode body {
    background-image:
        radial-gradient(circle at 90% 15%, rgba(224, 90, 10, 0.22) 0%, transparent 60%),
        radial-gradient(circle at 10% 85%, rgba(255, 140, 58, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #f8fafc 20%, #ffffff 50%, #ffe7d1 100%);
}

html.light-mode .glass-card {
    box-shadow: 0 8px 32px 0 rgba(148, 163, 184, 0.06), 0 4px 12px 0 rgba(0, 0, 0, 0.02);
}

html.light-mode .glass-card:hover {
    border-color: rgba(224, 90, 10, 0.25);
    box-shadow: 0 12px 40px 0 rgba(148, 163, 184, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.03);
}

html.light-mode header.glass-card {
    background: #f8fafc !important;
    box-shadow: 0 8px 32px 0 rgba(148, 163, 184, 0.06), 0 4px 12px 0 rgba(0, 0, 0, 0.02) !important;
}

/* Invert the background image of the header banner in light mode:
   - Inverts black background to white
   - Inverts white text/logo inside the image to black
   - Retains the orange accents via 180deg hue rotation
*/
html.light-mode header::before {
    background: url('/static/twitterbanner5.png') center/cover no-repeat !important;
    filter: invert(1) hue-rotate(180deg) !important;
}

/* Gradient overlay for light mode */
html.light-mode header::after {
    background: linear-gradient(
        to top,
        rgba(248, 250, 252, 0.96) 0%,
        rgba(248, 250, 252, 0.60) 45%,
        rgba(255, 255, 255, 0.00) 80%
    ) !important;
}

html.light-mode #slim-header {
    background: rgba(248, 250, 252, 0.92) !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16) !important;
}

html.light-mode #bottom-tabs {
    background: rgba(248, 250, 252, 0.92) !important;
    border-top: 1px solid rgba(148, 163, 184, 0.16) !important;
}

html.light-mode #top-tabs {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(148, 163, 184, 0.16) !important;
}

/* Global utility class overrides for light mode */
html.light-mode .text-white {
    color: #0f172a !important;
}

html.light-mode .text-gray-300 {
    color: #334155 !important;
}

html.light-mode .text-gray-400 {
    color: #475569 !important;
}

html.light-mode .text-gray-500 {
    color: #64748b !important;
}

html.light-mode .text-orbit-light {
    color: #c2410c !important; /* Orange 700 (darker for readability) */
}

html.light-mode .text-orbit {
    color: #e05a0a !important; /* Couleur orange d'origine */
}

/* Logo ORBIT METRICS : ORBIT en orange, METRICS en noir en mode clair */
html.light-mode header #logo-metrics {
    color: #0f172a !important; /* Noir/Slate */
}

html.light-mode .border-white\/5,
html.light-mode .border-white\/10 {
    border-color: rgba(148, 163, 184, 0.18) !important;
}

html.light-mode .divide-white\/5 > * {
    border-color: rgba(148, 163, 184, 0.18) !important;
}

html.light-mode .bg-black\/60,
html.light-mode .bg-black\/40,
html.light-mode .bg-black\/80 {
    background-color: rgba(255, 255, 255, 0.8) !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

html.light-mode .hover\:bg-black\/80:hover {
    background-color: rgba(255, 255, 255, 0.95) !important;
}

html.light-mode select {
    color: #0f172a !important;
}

html.light-mode select option {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

html.light-mode input {
    color: #0f172a !important;
}

html.light-mode input::placeholder {
    color: #64748b !important;
}

html.light-mode table tr:hover {
    background-color: rgba(0, 0, 0, 0.02) !important;
}

/* Timeframe buttons overrides */
html.light-mode #timeframe-selector button:not(.bg-orbit) {
    color: #475569 !important;
}

html.light-mode #timeframe-selector button:not(.bg-orbit):hover {
    color: #0f172a !important;
}

/* Badges overrides for high contrast in light mode */
html.light-mode .text-green-400 {
    color: #166534 !important; /* Green 800 */
}
html.light-mode .bg-green-500\/10 {
    background-color: rgba(34, 197, 94, 0.12) !important;
}
html.light-mode .border-green-500\/20 {
    border-color: rgba(34, 197, 94, 0.25) !important;
}

html.light-mode .text-red-400 {
    color: #991b1b !important; /* Red 800 */
}
html.light-mode .bg-red-500\/10 {
    background-color: rgba(239, 68, 68, 0.1) !important;
}
html.light-mode .border-red-500\/20 {
    border-color: rgba(239, 68, 68, 0.2) !important;
}

html.light-mode .text-gray-400 {
    color: #475569 !important; /* Slate 600 */
}
html.light-mode .bg-gray-500\/10 {
    background-color: rgba(100, 116, 139, 0.08) !important;
}
html.light-mode .border-gray-500\/10 {
    border-color: rgba(100, 116, 139, 0.15) !important;
}

html.light-mode .text-blue-400 {
    color: #1e40af !important; /* Blue 800 */
}
html.light-mode .bg-blue-500\/10 {
    background-color: rgba(59, 130, 246, 0.12) !important;
}
html.light-mode .border-blue-500\/20 {
    border-color: rgba(59, 130, 246, 0.25) !important;
}

html.light-mode .text-indigo-400 {
    color: #3730a3 !important; /* Indigo 800 */
}
html.light-mode .bg-indigo-500\/10 {
    background-color: rgba(99, 102, 241, 0.12) !important;
}
html.light-mode .border-indigo-500\/20 {
    border-color: rgba(99, 102, 241, 0.25) !important;
}

html.light-mode .text-amber-400 {
    color: #9a3412 !important; /* Amber 800 */
}
html.light-mode .bg-amber-500\/10 {
    background-color: rgba(245, 158, 11, 0.12) !important;
}
html.light-mode .border-amber-500\/30 {
    border-color: rgba(245, 158, 11, 0.3) !important;
}

html.light-mode .text-purple-400 {
    color: #6b21a8 !important; /* Purple 800 */
}
html.light-mode .bg-purple-500\/10 {
    background-color: rgba(168, 85, 247, 0.12) !important;
}
html.light-mode .border-purple-500\/30 {
    border-color: rgba(168, 85, 247, 0.3) !important;
}

/* Scrollbar overrides */
html.light-mode ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.16) !important;
}
html.light-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.28) !important;
}

/* Optimization for landscape orientation on mobile & tablet */
@media (max-width: 1023px) and (orientation: landscape) {
    body {
        padding-top: 8px !important;
        padding-bottom: 60px !important; /* Space for bottom tabs */
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    header.glass-card {
        min-height: 120px !important;
    }
    
    header::before {
        opacity: 0.80 !important;
    }

    header::after {
        background: linear-gradient(
            to top,
            rgba(8, 6, 4, 0.70) 0%,
            rgba(0, 0, 0, 0.00) 100%
        ) !important;
    }
    
    .logo-section h1 {
        font-size: 1.25rem !important;
        line-height: 1.25rem !important;
    }
    
    .logo-section p {
        font-size: 0.75rem !important;
        margin-top: 2px !important;
    }

    #bottom-tabs {
        height: 48px !important;
    }
    #bottom-tabs .tab-btn {
        gap: 0 !important;
        font-size: 9px !important;
    }
    #bottom-tabs .tab-btn i {
        font-size: 14px !important;
    }
    
    /* Optimize chart container height for low landscape heights */
    #chart-container-price-liq {
        padding: 1rem !important;
    }
    #chart-container-price-liq .relative {
        min-height: 200px !important;
    }
}
