@font-face {
    font-family: 'HamburgSymbols';
    src: url('/static/fonts/HamburgSymbols.ttf') format('truetype');
}

@font-face {
    font-family: 'Astronomicon';
    src: url('/static/fonts/Astronomicon.ttf') format('truetype');
}

.astro-angle {
    font-family: 'HamburgSymbols', sans-serif;
    line-height: 1;
}

* {
    box-sizing: border-box;
    -webkit-user-select: none;
    /* Safari */
    -ms-user-select: none;
    /* IE 10 and IE 11 */
    user-select: none;
    /* Standard syntax */
}

/* Allow selection in inputs and textareas */
input,
textarea {
    -webkit-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

:root {
    --bg-color: #f0f0f0;
    --panel-bg: #ffffff;
    --chart-bg: #ffffff;
    --chart-svg-bg: white;
    --border-color: #b0b0b0;
    --primary-color: #0078d4;
    --primary-hover: #0063b1;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.menu-bar {
    background-color: #f0f0f0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    padding: 2px 5px;
    font-size: 12px;
}

.menu-item {
    padding: 2px 10px;
    cursor: default;
    position: relative;
}

.menu-item:hover {
    background-color: #91c9f7;
    outline: 1px solid #3399ff;
}

.menu-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.menu-dropdown-content {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 150px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    top: 100%;
    left: 0;
    border: 1px solid #999;
}

.menu-dropdown:hover .menu-dropdown-content {
    display: block;
}

.menu-dropdown-item {
    padding: 6px 12px;
    color: #333;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.menu-dropdown-item:hover {
    background-color: #e8f4ff;
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.chart-section {
    flex: 2.5;
    background-color: var(--chart-bg);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chart-section.zoomable {
    cursor: grab;
}

.chart-section.zoomable:active {
    cursor: grabbing;
}

.data-section {
    background-color: var(--panel-bg);
    overflow-y: auto;
    padding: 15px;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Custom Context Menu */
.custom-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    min-width: 200px;
    padding: 5px 0;
    font-family: 'Segoe UI', sans-serif;
}

.context-header {
    padding: 8px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-weight: bold;
    font-size: 12px;
    color: #333;
}

.context-item {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 13px;
    color: #444;
    display: flex;
    align-items: center;
    gap: 10px;
}

.context-item:hover {
    background-color: #e8f4ff;
    color: var(--primary-color);
}

.context-item-range {
    padding: 10px 15px;
    border-top: 1px solid #eee;
}

/* Desktop Order Logic */
.data-col-left {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.planet-list-wrapper {
    order: 1;
    width: 100%;
}

.angles-wrapper {
    order: 2;
    width: 75%;
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 5px;
}

.data-scroll-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex: 1;
    overflow-y: auto;
}

.data-col-right {
    width: 100%;
}

/* Desktop Info Wrapper */
.desktop-info-wrapper {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.user-info-overlay {
    position: static;
    background: transparent;
    padding: 0;
    font-size: 12px;
    line-height: 1.4;
    color: #000;
    text-align: left;
}

.transit-info-overlay {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    padding: 0;
    font-size: 12px;
    line-height: 1.4;
    z-index: 10;
    color: #217a27;
    pointer-events: none;
    text-align: right;
}

.info-sub {
    color: #333;
    font-size: 11px;
    margin-top: 4px;
}

/* Info Blocks (Desktop) */
.eclipse-info,
.voc-info,
.phase-info {
    position: static;
    font-size: 10px;
    color: #333;
    line-height: 1.5;
    border-top: 1px solid #eee;
    padding-top: 5px;
    margin-top: 5px;
}

.eclipse-title {
    font-weight: bold;
    color: #000;
    display: block;
    margin-bottom: 2px;
}

.voc-item {
    color: #333;
    margin-top: 2px;
}

.voc-item.active {
    color: #d32f2f;
    font-weight: bold;
}

/* Aspects Grid - Triangular */
.aspects-grid {
    position: absolute;
    bottom: 15px;
    left: 15px;
    border-collapse: collapse;
    background: transparent;
    z-index: 10;
}

.aspects-grid td {
    font-size: var(--fs-aspects);
    width: 22px;
    height: 22px;
    border: 1px solid #ccc;
    text-align: center;
    vertical-align: middle;
    font-size: 14px;
    background: #ffffff;
}

.aspects-grid td.empty {
    border: none;
    background: transparent;
}

.grid-header {
    background: #ffffff !important;
    font-weight: normal !important;
}

#astroTooltip {
    position: absolute;
    display: none;
    background: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 2000;
    pointer-events: none;
}

/* Context Menu */
#planetContextMenu {
    position: absolute;
    display: none;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 3000;
    min-width: 180px;
    font-size: 12px;
    padding: 5px 0;
}

.menu-header-item {
    padding: 5px 15px;
    border-bottom: 1px solid #eee;
    font-weight: bold;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-aspect-item {
    padding: 3px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.menu-aspect-item:hover {
    background: #e8f4ff;
}

.planet-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.planet-item {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 1px 0;
    color: #000;
}

.astro-font {
    font-family: 'HamburgSymbols', sans-serif;
    font-size: 16px;
    line-height: 1;
}

.sym-p {
    font-size: var(--fs-planets);
    color: #000;
    width: 18px;
    text-align: center;
}

.sym-z {
    font-size: var(--fs-planets);
    color: #000;
    width: 18px;
    text-align: center;
}

.deg-val {
    font-size: var(--fs-degrees);
    color: #000;
    font-family: monospace;
    font-weight: normal;
    min-width: 50px;
    text-align: right;
    font-size: 11px;
}

.retro-r {
    color: #000;
    font-weight: bold;
    font-size: 0.8em;
    width: 10px;
    text-align: center;
}

/* Score Bar Styles */
.planet-score-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: 5px;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background 0.2s;
}

.planet-score-container:hover {
    background-color: #f0f0f0;
}

.score-bar-mini {
    width: 30px;
    height: 2px;
    position: relative;
    overflow: hidden;
}

.score-bar-mini.no-bg {
    background: transparent;
    border: none;
}

.score-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.score-pos {
    background: #217a27;
}

.score-neg {
    background: #ff0000;
}

/* Score Modal Styles */
.score-summary {
    background: #f9f9f9;
    padding: 10px;
    border: 1px solid #eee;
    margin-bottom: 15px;
    font-size: 13px;
}

.score-details-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.score-detail-item {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-detail-item.pos {
    background: #e8f5e9;
    color: #2e7d32;
}

.score-detail-item.neg {
    background: #ffebee;
    color: #c62828;
}

.score-detail-item span {
    font-weight: bold;
    width: 10px;
}

/* Stats Grid Section */
.stats-grid {
    margin-top: auto;
    padding-top: 10px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid #eee;
    position: sticky;
    bottom: 0;
    background: var(--panel-bg);
    z-index: 5;
}

.stat-box {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 2px 0;
    flex-wrap: nowrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #333;
    white-space: nowrap;
}

.stat-icon {
    width: 12px;
    height: 12px;
    stroke-width: 2;
    fill: none;
    stroke: #000;
}

.stat-item span {
    font-size: 11px;
    font-weight: bold;
    color: #000;
}

.circle-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1px solid #000;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
}

/* Chains Section */
.chains-container {
    margin-top: 20px;
    width: 100%;
}

.chain-box {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chain-title {
    font-weight: bold;
    font-size: 10px;
    color: #999;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.graph-wrapper {
    width: 70%;
    height: 140px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    background: transparent;
    overflow: hidden;
}

.graph-wrapper svg {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

/* SVG Chart Styles */
#astrologyChart {
    background-color: var(--chart-svg-bg);
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* IMPORTANT: Keeps lines thin when zoomed in */
.non-scaling {
    vector-effect: non-scaling-stroke;
}

/* Hover Effects for Lines */
.hoverable-group {
    pointer-events: all;
}

.hoverable-group:hover .visible-line {
    stroke-width: 2.5px !important;
    opacity: 1 !important;
    cursor: pointer;
}

/* Special case for already thick lines (Angles) */
.hoverable-group:hover .visible-line[stroke-width="4"] {
    stroke-width: 5px !important;
}

/* SVG Elements Interaction */
.chart-planet {
    cursor: pointer;
    transition: opacity 0.2s;
}

.chart-planet:hover {
    opacity: 0.7;
}

.chart-house-label {
    cursor: default;
    user-select: none;
}

/* Modal Styles - Classic */
.modal {
    position: absolute;
    z-index: 1000;
    background: #ffffff;
    border: 1px solid #005a9e;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.3);
    width: 500px;
    display: none;
    overflow: visible;
    font-family: 'Segoe UI', sans-serif;
    border-radius: 0;
}

.modal-header {
    padding: 6px 10px;
    cursor: move;
    background: #005a9e;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    user-select: none;
    border-radius: 0;
}

.modal-header span:last-child {
    font-size: 16px;
    line-height: 1;
    opacity: 0.8;
    cursor: pointer;
}

.modal-header span:last-child:hover {
    opacity: 1;
    color: #ffcccc;
}

.modal-header span:last-child:hover {
    opacity: 1;
    color: #ffcccc;
}

.modal-body {
    padding: 15px;
    background-color: #fcfcfc;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 0;
}

#dataModal .modal-body {
    overflow: visible;
    max-height: none;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    font-size: 11px;
    margin-bottom: 4px;
    color: #333;
    font-weight: normal;
}

.form-group input {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    border: 1px solid #999;
    border-radius: 2px;
    font-size: 12px;
    background-color: #fff;
}

.form-group input:focus {
    border-color: #005a9e;
    outline: 1px solid #005a9e;
    box-shadow: none;
}

.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.input-with-icon {
    display: flex;
    gap: 5px;
    align-items: center;
}

.db-icon {
    cursor: pointer;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border: 1px solid #999;
    border-radius: 2px;
    font-size: 14px;
}

.db-icon:hover {
    background: #e0e0e0;
}

/* Bases Dropdown */
.bases-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #999;
    border-radius: 0;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
    display: none;
    min-width: 150px;
    z-index: 2000;
    padding: 2px 0;
}

.bases-item {
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
    color: #000;
}

.bases-item:hover {
    background: #005a9e;
    color: white;
}

/* View Settings Modal */
.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: #000;
}

.settings-item input[type="color"] {
    width: 24px;
    height: 24px;
    border: 1px solid #999;
    padding: 1px;
    cursor: pointer;
    border-radius: 0;
}

.settings-item input[type="checkbox"] {
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.settings-btn {
    padding: 2px 8px;
    background: #f0f0f0;
    border: 1px solid #999;
    border-radius: 2px;
    cursor: pointer;
    font-size: 11px;
    color: #000;
}

.settings-btn:hover {
    background: #e0e0e0;
}

/* Dynamics Modal */
.dynamics-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.dynamics-label {
    width: 60px;
    font-weight: bold;
    color: #000;
}

.dynamics-controls {
    display: flex;
    gap: 4px;
}

.dyn-btn {
    width: 30px;
    height: 22px;
    background: #f0f0f0;
    border: 1px solid #999;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #000;
    font-size: 11px;
}

.dyn-btn:hover {
    background: #e0e0e0;
}

.step-input {
    width: 50px !important;
    text-align: center;
    padding: 2px !important;
}

/* Chart Type Dropdown */
.chart-type-wrapper {
    position: relative;
}

.chart-type-btn {
    padding: 4px 8px;
    background: #fff;
    border: 1px solid #999;
    border-radius: 2px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 120px;
}

.chart-type-btn:hover {
    background: #f9f9f9;
}

.chart-type-menu {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #999;
    border-radius: 0;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 2000;
    overflow: hidden;
    margin-bottom: 0;
}

.chart-type-option {
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    color: #000;
}

.chart-type-option:hover {
    background: #005a9e;
    color: white;
}

.chart-type-option.selected {
    background: #e0e0e0;
    color: #000;
    font-weight: bold;
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    border-top: 1px solid #ccc;
    padding-top: 10px;
}

.build-btn {
    padding: 4px 15px;
    background: #f0f0f0;
    color: #000;
    border: 1px solid #999;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.build-btn:hover {
    background: #e0e0e0;
}

.build-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

/* Tabs Styles */
.settings-tabs {
    display: flex;
    border-bottom: 1px solid #ccc;
    margin-bottom: 10px;
    gap: 0;
}

.tab-btn {
    padding: 5px 12px;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    border-radius: 3px 3px 0 0;
    font-size: 12px;
    color: #000;
    font-weight: normal;
    margin-right: 2px;
}

.tab-btn:hover {
    background: #f0f0f0;
}

.tab-btn.active {
    background: #fff;
    color: #000;
    border: 1px solid #ccc;
    border-bottom: 1px solid #fff;
    font-weight: bold;
    margin-bottom: -1px;
}

.tab-content {
    display: none;
    max-height: 400px;
    overflow-y: auto;
    padding-top: 10px;
}

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

.ruler-row,
.aspect-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 12px;
    color: #000;
}

.aspect-row input[type="number"] {
    width: 50px;
    padding: 2px;
    border: 1px solid #999;
    border-radius: 2px;
    text-align: center;
}

.ruler-select {
    width: 110px;
    padding: 2px;
    border: 1px solid #999;
    border-radius: 2px;
}

.section-title {
    font-weight: bold;
    margin: 10px 0 5px 0;
    border-bottom: 1px solid #ccc;
    padding-bottom: 2px;
    color: #000;
    font-size: 12px;
    text-transform: none;
    letter-spacing: normal;
}

/* City Modal Styles */
.city-search-box {
    margin-bottom: 15px;
    position: relative;
}

.city-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #999;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.city-result-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 12px;
    border-bottom: 1px solid #eee;
    line-height: 1.4;
}

.city-result-item:hover {
    background: #e8f4ff;
}

.quick-city-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-top: 10px;
}

.quick-city-item {
    padding: 4px 8px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    font-size: 11px;
    cursor: pointer;
    text-align: center;
}

.quick-city-item:hover {
    background: #e0e0e0;
    border-color: #999;
}

/* Responsive adjustments for small desktop screens (1024x600) */
@media (max-height: 650px) and (min-width: 769px) {
    body {
        font-size: 11px;
    }

    .menu-bar {
        padding: 1px 5px;
        font-size: 11px;
    }

    .desktop-info-wrapper {
        top: 5px;
        left: 5px;
        gap: 5px;
    }

    .transit-info-overlay {
        top: 5px;
        right: 5px;
    }

    .aspects-grid {
        bottom: 5px;
        left: 5px;
    }

    .aspects-grid td {
        font-size: var(--fs-aspects);
        width: 18px;
        height: 18px;
        font-size: 12px;
    }

    .data-section {
        padding: 10px;
    }

    .planet-item {
        padding: 0;
    }

    .astro-font {
        font-size: 14px;
    }

    .deg-val {
        font-size: var(--fs-degrees);
        font-size: 10px;
    }

    .stats-grid {
        padding-top: 5px;
        gap: 4px;
    }

    .stat-box {
        padding: 1px 0;
    }

    .stat-item {
        font-size: 10px;
    }

    .graph-wrapper {
        height: 100px;
    }

    .modal {
        max-height: 90vh;
    }

    .modal-body {
        max-height: 80vh;
        padding: 10px;
    }

    /* Scale down chart and move right to avoid overlap with left info */
    #astrologyChart {
        transform: scale(0.85) translateX(30px);
        transform-origin: center;
    }

    /* Reduce planet and degree text size on chart */
    .chart-planet text[font-family="HamburgSymbols"] {
        font-size: 14px !important;
    }

    .chart-planet text[font-family="Arial"] {
        font-size: 8px !important;
    }
}

/* ===== DARK MODE ===== */
body.dark-mode {
    --bg-color: #1a1a2e;
    --panel-bg: #16213e;
    --chart-bg: #12122a;
    --chart-svg-bg: transparent;
    --border-color: #2a2a4a;
    --primary-color: #4da6ff;
    --primary-hover: #3a8fd9;
    background-color: var(--bg-color);
    color: #d0d0d0;
}

body.dark-mode .menu-bar {
    background-color: #0f1527;
    border-bottom-color: #2a2a4a;
    color: #ccc;
}

body.dark-mode .menu-item:hover {
    background-color: #2a3a5a;
    outline-color: #4da6ff;
}

body.dark-mode .menu-dropdown-content {
    background-color: #0f1527;
    border-color: #2a2a4a;
}

body.dark-mode .menu-dropdown-item {
    color: #ccc;
}

body.dark-mode .menu-dropdown-item:hover {
    background-color: #2a3a5a;
}

body.dark-mode .chart-section {
    background-color: #1a1a2e;
}

body.dark-mode .data-section {
    background-color: var(--panel-bg);
    color: #d0d0d0;
}

body.dark-mode .user-info-overlay {
    color: #d0d0d0;
}

body.dark-mode .info-sub {
    color: #aaa;
}

body.dark-mode .eclipse-title {
    color: #e0e0e0;
}

body.dark-mode .eclipse-info,
body.dark-mode .voc-info,
body.dark-mode .phase-info {
    color: #bbb;
    border-top-color: #333;
}

body.dark-mode .voc-item {
    color: #bbb;
}

body.dark-mode .aspects-grid td {
    font-size: var(--fs-aspects);
    border-color: #3a3a5a;
    background: #1e2740;
}

body.dark-mode .aspects-grid td.empty {
    background: transparent;
}

body.dark-mode .grid-header {
    background: #1e2740 !important;
}

/* Modals */
body.dark-mode .modal {
    background-color: #1e2740;
    border-color: #3a3a5a;
    color: #d0d0d0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

body.dark-mode .modal-header {
    background-color: #0f1527;
    color: #e0e0e0;
    border-bottom-color: #2a2a4a;
}

body.dark-mode .modal-body {
    background-color: #1e2740;
    color: #d0d0d0;
}

body.dark-mode .modal-body input[type="text"],
body.dark-mode .modal-body input[type="date"],
body.dark-mode .modal-body input[type="time"],
body.dark-mode .modal-body input[type="number"],
body.dark-mode .modal-body select,
body.dark-mode .modal-body textarea {
    background-color: #2a3a5a;
    color: #d0d0d0;
    border-color: #3a4a6a;
}

body.dark-mode .section-title {
    color: #7ab8ff;
}

body.dark-mode .settings-item {
    border-bottom-color: #2a2a4a;
    color: #d0d0d0;
}

body.dark-mode .settings-item span {
    color: #d0d0d0;
}

/* Tab Buttons */
body.dark-mode .tab-btn {
    background: #2a3a5a;
    color: #aaa;
}

body.dark-mode .tab-btn.active {
    background: var(--primary-color);
    color: #fff;
}

/* Build / Action buttons */
body.dark-mode .build-btn {
    background: var(--primary-color);
    color: #fff;
}

body.dark-mode .build-btn:hover {
    background: var(--primary-hover);
}

body.dark-mode .settings-btn {
    background: #2a3a5a;
    color: #d0d0d0;
    border-color: #3a4a6a;
}

/* Planet list items */
body.dark-mode .planet-item {
    color: #d0d0d0;
    border-bottom-color: #2a2a4a;
}

body.dark-mode .planet-item:hover {
    background: #2a3a5a;
}

body.dark-mode .retro-r {
    color: #d0d0d0 !important;
}

body.dark-mode .deg-val {
    font-size: var(--fs-degrees);
    color: #bbb;
}

/* Context menu */
body.dark-mode .custom-context-menu,
body.dark-mode #planetContextMenu {
    background: #1e2740;
    border-color: #3a3a5a;
    box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.5);
}

body.dark-mode .context-header {
    background: #0f1527;
    border-bottom-color: #2a2a4a;
    color: #e0e0e0;
}

body.dark-mode .context-item {
    color: #ccc;
}

body.dark-mode .context-item:hover {
    background-color: #2a3a5a;
    color: var(--primary-color);
}

/* Tooltip */
body.dark-mode #astroTooltip {
    background: #0f1527;
    color: #e0e0e0;
}

/* Custom Dialog */
body.dark-mode .custom-dialog {
    background: #1e2740;
    color: #d0d0d0;
}

body.dark-mode .dialog-btn {
    background: #2a3a5a;
    color: #d0d0d0;
    border-color: #3a4a6a;
}

body.dark-mode .dialog-btn-primary {
    background: var(--primary-color);
    color: #fff;
}

/* Dynamics controls */
body.dark-mode .dyn-btn {
    background: #2a3a5a;
    color: #d0d0d0;
    border-color: #3a4a6a;
}

body.dark-mode .dyn-btn:hover {
    background: #3a4a6a;
}

/* Mode selector */
body.dark-mode .mode-selector {
    background: #0f1527;
}

body.dark-mode .mode-btn {
    color: #aaa;
}

body.dark-mode .mode-btn.active-mode {
    background: #2a3a5a;
    color: #fff;
}

/* Score details */
body.dark-mode .score-detail-item {
    color: #bbb;
}

body.dark-mode .score-summary {
    color: #d0d0d0;
}

/* Scrollbar */
body.dark-mode ::-webkit-scrollbar {
    width: 8px;
}

body.dark-mode ::-webkit-scrollbar-track {
    background: #1a1a2e;
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: #3a3a5a;
    border-radius: 4px;
}

body.dark-mode .user-badge {
    background: #2a3a5a !important;
    color: #d0d0d0 !important;
}

/* Database items */
body.dark-mode .db-item {
    border-bottom-color: #2a2a4a;
}

body.dark-mode .db-item:hover {
    background: #2a3a5a;
}

/* Quick city list & city results */
body.dark-mode .city-results,
body.dark-mode .quick-city-list {
    color: #d0d0d0;
}

body.dark-mode .city-results div:hover,
body.dark-mode .quick-city-list span:hover {
    background: #2a3a5a;
}

/* Ruler & aspect rows */
body.dark-mode .ruler-row,
body.dark-mode .aspect-row {
    border-bottom-color: #2a2a4a;
    color: #d0d0d0;
}

body.dark-mode .ruler-select {
    background: #2a3a5a;
    color: #d0d0d0;
    border-color: #3a4a6a;
}

/* ===== DARK MODE: Override inline styles with !important ===== */

/* Force ALL text inside body to be light unless specifically excluded */
body.dark-mode,
body.dark-mode * {
    border-color: #2a2a4a;
}

/* Override inline color: #000 on planet list items, transit items, etc. */
body.dark-mode .planet-item span,
body.dark-mode .planet-item .retro-r,
body.dark-mode .planet-item .deg-val,
body.dark-mode .planet-item .sym-p,
body.dark-mode .planet-item .sym-z {
    font-size: var(--fs-planets);
    color: #d0d0d0 !important;
}

/* Transit data overlay */
body.dark-mode .transit-info-overlay {
    color: #4dff88 !important;
}

/* Score modal inline colors */
body.dark-mode .score-summary {
    color: #d0d0d0 !important;
}

body.dark-mode .score-detail-item.pos span {
    color: #4dff88 !important;
}

body.dark-mode .score-detail-item.neg span {
    color: #ff6666 !important;
}

/* Section titles with inline colors */
body.dark-mode .section-title {
    color: #7ab8ff !important;
}

/* Interpretation modal text */
body.dark-mode #interpText {
    color: #d0d0d0 !important;
}

/* All inline-styled spans in data section */
body.dark-mode .data-section span {
    color: #d0d0d0 !important;
}

body.dark-mode .data-section .sym-p,
body.dark-mode .data-section .sym-z {
    font-size: var(--fs-planets);
    color: #d0d0d0 !important;
}

/* Eclipse info overlay text */
body.dark-mode .eclipse-title {
    color: #e0e0e0 !important;
}

/* Menu bar special items */
body.dark-mode .menu-bar .menu-item {
    color: #ccc !important;
}

/* Angles list */
body.dark-mode #anglesList span {
    color: #d0d0d0 !important;
}

body.dark-mode .angles-wrapper {
    border-top-color: #2a2a4a;
    color: #d0d0d0;
}

/* Info overlay text (user info on chart) */
body.dark-mode .user-info-overlay,
body.dark-mode .user-info-overlay * {
    color: #d0d0d0 !important;
}

/* Chart overlay info */
body.dark-mode .desktop-info-wrapper {
    color: #d0d0d0;
}

body.dark-mode .desktop-info-wrapper .eclipse-info,
body.dark-mode .desktop-info-wrapper .voc-info,
body.dark-mode .desktop-info-wrapper .phase-info {
    color: #bbb !important;
    border-top-color: #333;
}

body.dark-mode .desktop-info-wrapper .info-sub {
    color: #aaa !important;
}

/* Chart SVG background */
body.dark-mode .chart-section svg {
    background-color: transparent;
}

/* All inputs globally */
body.dark-mode input[type="text"],
body.dark-mode input[type="date"],
body.dark-mode input[type="time"],
body.dark-mode input[type="number"],
body.dark-mode input[type="search"],
body.dark-mode select,
body.dark-mode textarea {
    background-color: #2a3a5a !important;
    color: #d0d0d0 !important;
    border-color: #3a4a6a !important;
}

/* Header list items in planet list */
body.dark-mode .planet-item.header {
    border-bottom-color: #3a4a6a !important;
    color: #e0e0e0 !important;
}

body.dark-mode .planet-item.header div {
    color: #e0e0e0 !important;
}

/* Transit section divider lines */
body.dark-mode .planet-item div[style*="border-left"] {
    border-left-color: #3a4a6a !important;
}

/* Context menu section title */
body.dark-mode .context-section-title {
    color: #888 !important;
}

/* VOC active styling - keep red */
body.dark-mode .voc-item.active {
    color: #ff6666 !important;
}

/* Rectification modal */
body.dark-mode #rectiResultsBody tr {
    color: #d0d0d0;
    border-bottom-color: #2a2a4a;
}

body.dark-mode #rectiResultsBody tr:hover {
    background: #2a3a5a;
}

/* Inline-colored elements in score modal */
body.dark-mode #scoreModalBody .section-title[style*="color: #000080"] {
    color: #6699ff !important;
}

body.dark-mode #scoreModalBody .section-title[style*="color: #800080"] {
    color: #cc66ff !important;
}

body.dark-mode #scoreModalBody .section-title[style*="color: #217a27"] {
    color: #4dff88 !important;
}

body.dark-mode #scoreModalBody .section-title[style*="color: #ff0000"] {
    color: #ff6666 !important;
}

/* Planet Score bar backgrounds */
body.dark-mode .score-bar-mini {
    background: #2a3a5a;
}

/* Planet score container */
body.dark-mode .planet-score-container {
    opacity: 0.9;
}

/* Data section general borders */
body.dark-mode .data-section {
    border-left-color: #2a2a4a;
}

/* Ensure white text override on all common dark text */
body.dark-mode [style*="color: #000"] {
    color: #d0d0d0 !important;
}

body.dark-mode [style*="color: #333"] {
    color: #bbb !important;
}

body.dark-mode [style*="color: #2c3e50"] {
    color: #aabbcc !important;
}

body.dark-mode [style*="color: #666"] {
    color: #999 !important;
}

body.dark-mode [style*="color: #555"] {
    color: #999 !important;
}

body.dark-mode [style*="color: #444"] {
    color: #aaa !important;
}

/* Keep specific semantic colors */
body.dark-mode [style*="color: #d35400"] {
    color: #ff8c42 !important;
}

body.dark-mode [style*="color: #2980b9"] {
    color: #5dade2 !important;
}

body.dark-mode [style*="color: #e74c3c"] {
    color: #ff6b6b !important;
}

body.dark-mode [style*="color: #155724"] {
    color: #4dff88 !important;
}

body.dark-mode [style*="color: #004085"] {
    color: #6699ff !important;
}

body.dark-mode [style*="color: #856404"] {
    color: #ffd700 !important;
}

/* Background overrides for inline bg */
body.dark-mode [style*="background: #eee"],
body.dark-mode [style*="background-color: #eee"],
body.dark-mode [style*="background: #f8f9fa"],
body.dark-mode [style*="background: #f9f9f9"],
body.dark-mode [style*="background: #f1f3f5"] {
    background: #2a3a5a !important;
}

body.dark-mode [style*="border-top: 1px solid rgba(0,0,0,0.1)"] {
    border-top-color: #3a4a6a !important;
}

body.dark-mode [style*="border-bottom: 2px solid #ccc"] {
    border-bottom-color: #3a4a6a !important;
}

body.dark-mode [style*="border-left: 1px solid #ccc"] {
    border-left-color: #3a4a6a !important;
}

body.dark-mode [style*="background: #ccc"] {
    background: #3a4a6a !important;
}

/* Main chart background */
body.dark-mode .chart-section {
    background-color: #12122a !important;
}