/* Brand Identity */
:root {
    --brand-primary: #042630;    /* Legacy: --color-primary */
    --brand-secondary: #1a3d47;  /* Legacy: --color-secondary */
    --brand-accent: #3a656a;     /* Legacy: --color-accent */
    --brand-highlight: #86b9b0;  /* Legacy: --color-highlight */
    --brand-bg: #e5ebeb;         /* Legacy: --color-light (body bg) */
    --brand-light: #e5ebeb;      /* Legacy: --color-light */
    --card-bg: #ffffff;
    --text-main: #212529;
    --text-muted: #6c757d;
    --border-color: rgba(0,0,0,0.175);
}

[data-bs-theme="dark"] {
    --brand-primary: #0d1b21;    /* Darker Teal */
    --brand-secondary: #1a3d47;  /* Keep same or slightly adjusted */
    --brand-accent: #4a7d82;     /* Lighter accent for dark mode */
    --brand-highlight: #5f8f8f;  /* Muted highlight */
    /* --brand-bg: #121212; REMOVED to allow inline override */
    --brand-light: #2c3035;      /* Dark card bg */
    --card-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: rgba(255,255,255,0.1);
}

body {
    background: var(--brand-bg);
    min-height: 100vh;
    color: var(--text-main);
}

/* Bootstrap Overrides */
.bg-primary {
    background-color: var(--brand-primary) !important;
}

.text-primary {
    color: var(--brand-primary) !important;
}

[data-bs-theme="dark"] .text-primary {
    color: #86b9b0 !important; /* Lighter teal for readability in dark mode */
}

/* Button Consistency */
.btn {
    font-weight: 600;
    border-radius: 0.375rem; /* Matches toggle-pill-container */
    padding: 0.375rem 1rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--brand-secondary);
    border-color: var(--brand-secondary);
    color: #fff;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--brand-accent) !important;
    border-color: var(--brand-accent) !important;
    color: #fff !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.btn-outline-primary {
    color: var(--brand-secondary);
    border-color: var(--brand-secondary);
}

[data-bs-theme="dark"] .btn-outline-primary {
    color: #86b9b0;
    border-color: #86b9b0;
}

.btn-outline-primary:hover {
    background-color: var(--brand-secondary);
    border-color: var(--brand-secondary);
    color: #fff;
}

[data-bs-theme="dark"] .btn-outline-primary:hover {
    background-color: #86b9b0;
    border-color: #86b9b0;
    color: #121212;
}

.btn-link {
    color: var(--brand-secondary);
    text-decoration: none;
}

[data-bs-theme="dark"] .btn-link {
    color: #86b9b0;
}

.btn-link:hover {
    color: var(--brand-accent);
    text-decoration: underline;
}

[data-bs-theme="dark"] .btn-link:hover {
    color: #a8d5ce;
}

/* Legacy Card Style */
.card-legacy {
    border: 1px solid var(--brand-highlight) !important;
    border-radius: 1rem !important; /* 16px */
    box-shadow: 0 3px 10px rgba(0,0,0,0.24) !important;
    overflow: hidden;
    background-color: var(--card-bg);
}

[data-bs-theme="dark"] .card-legacy {
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.5) !important;
}

[data-bs-theme="dark"] .portfolio-total-section {
    background: linear-gradient(135deg, #2c3035 0%, #1e1e1e 100%);
    border-color: var(--border-color);
}

[data-bs-theme="dark"] .portfolio-stat-card {
    background-color: #2c3035;
    border-color: var(--border-color);
}

[data-bs-theme="dark"] .portfolio-stat-title,
[data-bs-theme="dark"] .dashboard-stat-label {
    color: #a0a0a0;
}

[data-bs-theme="dark"] .portfolio-total-value,
[data-bs-theme="dark"] .portfolio-stat-value,
[data-bs-theme="dark"] .dashboard-stat-value {
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: #2c3035 !important;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .text-muted {
    color: #a0a0a0 !important;
}

.card-legacy .card-header {
    background-color: var(--brand-primary) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    text-align: center;
    padding: 0.75rem 1rem;
    position: relative;
}

.card-legacy .card-title {
    color: inherit !important;
    margin-bottom: 0;
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 2px;
}

/* Component Utilities */
.last-no-border:last-child {
    border-right: 0 !important;
}

[data-bs-theme="dark"] .text-gray-800 {
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .bg-white {
    background-color: #1e1e1e !important;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .table {
    color: #e0e0e0;
    border-color: var(--border-color);
}

[data-bs-theme="dark"] .list-group-item {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-main);
}


/* Typography Consistency */
.dashboard-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: var(--brand-secondary);
}

.dashboard-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-primary);
    line-height: 1.2;
}

.dashboard-stat-subtext {
    font-size: 0.7rem;
    color: #adb5bd;
}

.dashboard-stat-icon {
    font-size: 1.25rem;
    color: var(--brand-secondary);
    opacity: 0.8;
}

.dashboard-detail-text {
    font-size: 0.75rem;
    color: #212529;
}

/* Accordion Tweaks */
.accordion-button::after {
    display: none;
}

/* Placeholders */
.dashed-placeholder {
    background-color: #f8f9fa;
    border: 1px dashed #dee2e6 !important;
    border-radius: 1rem !important;
}

/* Letter Spacing Utility */
.letter-spacing-1 {
    letter-spacing: 1px;
}

/* Portfolio Overview Styles */
.portfolio-total-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    text-align: center;
}

.portfolio-total-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin: 0;
}

.portfolio-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.portfolio-stat-card {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.portfolio-stat-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.25rem;
}

.portfolio-stat-icon {
    font-size: 1.25rem;
    color: var(--brand-secondary);
    margin-bottom: 0.25rem;
    opacity: 0.8;
}

.portfolio-stat-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: var(--brand-secondary);
}

.portfolio-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-primary);
    line-height: 1.2;
}

/* Custom Toggle Switch Color */
.form-check-input:checked {
    background-color: var(--brand-secondary) !important;
    border-color: var(--brand-secondary) !important;
}

/* Table/List Utilities */
.table-row-sm {
    height: 35px;
}

.w-40px {
    width: 40px;
}

.w-250px {
    width: 250px;
}

.icon-sm {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.cursor-pointer {
    cursor: pointer;
}

/* Timeline Analysis */
.timeline-year-row {
    height: 45px;
    font-weight: 700;
    background-color: #f8f9fa;
    cursor: pointer;
}

.timeline-month-row {
    height: 40px;
    background-color: #eef2f3; /* bg-drilldown-level-1 */
    cursor: pointer;
}

.timeline-platform-row {
    height: 35px;
    background-color: #ffffff; /* bg-drilldown-level-2 */
}

/* Text Colors */
.text-brand-primary {
    color: var(--brand-primary) !important;
}

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

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

.text-brand-danger {
    color: #dc3545 !important;
}

.text-xs {
    font-size: 0.75rem !important;
}

/* Backgrounds */
.bg-brand-primary {
    background-color: var(--brand-primary) !important;
}

.bg-brand-secondary {
    background-color: var(--brand-secondary) !important;
}

.bg-brand-accent {
    background-color: var(--brand-accent) !important;
}

.bg-brand-highlight {
    background-color: var(--brand-highlight) !important;
}

.bg-brand-secondary-light {
    background-color: #f8f9fa;
}

.bg-drilldown-level-1 {
    background-color: #eef2f3;
}

.bg-drilldown-level-2 {
    background-color: #ffffff;
}

/* Transitions */
.transition-transform {
    transition: transform 0.2s ease;
}

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

/* Progress Bars */
.progress-xs {
    height: 6px;
    border-radius: 3px;
    background-color: #e9ecef;
}

.progress-xxs {
    height: 4px;
    border-radius: 2px;
    background-color: #e9ecef;
}

.portfolio-stat-secondary {
    font-size: 0.7rem;
    color: #adb5bd;
}

/* Custom Toggle Switch */
.toggle-pill-container {
    background-color: #f1f3f5;
    border-radius: 0.375rem; /* 6px */
    padding: 0.2rem;
    display: inline-flex;
    margin-bottom: 0.5rem;
}

.toggle-pill-item {
    padding: 0.15rem 0.6rem;
    border-radius: 0.25rem; /* 4px */
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
}

.toggle-pill-item.active {
    background-color: var(--brand-secondary);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-pill-item:hover:not(.active) {
    color: var(--brand-primary);
    background-color: rgba(0,0,0,0.05);
}

/* Legacy Modal Styling */
.modal-legacy .modal-content {
    border: none;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.modal-legacy .modal-header {
    background-color: var(--brand-secondary);
    color: white;
    border-bottom: 2px solid var(--brand-accent);
    padding: 0.75rem 1.25rem;
}

.modal-legacy .modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.modal-legacy .btn-close {
    opacity: 0.8;
}

.modal-legacy .modal-body {
    font-size: 0.85rem; /* Smaller text as requested */
    background-color: #f8f9fa;
}

.modal-legacy .list-group-item {
    padding: 0.75rem 1rem;
    border-color: #e9ecef;
    background-color: white;
    margin-bottom: 2px;
    border-radius: 4px !important;
    border: 1px solid #e9ecef !important;
}

.modal-legacy .badge {
    font-weight: 500;
}

/* Table Utilities for Reports */
.table-header-brand {
    background-color: var(--brand-secondary) !important;
    color: white !important;
}

.timeline-icon {
    font-size: 0.8rem;
    color: #6c757d;
}

.timeline-platform-icon {
    width: 16px; 
    height: 16px;
}

.timeline-percent-label {
    min-width: 45px; 
    text-align: right;
}

/* Pagination Override (Matches Toggle Style) */
.pagination {
    --bs-pagination-active-bg: var(--brand-secondary);
    --bs-pagination-active-border-color: var(--brand-secondary);
    --bs-pagination-color: #6c757d;
    --bs-pagination-hover-color: var(--brand-primary);
    --bs-pagination-focus-color: var(--brand-primary);
    --bs-pagination-focus-bg: rgba(0,0,0,0.05);
    --bs-pagination-focus-box-shadow: none;
    justify-content: center;
    margin-bottom: 0;
}

.page-link {
    border: 1px solid #dee2e6;
    margin: 0 2px;
    border-radius: 0.25rem !important; /* Match toggle-pill-item radius */
    color: #6c757d;
}

.page-item.active .page-link {
    background-color: var(--brand-secondary) !important;
    border-color: var(--brand-secondary) !important;
    color: white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.page-link:hover {
    color: var(--brand-primary);
    background-color: rgba(0,0,0,0.05);
    border-color: #dee2e6;
}

.page-link:focus {
    box-shadow: none;
    color: var(--brand-primary);
    background-color: rgba(0,0,0,0.05);
}

.page-item.disabled .page-link {
    color: #adb5bd;
    background-color: #fff;
    border-color: #dee2e6;
}

.bg-expanded-year {
    background-color: #dbe4e6 !important;
}

.bg-expanded-month {
    background-color: #dbe4e6 !important;
}

.fs-085 {
    font-size: 0.85rem;
}

.fs-08 {
    font-size: 0.8rem;
}

.text-color-444 {
    color: #444;
}

/* --- New Navbar Styles (Round 5 Implementation) --- */

/* Chart Utilities */
.chart-container {
    position: relative;
    height: 350px;
    min-height: 350px;
    width: 100%;
}

/* Navbar Container */
.navbar-custom {

    background-color: var(--brand-primary) !important; /* #042630 */
    padding: 0.5rem 1rem; /* Standard Bootstrap padding to preserve height */
}

/* Nav Links - Pill Style & Typography */
.nav-link-pill {
    border-radius: 50px;
    padding: 8px 20px !important;
    margin: 0 2px;
    transition: all 0.2s ease;
    color: rgba(255,255,255,0.9) !important;
    text-decoration: none;
    display: inline-block;
    
    /* Typography: Light & Wide */
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 2px;
}

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

/* Submenu Style (Deep Brand Primary - dm-3) */
.dropdown-menu-dark-teal {
    background-color: var(--brand-primary);
    border: 1px solid var(--brand-secondary);
    padding: 0;
    min-width: 250px;
    margin-top: 10px; /* Offset */
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-menu-dark-teal .dropdown-header {
    color: var(--brand-highlight); 
    font-weight: 700; 
    text-transform: uppercase; 
    font-size: 0.7rem; 
    letter-spacing: 1px; 
    padding: 0.75rem 1.25rem 0.25rem; 
}

.dropdown-menu-dark-teal .dropdown-item {
    color: rgba(255, 255, 255, 0.8); 
    text-transform: uppercase; 
    font-size: 0.8rem; 
    padding: 0.6rem 1.25rem; 
    letter-spacing: 0.5px; 
    transition: all 0.2s; 
}

.dropdown-menu-dark-teal .dropdown-item:hover {
    background-color: var(--brand-secondary); 
    color: #fff; 
    padding-left: 1.5rem; /* Slide effect */
}

.dropdown-menu-dark-teal .dropdown-divider {
    border-top: 1px solid var(--brand-secondary); 
    margin: 0.25rem 0; 
    opacity: 0.5; 
}

/* Dark Toggle Container (for Navbar) */
.toggle-pill-dark {
    background-color: rgba(255,255,255,0.1);
    border-radius: 50px;
    padding: 4px;
    display: inline-flex;
}

.toggle-pill-item-dark {
    padding: 4px 12px;
    border-radius: 50px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    background: transparent;
}

.toggle-pill-item-dark:hover {
    color: white;
}

.toggle-pill-item-dark.active {
    background-color: white;
    color: var(--brand-primary);
}

/* Production/Demo Button (Outline White) */
.btn-production-outline {
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 4px;
    background: transparent;
    transition: all 0.2s;
}

.btn-production-outline:hover {
    border-color: white;
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.btn-demo-warning {
    background-color: #ffc107;
    color: #000;
    border: 1px solid #ffc107;
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
}
