@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #090d16;
    --bg-card: rgba(20, 27, 44, 0.75);
    --bg-card-hover: rgba(30, 41, 67, 0.88);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-light: rgba(255, 255, 255, 0.18);
    
    --primary: #06b6d4;
    --primary-glow: rgba(6, 182, 212, 0.35);
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.35);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --danger: #f43f5e;
    --danger-bg: rgba(244, 63, 94, 0.15);
    --warning: #f59e0b;
    --info: #3b82f6;

    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;

    --heading-color: #ffffff;
    --stat-value-color: #ffffff;
    --table-header-bg: #1e293b;
    --table-header-color: #9ca3af;
    --card-inner-bg: rgba(255, 255, 255, 0.03);
    --input-bg: rgba(15, 23, 42, 0.6);
    --input-border: rgba(255, 255, 255, 0.12);
    --input-text: #f3f4f6;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;

    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --nav-bg: rgba(9, 13, 22, 0.95);
}

/* Light Theme Variables */
body.light-theme {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-card-hover: #ffffff;
    --border-glass: rgba(203, 213, 225, 0.8);
    --border-glass-light: rgba(148, 163, 184, 0.8);
    
    --primary: #0284c7;
    --primary-glow: rgba(2, 132, 199, 0.2);
    --accent: #4f46e5;
    
    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.12);
    --danger: #e11d48;
    --danger-bg: rgba(225, 29, 72, 0.12);
    --warning: #d97706;
    --info: #2563eb;

    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #64748b;

    --heading-color: #0f172a;
    --stat-value-color: #0f172a;
    --table-header-bg: #e2e8f0;
    --table-header-color: #334155;
    --card-inner-bg: rgba(15, 23, 42, 0.04);
    --input-bg: #ffffff;
    --input-border: rgba(203, 213, 225, 1);
    --input-text: #0f172a;

    --shadow-glass: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --nav-bg: rgba(255, 255, 255, 0.95);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif !important;
    background-color: var(--bg-dark) !important;
    background-image: 
        radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
        radial-gradient(at 90% 90%, rgba(6, 182, 212, 0.08) 0px, transparent 50%) !important;
    background-attachment: fixed !important;
    color: var(--text-main) !important;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.financial-num {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

a {
    text-decoration: none !important;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-glass);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}

.glass-panel:hover {
    border-color: var(--border-glass-light);
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.5rem;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #fff !important;
    font-weight: 700;
    font-size: 1.15rem;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: var(--primary-glow);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: var(--text-muted) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.45rem 0.85rem !important;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-link:hover, .nav-link.active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.08);
}

/* Dual-Mode Global Search Bar */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 380px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 3px 4px 3px 4px;
    transition: all 0.25s ease;
}

.search-container:focus-within {
    background: rgba(255, 255, 255, 0.09);
    border-color: var(--primary);
    box-shadow: 0 0 14px var(--primary-glow);
}

.search-mode-toggle {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 20px;
    padding: 2px;
    flex-shrink: 0;
}

.search-mode-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.search-mode-btn:hover {
    color: #fff;
}

.search-mode-btn.active-stock {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35);
}

.search-mode-btn.active-holder {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(168, 85, 247, 0.35);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 0.65rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    padding: 0.35rem 0.6rem 0.35rem 1.9rem !important;
    color: #fff;
    font-size: 0.84rem;
    box-shadow: none !important;
}

.search-input::placeholder {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #141b2c;
    border: 1px solid var(--border-glass-light);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    max-height: 350px;
    overflow-y: auto;
    z-index: 1100;
    display: none;
}


.search-dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0.9rem;
    color: var(--text-main);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.search-dropdown-item:hover {
    background: rgba(6, 182, 212, 0.15);
}

/* Hero Header */
.ticker-hero {
    padding: 1.5rem 1.75rem;
    border-radius: var(--radius-md);
}

.ticker-symbol {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
}

.ticker-price {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

/* Stat Card */
.stat-card {
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Form Controls & Bootstrap Overrides */
.form-control, .form-select {
    background-color: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid var(--border-glass) !important;
    color: #fff !important;
    border-radius: var(--radius-sm) !important;
    padding: 0.55rem 0.85rem !important;
    font-size: 0.88rem !important;
}

.form-control:focus, .form-select:focus {
    background-color: rgba(255, 255, 255, 0.12) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 12px var(--primary-glow) !important;
}

.form-select option {
    background-color: #141b2c !important;
    color: #fff !important;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.88rem;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #0284c7) !important;
    color: #fff !important;
    box-shadow: 0 4px 15px var(--primary-glow);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--text-main) !important;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #be123c) !important;
    color: #fff !important;
}

/* Sticky Column Table for Mobile & Horizontal Scroll */
.table-sticky-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    border-radius: var(--radius-sm);
}

.table-sticky-col th:first-child,
.table-sticky-col td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: #111726 !important;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.5);
}

.table-sticky-col th:first-child {
    z-index: 12;
}

/* Sortable Table Headers */
.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.sortable-header:hover {
    color: var(--primary) !important;
}

.sortable-header i {
    font-size: 0.75rem;
    margin-left: 4px;
    opacity: 0.5;
}

.sortable-header.active-sort {
    color: var(--primary) !important;
}

.sortable-header.active-sort i {
    opacity: 1;
    color: var(--primary);
}

/* Pagination Controls */
.pagination-btn {
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pagination-btn:hover, .pagination-btn.active {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin: 0;
}

.data-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    white-space: nowrap;
}

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

/* Badges */
.badge {
    padding: 0.3rem 0.65rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-set {
    background: rgba(6, 182, 212, 0.15);
    color: var(--primary);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-mai {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: rgba(9, 13, 22, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-glass-light);
    z-index: 2000;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.6);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 500;
    width: 33%;
    height: 100%;
}

.mobile-nav-item i {
    font-size: 1.15rem;
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-item.active i {
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

/* Mobile Responsiveness Adjustments (iPhone 14 Pro Max & Mobile Screens) */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
    }
    
    .nav-links {
        display: none;
    }
    
    body {
        padding-bottom: 72px !important;
    }

    .navbar {
        padding: 0.6rem 0.9rem;
        flex-wrap: wrap;
    }

    .search-container {
        order: 3;
        width: 100%;
        margin-top: 0.35rem;
        display: flex;
        align-items: center;
    }

    .search-mode-btn {
        padding: 0.22rem 0.45rem;
        font-size: 0.74rem;
    }

    .search-input {
        width: 100% !important;
        font-size: 0.8rem !important;
    }


    .ticker-hero {
        padding: 1.1rem;
    }

    .stat-card {
        padding: 0.85rem 1rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }
}

@media (max-width: 576px) {
    .container-xl {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .page-title {
        font-size: 1.3rem;
    }

    .ticker-symbol, .ticker-price {
        font-size: 1.65rem;
    }
}

/* Log Console */
.log-console {
    background: #050811;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-family: monospace;
    font-size: 0.78rem;
    color: #10b981;
    height: 240px;
    overflow-y: auto;
}

/* Footer */
footer {
    padding: 1.2rem 1rem;
    text-align: center;
    border-top: 1px solid var(--border-glass);
    color: var(--text-dim);
    font-size: 0.78rem;
    margin-top: auto;
}

/* ========================================== */
/* TRADER-GRADE COMPACT TYPOGRAPHY & STYLING  */
/* ========================================== */
html, body {
    font-size: 13.5px !important;
}

.table-responsive table th,
.table-responsive table td,
.data-table th,
.data-table td,
.custom-table th,
.custom-table td {
    padding: 0.38rem 0.55rem !important;
    font-size: 0.82rem !important;
    vertical-align: middle !important;
}

.table-responsive table th,
.data-table th,
.custom-table th {
    font-size: 0.75rem !important;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 700 !important;
}

.btn-sm {
    padding: 0.25rem 0.6rem !important;
    font-size: 0.78rem !important;
}

.badge {
    font-size: 0.7rem !important;
    padding: 0.22em 0.55em !important;
}

.stat-card {
    padding: 0.85rem 1.1rem !important;
    min-height: 82px;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    transition: all 0.25s ease;
}

.stat-value {
    font-size: 1.25rem !important;
    font-weight: 700;
}

/* Hamburger Button */
.hamburger-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-glass);
    color: #fff;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hamburger-btn:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.05);
}

.user-status-badge {
    font-size: 0.78rem;
    font-weight: 600;
    color: #e5e7eb;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
}

/* Offcanvas Drawer Menu */
.custom-offcanvas {
    background: rgba(9, 13, 22, 0.96) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border-left: 1px solid var(--border-glass) !important;
    width: 310px !important;
}

.drawer-menu-list {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
}

.drawer-menu-category {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    padding: 0.85rem 0.85rem 0.35rem;
    letter-spacing: 0.6px;
}

.drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.65rem 0.85rem;
    color: #d1d5db !important;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.drawer-nav-item .icon {
    font-size: 1rem;
    width: 22px;
    text-align: center;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.65rem 0.85rem;
    color: var(--text-main) !important;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.drawer-nav-item .icon {
    font-size: 1rem;
    width: 22px;
    text-align: center;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.drawer-nav-item:hover,
.drawer-nav-item.active {
    background: rgba(6, 182, 212, 0.15) !important;
    color: var(--heading-color) !important;
    font-weight: 600;
    border-left-color: var(--primary) !important;
    padding-left: 1.15rem;
}

.drawer-nav-item:hover .icon,
.drawer-nav-item.active .icon {
    color: var(--primary);
}

/* Theme & Component Overrides for High Contrast & Visual Balance */
h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color);
}

.page-title {
    color: var(--heading-color) !important;
}

.page-subtitle {
    color: var(--text-muted) !important;
}

.stat-value {
    color: var(--stat-value-color) !important;
}

.data-table th {
    background-color: var(--table-header-bg) !important;
    color: var(--table-header-color) !important;
    border-bottom: 1px solid var(--border-glass) !important;
}

.data-table td {
    color: var(--text-main);
    border-bottom: 1px solid var(--border-glass) !important;
}

.form-control, .form-select {
    background-color: var(--input-bg) !important;
    border-color: var(--input-border) !important;
    color: var(--input-text) !important;
}

.form-control::placeholder {
    color: var(--text-dim) !important;
}

label, .form-label, .form-check-label {
    color: var(--text-main) !important;
}

.custom-offcanvas {
    background: var(--nav-bg) !important;
    color: var(--text-main) !important;
}

.drawer-nav-item {
    color: var(--text-main) !important;
}

.drawer-nav-item:hover, .drawer-nav-item.active {
    color: var(--primary) !important;
}

.search-dropdown {
    background: var(--nav-bg) !important;
    border: 1px solid var(--border-glass-light) !important;
    color: var(--text-main) !important;
}

.search-dropdown-item {
    color: var(--text-main) !important;
}

.search-dropdown-item:hover {
    background: var(--card-inner-bg) !important;
}

.modal-content {
    background: var(--bg-card) !important;
    color: var(--text-main) !important;
    border-color: var(--border-glass-light) !important;
}

.modal-header, .modal-footer {
    border-color: var(--border-glass) !important;
}

/* Light theme comprehensive text & component contrast rules */
body.light-theme,
body.light-theme h1, body.light-theme h2, body.light-theme h3, body.light-theme h4, body.light-theme h5, body.light-theme h6,
body.light-theme .page-title,
body.light-theme .page-subtitle,
body.light-theme .stat-value,
body.light-theme .stat-label,
body.light-theme label, body.light-theme .form-label, body.light-theme .form-check-label,
body.light-theme .data-table td, body.light-theme .data-table th,
body.light-theme .ticker-symbol,
body.light-theme .text-white {
    color: #0f172a !important;
}

body.light-theme [style*="color: #fff"],
body.light-theme [style*="color:#fff"],
body.light-theme [style*="color: white"],
body.light-theme [style*="color:white"],
body.light-theme [style*="color: var(--text-main)"],
body.light-theme [style*="color:var(--text-main)"] {
    color: #0f172a !important;
}

body.light-theme .navbar-brand {
    color: #0f172a !important;
}

body.light-theme .hamburger-btn {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .user-status-badge {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.05);
}

