/* ============================================================
   MOONNET — GLOBAL THEME
   body[data-theme="dark"|"light"] переключается из ui-controller.js
   ============================================================ */

:root {
    --bg-dark: #020617;
    --bg-dark-soft: #020617;
    --bg-dark-2: #0f172a;
    --bg-dark-3: #020617;

    --bg-light: #f3f4f6;
    --bg-light-2: #ffffff;
    --bg-light-3: #e5e7eb;

    --text-dark: #e5e7eb;
    --text-muted-dark: #9ca3af;
    --text-light: #0f172a;
    --text-muted-light: #6b7280;

    --card-dark: #020617;
    --card-dark-soft: #020617;
    --card-light: #ffffff;

    --accent: #38bdf8;
    --accent-hover: #0ea5e9;

    --border-dark: #1f2937;
    --border-light: #d1d5db;

    --danger: #f97373;
    --success: #22c55e;
    --warn: #eab308;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-dark);
    color: var(--text-dark);
    min-height: 100vh;
}

/* темы */

body[data-theme="dark"] {
    background: radial-gradient(circle at top, #020617 0, #020617 36%, #020617 100%);
    color: var(--text-dark);
}

body[data-theme="light"] {
    background: radial-gradient(circle at top, #e5f2ff 0, #f9fafb 35%, #e5e7eb 100%);
    color: var(--text-light);
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(10px);
    background: linear-gradient(
        to bottom,
        rgba(15,23,42,0.95),
        rgba(15,23,42,0.8),
        transparent
    );
}

body[data-theme="light"] .page-header {
    background: linear-gradient(
        to bottom,
        rgba(248,250,252,0.96),
        rgba(248,250,252,0.9),
        transparent
    );
}

.page-title {
    margin: 0;
    font-size: 22px;
    letter-spacing: 0.03em;
}

.page-main {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto 32px;
    padding: 8px 16px 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================================
   CARDS / SECTIONS
   ============================================================ */

.section {
    width: 100%;
}

.card {
    background: radial-gradient(circle at top left, #111827 0, #020617 45%, #020617 100%);
    border-radius: 18px;
    padding: 18px 18px 20px;
    border: 1px solid rgba(148,163,184,0.35);
    box-shadow: 0 24px 50px rgba(15,23,42,0.65);
    transition: background .2s, border-color .2s, box-shadow .2s, transform .2s;
}

.card:hover {
    border-color: var(--accent);
    box-shadow: 0 26px 60px rgba(56,189,248,0.55);
    transform: translateY(-1px);
}

body[data-theme="light"] .card {
    background: radial-gradient(circle at top left, #e5f3ff 0, #ffffff 40%, #ffffff 100%);
    border-color: rgba(148,163,184,0.45);
    box-shadow: 0 16px 35px rgba(148,163,184,0.35);
}

body[data-theme="light"] .card:hover {
    border-color: var(--accent);
    box-shadow: 0 22px 45px rgba(56,189,248,0.4);
}

.card-title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.card-subtitle {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text-muted-dark);
}

body[data-theme="light"] .card-subtitle {
    color: var(--text-muted-light);
}

/* auth секция */

.section-auth {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 14px;
}

.section-auth.collapsed {
    display: none;
}

/* общие секции */

.section-input,
.section-extra-points,
.section-details,
.section-legends {
    margin-top: 6px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

button,
.btn {
    padding: 9px 16px;
    border-radius: 999px;
    background: radial-gradient(circle at top, var(--accent) 0, #0369a1 60%);
    border: none;
    color: #f9fafb;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 0 0 rgba(56,189,248,0.0);
    transition: background .18s, box-shadow .18s, transform .12s, opacity .15s;
}

button:hover,
.btn:hover {
    background: radial-gradient(circle at top, var(--accent-hover) 0, #0284c7 60%);
    box-shadow: 0 0 24px rgba(56,189,248,0.7);
    transform: translateY(-0.5px);
}

button:active,
.btn:active {
    transform: translateY(0.5px) scale(.98);
    box-shadow: 0 0 16px rgba(56,189,248,0.5);
}

button:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
}

/* спец-кнопки */

.btn-primary {
    /* базовый gradient уже задан */
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(148,163,184,0.7);
    color: #e5e7eb;
    box-shadow: none;
}

.btn-outline:hover {
    background: rgba(15,23,42,0.95);
}

body[data-theme="light"] .btn-outline {
    color: #0f172a;
    background: transparent;
}

.btn-secondary {
    background: linear-gradient(to right, #6366f1, #0ea5e9);
}

.btn-gradient.btn-build {
    padding: 12px 24px;
    font-size: 15px;
    align-self: center;
    min-width: 260px;
    background: linear-gradient(120deg, #38bdf8, #8b5cf6, #f97373);
    background-size: 200% 200%;
    animation: moonnet-gradient 16s ease infinite;
}

.auth-toggle-btn,
.theme-toggle-btn {
    font-size: 13px;
    padding: 8px 14px;
}

@keyframes moonnet-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ============================================================
   FORMS
   ============================================================ */

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 14px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-label {
    font-size: 13px;
    color: var(--text-muted-dark);
}

body[data-theme="light"] .form-label {
    color: var(--text-muted-light);
}

.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select {
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148,163,184,0.6);
    background: radial-gradient(circle at top, #020617 0, #020617 70%);
    color: #e5e7eb;
    font-size: 14px;
    outline: none;
    transition: border-color .16s, box-shadow .16s, background .16s;
}

.input:focus,
input:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(56,189,248,0.7);
}

body[data-theme="light"] .input,
body[data-theme="light"] input,
body[data-theme="light"] select {
    background: #ffffff;
    color: #111827;
    border-color: rgba(148,163,184,0.6);
}

/* чекбоксы */

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

.checkbox-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* UTC блок */

.utc-block {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed rgba(148,163,184,0.5);
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
}

.utc-select {
    max-width: 260px;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted-dark);
}

body[data-theme="light"] .form-hint {
    color: var(--text-muted-light);
}

/* дополнительные точки */

.section-extra-points .extra-points-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}

/* ============================================================
   CITY AUTOCOMPLETE
   ============================================================ */

.city-suggestions {
    position: absolute;
    margin-top: 4px;
    width: 100%;
    max-height: 260px;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid rgba(148,163,184,0.5);
    background: radial-gradient(circle at top, #020617 0, #020617 70%);
    box-shadow: 0 18px 38px rgba(15,23,42,0.8);
    z-index: 40;
    display: none;
}

body[data-theme="light"] .city-suggestions {
    background: #ffffff;
    box-shadow: 0 18px 38px rgba(148,163,184,0.4);
}

.suggestion-item {
    padding: 7px 10px;
    cursor: pointer;
    transition: background .15s;
}

.suggestion-item:hover {
    background: rgba(56,189,248,0.16);
}

.suggestion-main {
    font-size: 13px;
}

.suggestion-coords {
    font-size: 11px;
    color: var(--text-muted-dark);
}

body[data-theme="light"] .suggestion-coords {
    color: var(--text-muted-light);
}

/* ============================================================
   CHART AREA (2D / 3D)
   ============================================================ */

.section-charts {
    margin-top: 8px;
}

.charts-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.1fr) minmax(0, 1.4fr);
    grid-auto-rows: minmax(0, auto);
    gap: 14px;
}

.chart-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chart-modes {
    margin-top: 6px;
}

.chart-mode-wrapper {
    display: none;
}

.chart-mode-wrapper.chart-mode-active {
    display: block;
}

.chart-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px 0 6px;
}

/* канвас 2D/3D */

#chart-2d,
#chart-3d {
    width: 100%;
    height: auto;
    max-width: 520px;
    max-height: 520px;
    display: block;
    border-radius: 16px;
    background: transparent;
    box-shadow: 0 0 26px rgba(15,23,42,0.8);
}

body[data-theme="light"] #chart-2d,
body[data-theme="light"] #chart-3d {
    box-shadow: 0 0 26px rgba(148,163,184,0.6);
}

.chart-actions {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* таблица домов справа */

.houses-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.houses-table th,
.houses-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(31,41,55,0.85);
}

body[data-theme="light"] .houses-table th,
body[data-theme="light"] .houses-table td {
    border-bottom: 1px solid rgba(209,213,219,0.9);
}

.houses-table thead th {
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
}

/* ============================================================
   TABS (Планеты / Аспекты / Дома / Антисы + режимы)
   ============================================================ */

.tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    border-radius: 999px;
    background: radial-gradient(circle at top, rgba(15,23,42,0.96), rgba(15,23,42,0.85));
    padding: 4px;
}

body[data-theme="light"] .tabs {
    background: rgba(229,231,235,0.9);
}

.tabs-small {
    margin-bottom: 4px;
}

.tab {
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    padding: 6px 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted-dark);
    cursor: pointer;
    transition: background .16s, color .16s, border-color .16s;
}

body[data-theme="light"] .tab {
    color: var(--text-muted-light);
}

.tab.tab-active,
.tab.active {
    background: radial-gradient(circle at top, #38bdf8, #0284c7);
    color: #f9fafb;
    border-color: rgba(56,189,248,0.7);
}

/* горизонтальные секции под картой */

.section-details .tabs-content {
    margin-top: 10px;
}

.section-panel {
    display: none;
}

.section-panel.section-panel-active {
    display: block;
}

.panel-title {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 600;
}

/* дополнительные вкладки справа (таблица аспектов / сильные объекты) */

.extra-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    background: transparent;
    padding: 0;
}

.extra-tab {
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.6);
    background: transparent;
    padding: 5px 12px;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    color: var(--text-muted-dark);
    transition: background .16s, color .16s, border-color .16s;
}

.extra-tab.extra-tab-active {
    background: radial-gradient(circle at top, var(--accent), #0284c7);
    color: #f9fafb;
    border-color: rgba(56,189,248,0.9);
}

.extra-panel {
    display: none;
    margin-top: 8px;
}

.extra-panel.extra-panel-active {
    display: block;
}

/* таблица аспектов */

.aspect-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.aspect-table th,
.aspect-table td {
    padding: 4px 6px;
    border: 1px solid rgba(31,41,55,0.8);
    text-align: center;
}

body[data-theme="light"] .aspect-table th,
body[data-theme="light"] .aspect-table td {
    border-color: rgba(209,213,219,0.9);
}

.aspect-table thead th {
    background: rgba(15,23,42,0.9);
    color: #e5e7eb;
}

body[data-theme="light"] .aspect-table thead th {
    background: rgba(209,213,219,0.9);
    color: #111827;
}

.aspect-table td[data-aspect-type="trine"],
.aspect-table td[data-aspect-type="sextile"] {
    color: #ef4444; /* трины/секстили — красные */
}

.aspect-table td[data-aspect-type="square"],
.aspect-table td[data-aspect-type="opposition"] {
    color: #38bdf8; /* квадрат/оппозиция — синие */
}

.aspect-table td[data-aspect-type="conjunction"] {
    color: #22c55e; /* соединения — зелёные */
}

/* ============================================================
   DATA LISTS / LEGENDS
   ============================================================ */

.data-list {
    list-style: none;
    padding: 0;
    margin: 4px 0 0;
    font-size: 13px;
}

.data-list li {
    padding: 3px 0;
}

.section-legends {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.legend-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 13px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(15,23,42,0.8);
    border: 1px solid rgba(148,163,184,0.6);
    backdrop-filter: blur(6px);
}

body[data-theme="light"] .legend-item {
    background: rgba(255,255,255,0.9);
    border-color: rgba(209,213,219,0.9);
}

.legend-symbol {
    font-size: 15px;
    min-width: 16px;
    text-align: center;
}

/* сильные объекты */

#strong-objects-list .glyph {
    margin-right: 4px;
}

/* ============================================================
   NOTIFICATIONS (showNotification)
   ============================================================ */

.notification {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9999;
    padding: 9px 14px;
    font-size: 13px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: rgba(15,23,42,0.96);
    color: #e5e7eb;
    box-shadow: 0 20px 35px rgba(0,0,0,0.6);
}

body[data-theme="light"] .notification {
    background: rgba(255,255,255,0.98);
    color: #111827;
    box-shadow: 0 16px 30px rgba(148,163,184,0.5);
}

.notification-success {
    border-color: rgba(34,197,94,0.8);
}

.notification-error {
    border-color: rgba(248,113,113,0.9);
}

.notification-info {
    border-color: rgba(56,189,248,0.9);
}

/* ============================================================
   TOOLTIP ДЛЯ АСПЕКТОВ (из chart-renderer.js)
   ============================================================ */

.chart-tooltip {
    position: fixed;
    z-index: 5000;
    background: rgba(15,23,42,0.96);
    color: #f1f5f9;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    pointer-events: none;
    white-space: nowrap;
    border: 1px solid rgba(148,163,184,0.55);
    box-shadow: 0 0 10px rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
}

body[data-theme="light"] .chart-tooltip {
    background: rgba(255,255,255,0.96);
    color: #0f172a;
    border-color: rgba(148,163,184,0.55);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 960px) {
    .section-auth {
        grid-template-columns: minmax(0, 1fr);
    }

    .charts-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .section-legends {
        grid-template-columns: minmax(0, 1fr);
    }

    .page-header {
        flex-wrap: wrap;
        gap: 8px;
    }
}

@media (max-width: 720px) {
    .page-main {
        padding-inline: 12px;
    }

    .form-grid,
    .form-grid-2 {
        grid-template-columns: minmax(0, 1fr);
    }

    .btn,
    button,
    .btn-build {
        width: 100%;
        justify-content: center;
    }

    .utc-block {
        flex-direction: column;
        align-items: flex-start;
    }

    #chart-2d,
    #chart-3d {
        max-width: 100%;
    }
}
