/*
 * VedicAI Light Theme Override - Ensures consistent light backgrounds throughout
 * Apply this after all other stylesheets to enforce the light theme
 */

/* === GLOBAL OVERRIDES === */
body, 
html,
.main-content,
.app-container,
.page-wrapper {
    background: var(--brand-bg-primary) !important;
    color: var(--brand-text-primary) !important;
}

/* === CARD AND CONTAINER OVERRIDES === */
.card,
.insight-card,
.horoscope-card,
.dasha-card,
.transit-card,
.planetary-card,
.analysis-card,
.summary-card,
.notification-card,
.info-card,
.content-card {
    background: var(--brand-bg-card) !important;
    border: 1px solid var(--brand-border-light) !important;
    color: var(--brand-text-primary) !important;
    box-shadow: var(--brand-shadow-light) !important;
}

/* === HEADER AND NAVIGATION OVERRIDES === */
/* Keep header dark purple - do NOT override */
header,
.navbar,
nav.navbar {
    /* Use consistent purple throughout */
    background: var(--navbar-bg) !important;
    color: var(--navbar-text) !important;
    border-bottom: 1px solid var(--header-border) !important;
}

header h1,
header h2,
header h3,
header p,
header .text-white,
header .text-light,
header .navbar-brand,
.navbar-brand,
.navbar-nav .nav-link {
    color: var(--navbar-text) !important;
}

.navbar-nav .nav-link:hover {
    color: var(--navbar-text-hover) !important;
}

.navbar-nav .nav-link.active {
    color: var(--navbar-link-active) !important;
}

/* Specific Bootstrap classes in header */
header .text-white {
    color: var(--header-text-primary) !important;
}

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

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

header a {
    color: var(--header-text-primary) !important;
    text-decoration: none !important;
}

header a:hover {
    color: var(--header-text-hover) !important;
}

/* Navigation links in header stay white */
header .nav-link,
header .navbar-nav .nav-link {
    color: var(--header-text-primary) !important;
}

header .nav-link:hover,
header .navbar-nav .nav-link:hover {
    color: var(--header-text-hover) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Dropdown menus in header */
header .dropdown-menu,
header .dropdown-menu-dark {
    background: #2a1f3d !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

header .dropdown-item {
    color: white !important;
}

header .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #e0e7ff !important;
}

/* Other navigation elements (not in header) can be light */
.navbar:not(header .navbar),
.nav-container:not(header .nav-container) {
    background: var(--brand-bg-card) !important;
    border-bottom: 1px solid var(--brand-border-light) !important;
}

.nav-link:not(header .nav-link),
.navbar-nav .nav-link:not(header .navbar-nav .nav-link) {
    color: var(--brand-text-secondary) !important;
}

.nav-link:not(header .nav-link):hover,
.navbar-nav .nav-link:not(header .navbar-nav .nav-link):hover {
    color: var(--brand-text-primary) !important;
    background: var(--brand-bg-secondary) !important;
}

/* === BUTTON OVERRIDES === */
.btn-secondary,
.button-secondary {
    background: var(--brand-bg-card) !important;
    color: var(--brand-text-primary) !important;
    border: 1px solid var(--brand-border-medium) !important;
}

.btn-secondary:hover,
.button-secondary:hover {
    background: var(--brand-bg-secondary) !important;
    border-color: var(--current-glow) !important;
    color: var(--brand-text-primary) !important;
}

/* === FORM ELEMENT OVERRIDES === */
.form-control,
.form-select,
input,
textarea,
select {
    background: var(--brand-bg-card) !important;
    border: 1px solid var(--brand-border-medium) !important;
    color: var(--brand-text-primary) !important;
}

.form-control:focus,
.form-select:focus,
input:focus,
textarea:focus,
select:focus {
    background: var(--brand-bg-primary) !important;
    border-color: var(--current-glow) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
    color: var(--brand-text-primary) !important;
}

/* === MODAL OVERRIDES === */
.modal-content,
.modal-dialog,
.modal {
    background: var(--brand-bg-card) !important;
    color: var(--brand-text-primary) !important;
    border: 1px solid var(--brand-border-light) !important;
}

.modal-header {
    border-bottom: 1px solid var(--brand-divider) !important;
    background: var(--brand-bg-card) !important;
}

.modal-footer {
    border-top: 1px solid var(--brand-divider) !important;
    background: var(--brand-bg-secondary) !important;
}

/* === ALERT AND NOTIFICATION OVERRIDES === */
.alert,
.notification,
.message,
.banner {
    background: var(--brand-bg-card) !important;
    border: 1px solid var(--brand-border-light) !important;
    color: var(--brand-text-primary) !important;
}

.alert-info {
    background: var(--saturn-bg) !important;
    border-color: var(--saturn-border) !important;
    color: var(--brand-text-primary) !important;
}

.alert-warning {
    background: var(--venus-bg) !important;
    border-color: var(--venus-border) !important;
    color: var(--brand-text-primary) !important;
}

.alert-success {
    background: var(--current-bg) !important;
    border-color: var(--current-border) !important;
    color: var(--brand-text-primary) !important;
}

.alert-danger {
    background: var(--mars-bg) !important;
    border-color: var(--mars-border) !important;
    color: var(--brand-text-primary) !important;
}

/* === BADGE OVERRIDES === */
/* Fix yellow-purple and other illegible badge combinations */
.badge,
.badge-primary {
    background: var(--badge-primary-bg) !important;
    color: var(--badge-primary-color) !important;
    border: 1px solid var(--badge-primary-border) !important;
}

.badge-secondary {
    background: var(--badge-secondary-bg) !important;
    color: var(--badge-secondary-color) !important;
    border: 1px solid var(--badge-secondary-border) !important;
}

.badge-success {
    background: var(--badge-success-bg) !important;
    color: var(--badge-success-color) !important;
    border: 1px solid var(--badge-success-border) !important;
}

/* Fix specific problematic badges */
.vedic-badge,
.ai-badge,
.premium-badge {
    background: var(--badge-primary-bg) !important;
    color: var(--badge-primary-color) !important;
    border: 1px solid var(--badge-primary-border) !important;
}

/* Planet-specific badges use appropriate colors */
.mars-badge {
    background: var(--mars-bg) !important;
    color: var(--mars-color) !important;
    border: 1px solid var(--mars-border) !important;
}

.saturn-badge {
    background: var(--saturn-bg) !important;
    color: var(--saturn-color) !important;
    border: 1px solid var(--saturn-border) !important;
}

.jupiter-badge {
    background: var(--jupiter-bg) !important;
    color: var(--jupiter-color) !important;
    border: 1px solid var(--jupiter-border) !important;
}

/* === TABLE OVERRIDES === */
.table,
table {
    background: var(--brand-bg-card) !important;
    color: var(--brand-text-primary) !important;
}

.table th,
.table td,
table th,
table td {
    border-color: var(--brand-border-light) !important;
    background: var(--brand-bg-card) !important;
    color: var(--brand-text-primary) !important;
}

.table-striped tbody tr:nth-of-type(odd) td {
    background: var(--brand-bg-secondary) !important;
}

/* === DROPDOWN OVERRIDES === */
.dropdown-menu {
    background: var(--brand-bg-card) !important;
    border: 1px solid var(--brand-border-light) !important;
    box-shadow: var(--brand-shadow-medium) !important;
}

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

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--brand-bg-secondary) !important;
    color: var(--brand-text-primary) !important;
}

/* === BADGE OVERRIDES === */
.badge {
    background: var(--brand-bg-secondary) !important;
    color: var(--brand-text-primary) !important;
    border: 1px solid var(--brand-border-light) !important;
}

.badge-primary {
    background: var(--jupiter-bg) !important;
    color: var(--brand-text-primary) !important;
    border-color: var(--jupiter-border) !important;
}

.badge-secondary {
    background: var(--saturn-bg) !important;
    color: var(--brand-text-primary) !important;
    border-color: var(--saturn-border) !important;
}

/* === PROGRESS BAR OVERRIDES === */
.progress {
    background: var(--brand-border-light) !important;
}

.progress-bar {
    background: linear-gradient(90deg, var(--current-glow), var(--mercury-color)) !important;
}

/* === LIST GROUP OVERRIDES === */
.list-group {
    background: var(--brand-bg-card) !important;
}

.list-group-item {
    background: var(--brand-bg-card) !important;
    border-color: var(--brand-border-light) !important;
    color: var(--brand-text-primary) !important;
}

.list-group-item:hover {
    background: var(--brand-bg-secondary) !important;
}

.list-group-item.active {
    background: var(--current-bg) !important;
    border-color: var(--current-border) !important;
    color: var(--brand-text-primary) !important;
}

/* === ACCORDION OVERRIDES === */
.accordion {
    background: var(--brand-bg-card) !important;
}

.accordion-item {
    background: var(--brand-bg-card) !important;
    border-color: var(--brand-border-light) !important;
}

.accordion-header button {
    background: var(--brand-bg-card) !important;
    color: var(--brand-text-primary) !important;
}

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

/* === CAROUSEL OVERRIDES === */
.carousel {
    background: var(--brand-bg-card) !important;
}

.carousel-item {
    background: var(--brand-bg-card) !important;
    color: var(--brand-text-primary) !important;
}

/* === OFFCANVAS OVERRIDES === */
.offcanvas {
    background: var(--brand-bg-card) !important;
    color: var(--brand-text-primary) !important;
}

.offcanvas-header {
    border-bottom: 1px solid var(--brand-divider) !important;
}

/* === TABS OVERRIDES === */
.nav-tabs {
    border-bottom-color: var(--brand-border-light) !important;
}

.nav-tabs .nav-link {
    color: var(--brand-text-secondary) !important;
    background: var(--brand-bg-secondary) !important;
    border-color: var(--brand-border-light) !important;
}

.nav-tabs .nav-link.active {
    background: var(--brand-bg-card) !important;
    color: var(--brand-text-primary) !important;
    border-color: var(--brand-border-light) var(--brand-border-light) var(--brand-bg-card) !important;
}

.tab-content {
    background: var(--brand-bg-card) !important;
    color: var(--brand-text-primary) !important;
}

/* === TOOLTIP OVERRIDES === */
.tooltip {
    background: var(--brand-bg-card) !important;
    color: var(--brand-text-primary) !important;
    border: 1px solid var(--brand-border-medium) !important;
    box-shadow: var(--brand-shadow-medium) !important;
}

/* === POPOVER OVERRIDES === */
.popover {
    background: var(--brand-bg-card) !important;
    border-color: var(--brand-border-light) !important;
    color: var(--brand-text-primary) !important;
}

.popover-header {
    background: var(--brand-bg-secondary) !important;
    border-bottom-color: var(--brand-divider) !important;
    color: var(--brand-text-primary) !important;
}

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

/* === LOADING AND SPINNER OVERRIDES === */
.spinner-border,
.spinner-grow {
    color: var(--current-glow) !important;
}

.loading-overlay {
    background: rgba(255, 255, 255, 0.9) !important;
}

/* === SPECIFIC APPLICATION OVERRIDES === */

/* Daily Horoscope specific overrides */
.daily-horoscope-container {
    background: linear-gradient(135deg, var(--brand-bg-primary) 0%, var(--brand-bg-secondary) 100%) !important;
    color: var(--brand-text-primary) !important;
}

.daily-essence-hero,
.insight-card-container,
.actionable-guidance-container,
.discovery-container {
    background: var(--brand-bg-card) !important;
    color: var(--brand-text-primary) !important;
    border: 1px solid var(--brand-border-light) !important;
}

/* Chart specific overrides */
.chart-container,
.dasha-container,
.transit-container {
    background: var(--brand-bg-card) !important;
    color: var(--brand-text-primary) !important;
}

/* Remove any dark overlays or backgrounds */
.dark-overlay,
.dark-bg,
.black-bg {
    background: var(--brand-bg-primary) !important;
    color: var(--brand-text-primary) !important;
}

/* Ensure text visibility */
.text-white {
    color: var(--brand-text-primary) !important;
}

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

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

/* === ANIMATION OVERRIDES === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease !important;
}

/* === UTILITY CLASS OVERRIDES === */
.bg-light {
    background: var(--brand-bg-secondary) !important;
}

.bg-white {
    background: var(--brand-bg-card) !important;
}

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

.border {
    border-color: var(--brand-border-light) !important;
}

.border-light {
    border-color: var(--brand-border-light) !important;
}

.border-dark {
    border-color: var(--brand-border-medium) !important;
}

/* === FINAL CATCH-ALL === */
* {
    /* Ensure no elements have dark backgrounds unless specifically intended */
}

*:not(.btn-primary):not(.bg-primary):not(.bg-success):not(.bg-warning):not(.bg-danger):not(.bg-info) {
    /* Apply light theme to most elements */
}

/* Ensure proper contrast ratios are maintained */
@media (prefers-contrast: high) {
    :root {
        --brand-text-primary: #1a1a1a;
        --brand-text-secondary: #333333;
        --brand-border-medium: #999999;
    }
}

/* === COMPACT LAYOUT OVERRIDES === */
/* Ensure compact insights use light theme */
.insights-grid.compact .insight-card.compact {
    background: var(--brand-bg-card) !important;
    border: 1px solid var(--brand-border-light) !important;
    color: var(--brand-text-primary) !important;
}

.insights-grid.compact .insight-card.compact .insight-text {
    color: var(--brand-text-primary) !important;
}

.insights-grid.compact .insight-card.compact .tag {
    background: var(--brand-bg-secondary) !important;
    color: var(--brand-text-secondary) !important;
    border: 1px solid var(--brand-border-light) !important;
}

/* Energy analysis compact layout */
.energy-breakdown.compact {
    background: var(--brand-bg-card) !important;
    border: 1px solid var(--brand-border-light) !important;
    color: var(--brand-text-primary) !important;
}

.energy-stats.inline .stat-item {
    background: var(--brand-bg-secondary) !important;
    border: 1px solid var(--brand-border-light) !important;
    color: var(--brand-text-primary) !important;
}

.energy-stats.inline .stat-label {
    color: var(--brand-text-secondary) !important;
}

/* Modal overrides for insights */
.modal-insights .insight-card.modal-card {
    background: var(--brand-bg-card) !important;
    border: 1px solid var(--brand-border-light) !important;
    color: var(--brand-text-primary) !important;
}

.modal-insights .insight-number {
    background: var(--badge-primary-bg) !important;
    color: var(--badge-primary-color) !important;
}

/* View more button */
.view-more-insights-btn {
    background: var(--badge-primary-bg) !important;
    color: var(--badge-primary-color) !important;
    border: 1px solid var(--badge-primary-border) !important;
}
