/* 🔥🔥🔥 Shared Console Styles - User Console & Admin Console
 * Created: November 9, 2025
 * Purpose: Reusable theming system for both user_console and admin_console
 * Database-driven CSS variables loaded via Jinja2 templates
 */

/* 🔥🔥🔥 CSS Variables - Loaded from page_styles_user_console table */
/* These are set in the HTML template via inline <style> tag */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
}

/* 🔥🔥🔥 Fixed Top Bar */
.fixed-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 40px;
    background: rgba(7, 4, 31, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 40px;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.top-bar-left h1 {
    color: var(--accent-color);
    font-size: 20px;
    font-weight: 600;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-bar-right a,
.top-bar-right button {
    padding: var(--btn-padding-v) var(--btn-padding-h);
    background: var(--btn-primary-bg);
    border: 1px solid var(--tab-border);
    color: var(--btn-primary-text);
    border-radius: var(--btn-radius);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    font-family: inherit;
}

.top-bar-right a:hover,
.top-bar-right button:hover {
    background: var(--btn-primary-hover);
}

/* 🔥🔥🔥 Main Container */
.main-content {
    padding-top: 100px;
    padding-bottom: 40px;
    max-width: 1600px;
    margin: 0 auto;
    padding-left: 40px;
    padding-right: 40px;
}

/* 🔥🔥🔥 Hero Card - Token Balance */
/* 🔥🔥🔥 Top section wrapper: hero + stats side by side */
/* 🔥🔥🔥 Default: cards on left (row-reverse), hero on right */
.top-section-wrapper {
    display: flex;
    flex-direction: row-reverse;
    gap: 20px;
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

/* 🔥🔥🔥 Swapped: cards on right, hero on left (original layout) */
.top-section-wrapper.swapped {
    flex-direction: row;
}

/* 🔥🔥🔥 Collapsed wrapper becomes single row */
.top-section-wrapper.collapsed {
    gap: 15px;
    margin-bottom: 15px;
    margin-left: -15px; /* Offset main-content padding */
    padding-left: 0;
}

.hero-card {
    background: var(--hero-bg);
    border: 1px solid var(--hero-border);
    border-radius: var(--hero-radius);
    padding: var(--hero-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    flex: 2;
    position: relative;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

/* 🔥🔥🔥 Collapse toggle button */
.hero-collapse-toggle {
    position: absolute;
    top: 20px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--hero-border);
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.hero-card.collapsed .hero-collapse-toggle {
    transform: translateY(0px); /* Moves container toggle button up and down */
}

.hero-collapse-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.hero-collapse-icon {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--accent-color);
    transition: transform 0.3s ease;
}

.hero-card.collapsed .hero-collapse-icon {
    transform: rotate(180deg);
}

/* 🔥🔥🔥 Collapsed state */
.hero-card.collapsed {
    padding: 15px 30px;
    gap: 20px;
    max-height: 80px;
}

.hero-card.collapsed .hero-left,
.hero-card.collapsed .hero-right {
    display: none;
}

.hero-card-collapsed-content {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding-right: 50px;
    margin-top: 0px;
}

.hero-card.collapsed .hero-card-collapsed-content {
    display: flex;
}

.collapsed-token-info {
    display: flex;
    align-items: baseline;
    gap: 30px;
    font-size: 14px;
}

.collapsed-token-main {
    font-size: 24px;
    font-weight: 700;
    color: var(--hero-text);
}

.collapsed-token-percentage {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.collapsed-token-percentage span {
    font-size: 24px;
    font-weight: 600;
    color: var(--accent-color);
}

/* 🔥🔥🔥 Mini gauge in collapsed state */
.mini-gauge {
    width: 24px;
    height: 24px;
    position: relative;
}

.mini-gauge svg {
    transform: rotate(-90deg);
    position: relative;
    top: 3px;
}

.mini-gauge .gauge-bg {
    fill: none;
    stroke: var(--gauge-bg);
    stroke-width: 3;
}

.mini-gauge .gauge-fill {
    fill: none;
    stroke: var(--gauge-full);
    stroke-width: 3;
    stroke-linecap: round;
}

.mini-gauge .gauge-fill.medium {
    stroke: var(--gauge-medium);
}

.mini-gauge .gauge-fill.low {
    stroke: var(--gauge-low);
}

.collapsed-token-details {
    font-size: 13px;
    color: var(--text-secondary);
}

.hero-left {
    flex: 1;
}

.hero-balance {
    font-size: 48px;
    font-weight: 700;
    color: var(--hero-text);
    margin-bottom: 10px;
}

.hero-label {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-right {
    display: flex;
    flex-direction: column;
    gap: 33px;
}

/* 🔥🔥🔥 Token Gauge */
.token-gauge {
    width: 200px;
    height: 200px;
    position: relative;
}

.gauge-svg {
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: var(--gauge-bg);
    stroke-width: 12;
}

.gauge-fill {
    fill: none;
    stroke: var(--gauge-full);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease, stroke 0.3s ease;
}

.gauge-fill.medium {
    stroke: var(--gauge-medium);
}

.gauge-fill.low {
    stroke: var(--gauge-low);
}

.gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gauge-percentage {
    font-size: 32px;
    font-weight: 700;
    color: var(--hero-text);
}

.gauge-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 🔥🔥🔥 Quick Stats */
.quick-stats {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    opacity: 1;
    max-width: 500px;
    max-height: 1000px;
    overflow: hidden;
    transition: opacity 0.3s ease, max-width 0.3s ease, max-height 0.3s ease;
}

/* 🔥🔥🔥 Quick stats collapsed - hide completely */
.top-section-wrapper.collapsed .quick-stats {
    opacity: 0;
    max-width: 0;
    max-height: 0;
    pointer-events: none;
}

.stat-card {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    text-align: center;
    transition: all 0.3s ease;
}

/* 🔥🔥🔥 Stat cards collapsed state */
.top-section-wrapper.collapsed .stat-card {
    padding: 15px;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.top-section-wrapper.collapsed .stat-number {
    font-size: 24px;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.top-section-wrapper.collapsed .stat-label {
    display: none;
}

/* 🔥🔥🔥 Show/hide label text based on collapsed state */
.stat-label-collapsed {
    display: none;
}

.top-section-wrapper.collapsed .stat-label-expanded {
    display: none;
}

.top-section-wrapper.collapsed .stat-label-collapsed {
    display: none;
}

/* 🔥🔥🔥 Tab Navigation with Sliding Indicator */
.tab-navigation {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 7.5px;
    padding: 5px 0px;
    gap: 5px;
    margin-bottom: 30px;
    position: relative;
}

.tab-btn {
    padding: calc(var(--tab-padding-v) * 1.25) calc(var(--tab-padding-h) * 1.25);
    background: var(--tab-inactive-bg);
    border: none;
    color: var(--tab-inactive-text);
    border-radius: var(--tab-radius);
    cursor: pointer;
    transition: color var(--transition);
    font-size: 17.5px;
    font-weight: 500;
    font-family: inherit;
    position: relative;
    z-index: 2;
}

.tab-btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

.tab-btn.active {
    color: var(--tab-active-text);
}

/* 🔥🔥🔥 Sliding Tab Indicator */
.tab-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    background: var(--tab-active-bg);
    border: 1px solid var(--tab-border);
    border-radius: var(--tab-radius);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

/* 🔥🔥🔥 Tab Content Areas */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 🔥🔥🔥 Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    overflow: hidden;
}

.data-table thead {
    background: var(--table-header-bg);
}

.data-table thead tr {
    background: rgba(0, 0, 0, 0.3) !important;
}

.data-table thead tr:hover {
    background: rgba(10, 20, 40, 0.5) !important; /* Dark blue-black hover */
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--table-header-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.3) !important;
}

.data-table td {
    padding: 12px 16px;
    border-top: 1px solid var(--table-border);
    font-size: 14px;
    color: var(--table-row-text);
}

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

.data-table tbody tr:hover {
    background: var(--table-row-hover);
}

/* 🔥🔥🔥 Buttons */
.btn {
    padding: var(--btn-padding-v) var(--btn-padding-h);
    border-radius: var(--btn-radius);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: none;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: 1px solid var(--tab-border);
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
}

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

.btn-secondary:hover {
    background: var(--btn-secondary-hover);
}

/* 🔥🔥🔥 Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding-top: 10px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }

    .header h1 {
        font-size: 24px;
    }

    .header-right {
        flex-direction: row;
        gap: 10px;
        width: 100%;
        justify-content: center;
    }

    .header-right a {
        padding: 8px 16px;
        font-size: 13px;
    }

    .main-content {
        padding: 20px 15px;
        margin-top: 0;
    }

    .top-section-wrapper {
        flex-direction: column !important;
        gap: 15px;
    }

    .hero-card {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }

    .hero-balance {
        font-size: 36px;
    }

    .hero-label {
        font-size: 12px;
    }

    .token-gauge {
        width: 180px;
        height: 180px;
    }

    .gauge-percentage {
        font-size: 32px;
    }

    .gauge-text {
        font-size: 11px;
    }

    .quick-stats {
        flex-direction: row;
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-number {
        font-size: 28px;
    }

    /* 🔥🔥🔥 Collapsed hero card on mobile */
    .hero-card.collapsed {
        padding: 15px;
    }

    .collapsed-token-info {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .collapsed-token-main {
        font-size: 20px;
    }

    .collapsed-token-percentage {
        font-size: 16px;
    }

    .collapsed-token-details {
        font-size: 12px;
    }

    .hero-card-collapsed-content {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .hero-card-collapsed-content .btn {
        width: 100%;
    }

    .stat-label {
        font-size: 11px;
    }

    .tab-navigation {
        flex-wrap: wrap;
        gap: 8px;
        padding: 0 10px;
    }

    .tab-btn {
        font-size: 13px;
        padding: 10px 16px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }

    h2 {
        font-size: 20px !important;
    }
}

/* 🔥🔥🔥 Theme Picker Modal (Superadmin only) */
.theme-picker-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent-color);
    color: #000;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9999;
    display: none; /* Hidden by default, shown only for superadmin */
}

.theme-picker-trigger.visible {
    display: block;
}

/* 🔥🔥🔥 Mobile styles */
@media (max-width: 768px) {
    .top-section-wrapper {
        margin-top: 80px;
    }
    .gauge-svg {
        transform: scale(0.66);
    }
    #tab-overview table th:first-child,
    #tab-overview table td:first-child,
    #tab-overview table th:last-child,
    #tab-overview table td:last-child {
        display: none;
    }
}

/* 🔥🔥🔥 Typography System - Centralized Text Size Control */

/* Base font size - adjust this to scale ALL text sizes */
body {
    font-size: 16px; /* Base size - all rem values calculated from this */
}

/* Typography Size Classes */
.text-xs {
    font-size: 0.75rem; /* 12px */
}

.text-sm {
    font-size: 1rem; /* 16px */
}

.text-base {
    font-size: 1rem; /* 16px */
}

.text-lg {
    font-size: 1.125rem; /* 18px */
}

.text-xl {
    font-size: 1.25rem; /* 20px */
}

.text-2xl {
    font-size: 1.5rem; /* 24px */
}

/* Semantic Component Classes */
.page-title {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.3rem;
    color: var(--heading-color);
    margin-bottom: 20px;
}

.card-subtitle {
    font-size: 1.1rem;
    color: var(--subheading-color);
    margin-bottom: 15px;
}

.card-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.setting-label {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
}

.setting-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.info-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.small-label {
    font-size: 0.8125rem; /* 13px */
    color: var(--label-color);
}

/* Color Utility Classes */
.text-primary {
    color: var(--text-primary);
}

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

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

.text-heading {
    color: var(--heading-color);
}

/* Font Weight Utilities */
.font-light {
    font-weight: 300;
}

.font-normal {
    font-weight: 400;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

/* Common Spacing Utilities */
.mb-5 {
    margin-bottom: 5px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-15 {
    margin-bottom: 15px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-30 {
    margin-bottom: 30px;
}
