/* CapitalOS Design System (Dark Matter) */

:root {
  /* Slate Palette (Dark Mode Base) */
  --tv-bg-primary: #0f172a;    /* Slate 900 */
  --tv-bg-secondary: #1e293b;  /* Slate 800 */
  --tv-bg-tertiary: #334155;   /* Slate 700 */

  /* Text Colors */
  --tv-text-primary: #f8fafc;  /* Slate 50 */
  --tv-text-secondary: #94a3b8; /* Slate 400 */
  --tv-text-muted: #64748b;    /* Slate 500 */

  /* Accents */
  --tv-accent: #3b82f6;        /* Blue 500 */
  --tv-accent-hover: #2563eb;  /* Blue 600 */
  
  /* Trading Colors */
  --tv-bull: #10b981;          /* Emerald 500 */
  --tv-bear: #ef4444;          /* Red 500 */
  --tv-bull-bg: rgba(16, 185, 129, 0.15);
  --tv-bear-bg: rgba(239, 68, 68, 0.15);
  --tv-warning: #f59e0b;       /* Amber 500 */

  /* Glassmorphism */
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);

  /* Spacing & Radii */
  --tv-radius: 8px;
  --tv-gap: 1rem;
}

/* Global Reset */
body {
  background-color: var(--tv-bg-primary) !important;
  color: var(--tv-text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--tv-text-primary);
}

.font-mono { font-family: 'JetBrains Mono', monospace; }

/* Glass Panel Utility */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--glass-shadow);
  position: relative; /* For loader positioning */
}

.card-loader {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: opacity 0.3s ease;
}
.card-loader.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Scrollbar Styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--tv-bg-primary); }
::-webkit-scrollbar-thumb { background: var(--tv-bg-tertiary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--tv-text-muted); }

/* Standard Card (TV Pane) */
.tv-pane {
  background: var(--tv-bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--tv-radius);
  overflow: hidden;
}
.tv-pane-header {
  padding: 1rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex; justify-content: space-between; align-items: center;
}
.tv-pane-title {
  font-size: 0.9rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--tv-text-secondary);
  margin: 0;
}
.tv-pane-body { padding: 1rem; }

/* Trading Utilities */
.text-bull { color: var(--tv-bull) !important; -webkit-text-fill-color: var(--tv-bull) !important; background: none !important; }
.text-bear { color: var(--tv-bear) !important; -webkit-text-fill-color: var(--tv-bear) !important; background: none !important; }
.text-warning { color: var(--tv-warning) !important; -webkit-text-fill-color: var(--tv-warning) !important; background: none !important; }
.text-info { color: #0dcaf0 !important; -webkit-text-fill-color: #0dcaf0 !important; background: none !important; }
.text-primary { color: var(--tv-accent) !important; -webkit-text-fill-color: var(--tv-accent) !important; background: none !important; }
.text-white { color: #fff !important; -webkit-text-fill-color: #fff !important; background: none !important; }
.bg-bull { background-color: var(--tv-bull) !important; }
.bg-bear { background-color: var(--tv-bear) !important; }

/* New Utility Classes for Dashboards */
.bg-tv-bull-bg { background-color: var(--tv-bull-bg) !important; }
.bg-tv-bear-bg { background-color: var(--tv-bear-bg) !important; }
.border-bull { border-color: var(--tv-bull) !important; }
.border-bear { border-color: var(--tv-bear) !important; }
.text-bear-muted { color: var(--tv-bear) !important; opacity: 0.6; -webkit-text-fill-color: var(--tv-bear) !important; background: none !important; }

/* Buttons */
.btn-tv {
  background: var(--tv-accent);
  color: white;
  border: none;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s;
}
.btn-tv:hover { background: var(--tv-accent-hover); color: white; transform: translateY(-1px); }

.btn-tv-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--tv-text-secondary);
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s;
}
.btn-tv-outline:hover {
  border-color: var(--tv-text-secondary);
  color: var(--tv-text-primary);
  background: rgba(255,255,255,0.02);
}
.btn-tv-outline.active {
  background: var(--tv-accent) !important;
  border-color: var(--tv-accent) !important;
  color: white !important;
}
.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  line-height: 1;
  border-radius: 4px;
}

/* DataTables Global Dark Override */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
    color: var(--tv-text-secondary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--tv-text-secondary) !important; 
}
.dataTables_wrapper .dataTables_filter input {
    background-color: var(--tv-bg-secondary);
    border: 1px solid var(--glass-border);
    color: var(--tv-text-primary);
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
}
/* Pro Table Styles */
.table-pro {
    --bs-table-bg: transparent;
    --bs-table-color: var(--tv-text-secondary);
    border-collapse: separate;
    border-spacing: 0 0.5rem; /* Row spacing */
    margin-top: -0.5rem;
}
.table-pro thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tv-text-muted);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem;
    font-weight: 600;
}
.table-pro tbody tr {
    background: rgba(255, 255, 255, 0.02) !important;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.table-pro tbody tr:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.table-pro td {
    border: none;
    vertical-align: middle;
    padding: 1rem;
    color: var(--tv-text-primary);
    font-size: 0.9rem;
    font-weight: 500;
}
.table-pro td:first-child { border-radius: 8px 0 0 8px; }
.table-pro td:last-child { border-radius: 0 8px 8px 0; }

/* Pro Search Input */
.input-group-pro {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 2px;
    transition: all 0.2s;
    width: 250px;
}
.input-group-pro:focus-within {
    border-color: var(--tv-accent);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.input-group-pro .input-group-text {
    background: transparent;
    border: none;
    color: var(--tv-text-muted);
}
.input-group-pro .form-control {
    background: transparent;
    border: none;
    color: var(--tv-text-primary);
    box-shadow: none;
    font-size: 0.85rem;
    padding-left: 0;
}
.input-group-pro .form-control::placeholder { color: var(--tv-text-muted); opacity: 0.7; }

/* Pro Pagination */
/* Pro Pagination (Bootstrap 5 Override) */
.dataTables_wrapper .pagination {
    margin-bottom: 0;
    gap: 0.25rem;
}
.dataTables_wrapper .page-item .page-link {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--tv-text-secondary);
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: none;
}
.dataTables_wrapper .page-item:first-child .page-link,
.dataTables_wrapper .page-item:last-child .page-link {
    border-radius: 6px; /* Override Bootstrap rounded corners spread */
}
.dataTables_wrapper .page-item.disabled .page-link {
    background: transparent;
    color: rgba(255,255,255,0.2);
    border-color: transparent;
}
.dataTables_wrapper .page-item .page-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--tv-text-primary);
    border-color: var(--tv-text-secondary);
}
.dataTables_wrapper .page-item.active .page-link {
    background: var(--tv-accent);
    border-color: var(--tv-accent);
    color: white;
    font-weight: 600;
}
.dataTables_wrapper .page-item.active .page-link:hover {
    background: var(--tv-accent); /* Keep accent on hover for active */
    color: white;
}

/* Hide Default Search/Length */
.dataTables_filter, .dataTables_length { display: none; }
.dataTables_info { font-size: 0.75rem; color: var(--tv-text-muted) !important; padding-top: 0; } /* Remove padding for flex align */

/* Sticky Footer Logic */
.dataTables_wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
}
.dt-sticky-footer {
    margin-top: auto;
    background: rgba(30, 41, 59, 0.4); /* Slight tint for footer area */
    backdrop-filter: blur(5px);
    border-bottom-left-radius: 12px; /* Match Card Radius */
    border-bottom-right-radius: 12px;
}

/* Alerts */
/* --- DASHBOARD SPECIFIC (Migrated from hub.html) --- */

.hub-container {
    padding: 1rem 0rem;
    max-width: 98vw; /* Maximize width */
    margin: 0 auto;
}

/* Hero Section */
.hero-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 1200px) {
    .hero-grid { grid-template-columns: 1fr; }
}

.hero-title-card {
    display: flex; flex-direction: column; justify-content: center;
    padding: 2rem; position: relative; overflow: hidden;
}
.hero-title-card::after {
    content: ""; position: absolute; top: 0; right: 0; width: 300px; height: 100%;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.kpi-card {
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 2rem; text-align: center; transition: transform 0.2s;
}
.kpi-value {
    font-size: 3rem; font-weight: 800; line-height: 1;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}
.kpi-label {
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--tv-text-secondary); font-weight: 600;
}

.utc-clock-display {
    font-family: 'JetBrains Mono', monospace; font-size: 2rem; font-weight: 700;
    color: var(--tv-accent); text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

/* Strategy Matrix */
.matrix-grid-container {
    display: grid;
    grid-template-columns: 140px repeat(var(--tf-count, 5), minmax(80px, 1fr));
    gap: 0.5rem; overflow-x: auto; padding-bottom: 0.5rem;
}
.matrix-row-label {
    display: flex; align-items: center; justify-content: center; padding: 0.5rem;
    font-weight: 700; color: var(--tv-text-primary);
    background: rgba(255,255,255,0.02); border-radius: 6px;
    position: sticky; left: 0;
}
.matrix-cell {
    background: rgba(30, 41, 59, 0.4);
    border-radius: 6px; padding: 0.75rem;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-decoration: none; min-height: 80px; min-width: 80px;
    border: 1px solid transparent; transition: all 0.2s;
}
.matrix-cell:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}
.matrix-cell.empty { opacity: 0.2; }
.cell-profit { font-weight: 700; font-size: 0.95rem; }
.cell-sub { font-size: 0.7rem; color: var(--tv-text-secondary); }


@media (min-width: 1400px) {
    .container, .container-lg, .container-md, .container-sm, .container-xl, .container-xxl {
        max-width: 1624px;
    }
}

/* Session Timeline Mini (Header Version) */
.timeline-mini-container {
    position: relative;
    height: 48px;
    width: 320px; /* Enhanced width */
    /* background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border); */
    border-radius: 8px;
    margin: 0 1.5rem;
    overflow: hidden;
    flex-shrink: 0;
}

.timeline-mini-grid {
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
}

.mini-grid-line {
    width: 1px;
    height: 100%;
    background: rgba(255, 255, 255, 0.03);
    position: relative;
}

.mini-grid-label {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.55rem;
    color: var(--tv-text-muted);
    font-family: 'JetBrains Mono', monospace;
    opacity: 0.5;
}

/* Session Bars Mini */
.session-bar-track-mini {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    margin: 0 4px;
}

.session-bar-mini {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 4px;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.session-bar-mini.active {
    opacity: 1;
    box-shadow: 0 0 8px currentColor;
    height: 8px;
    top: -1px;
    z-index: 2;
}

/* Specific Colors for Global Mode */
.bar-mini-sydney { background: #ef4444; color: rgba(239, 68, 68, 0.5); }
.bar-mini-tokyo  { background: #10b981; color: rgba(16, 185, 129, 0.5); }
.bar-mini-london { background: #f59e0b; color: rgba(245, 158, 11, 0.5); }
.bar-mini-ny     { background: #3b82f6; color: rgba(59, 130, 246, 0.5); }

/* Timeline Current Time Marker */
.time-marker-mini {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--tv-accent);
    z-index: 10;
    box-shadow: 0 0 4px rgba(59, 130, 246, 0.5);
    pointer-events: none;
}

.session-remaining-badge {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--tv-text-secondary);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    background: rgba(0,0,0,0.5);
    padding: 0 4px;
    border-radius: 4px;
    z-index: 20;
}
.timeline-mini-container:hover .session-remaining-badge {
    opacity: 1;
}

/* Date Picker Styling - White Icons */
.date-picker-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    opacity: 0.8;
}

.date-picker-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Increase Submit Arrow Size */
.btn-icon .bi-arrow-right-circle-fill {
    font-size: 1.5rem !important;
}
