@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Lato:wght@300;400;700&display=swap');

:root {
    --navy: #0d1b2e;
    --deep: #0a1628;
    --gold: #f4b942;
    --gold-light: #ffd87a;
    --blue: #1e6bbf;
    --blue-bright: #3a9de8;
    --red: #c0392b;
    --red-bright: #e74c3c;
    --teal: #1abc9c;
    --white: #f0eada;
    --white-dim: #c9bfa8;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(244, 185, 66, 0.25);
    --input-bg: rgba(255, 255, 255, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Lato', sans-serif;
    background: var(--navy);
    color: var(--white);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Stars background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 10% 20%, rgba(255, 255, 255, 0.8) 0%, transparent 100%),
        radial-gradient(1px 1px at 30% 60%, rgba(255, 255, 255, 0.6) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 50% 10%, rgba(244, 185, 66, 0.9) 0%, transparent 100%),
        radial-gradient(1px 1px at 70% 40%, rgba(255, 255, 255, 0.7) 0%, transparent 100%),
        radial-gradient(1px 1px at 85% 75%, rgba(255, 255, 255, 0.5) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 20% 85%, rgba(58, 157, 232, 0.8) 0%, transparent 100%),
        radial-gradient(1px 1px at 92% 25%, rgba(255, 255, 255, 0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 55% 55%, rgba(255, 255, 255, 0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 40% 90%, rgba(244, 185, 66, 0.5) 0%, transparent 100%),
        radial-gradient(2px 2px at 75% 15%, rgba(255, 255, 255, 0.9) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(30, 107, 191, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 100% 100%, rgba(142, 68, 173, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

#app {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 16px 80px;
}

header {
    text-align: center;
    padding: 32px 0 28px;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 28px;
    position: relative;
}

header h1 {
    font-family: 'Cinzel', serif;
    font-size: clamp(22px, 5vw, 38px);
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 3px;
    text-shadow: 0 0 20px rgba(244, 185, 66, 0.4);
}

header p {
    color: var(--white-dim);
    font-size: 13px;
    margin-top: 6px;
    letter-spacing: 1.5px;
    font-weight: 300;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--deep);
    border-radius: 14px;
    padding: 6px;
    border: 1px solid var(--card-border);
}

.tab-btn {
    flex: 1;
    padding: 10px 8px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--white-dim);
    font-family: 'Cinzel', serif;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.25s;
    letter-spacing: 0.5px;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--blue), var(--blue-bright));
    color: white;
    box-shadow: 0 4px 15px rgba(30, 107, 191, 0.4);
}

.panel {
    display: none;
}

.panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
}

.card h2 {
    font-family: 'Cinzel', serif;
    font-size: 16px;
    color: var(--gold);
    margin-bottom: 20px;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.form-group.full {
    grid-column: 1 / -1;
}

label {
    font-size: 11px;
    color: var(--white-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 700;
}

input,
select,
textarea {
    background: var(--input-bg);
    border: 1px solid rgba(244,185,66,0.2);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--white);
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
}

select {background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M6 8L0 0h12z' fill='%23f4b942'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select option {
    background: #1a2a3e;
    color: var(--white);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(244, 185, 66, 0.15);
}

textarea {
    height: 100px;
    resize: none;
}

/* Autocomplete Suggestion Box */
.geo-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #11223a;
    border: 1px solid var(--gold);
    border-radius: 0 0 10px 10px;
    z-index: 99;
    max-height: 180px;
    overflow-y: auto;
    list-style: none;
    box-shadow: var(--shadow);
}

.geo-suggestions li {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.geo-suggestions li:hover {
    background: rgba(244, 185, 66, 0.15);
    color: var(--gold);
}

.planets-section {
    margin-top: 20px;
}

.planets-section h3 {
    font-family: 'Cinzel', serif;
    font-size: 13px;
    color: var(--gold-light);
    letter-spacing: 1px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(244, 185, 66, 0.15);
}

.planets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
}

.planet-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-sizing: border-box;
    width: 100%;
}

.planet-label {
    font-size: 13px;
    width: 95px;
    flex-shrink: 0;
    font-weight: 700;
}

.planet-row select,
.planet-row input[type="number"] {
    flex: 1;
    min-width: 80px;
    padding: 8px;
    font-size: 12px;
    width: auto !important;
    /* El !important anula el ancho fijo que estaba en el HTML */
    box-sizing: border-box;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
    font-weight: 600;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue), var(--blue-bright));
    color: white;
    box-shadow: 0 4px 20px rgba(30, 107, 191, 0.4);
    width: 100%;
    justify-content: center;
    margin-top: 15px;
    padding: 14px;
}

.btn-mapa {
    background: linear-gradient(135deg, #8e44ad, #b356d7);
    color: white;
    border: 1px solid rgba(244, 185, 66, 0.3);
    box-shadow: 0 4px 15px rgba(142, 68, 173, 0.4);
}

.btn-danger {
    background: rgba(192, 57, 43, 0.2);
    color: var(--red-bright);
    border: 1px solid rgba(192, 57, 43, 0.3);
    padding: 6px 12px;
}

.btn-edit {
    background: rgba(26, 188, 156, 0.15);
    color: var(--teal);
    border: 1px solid rgba(26, 188, 156, 0.3);
    padding: 6px 12px;
}

.btn-logout {
    position: absolute;
    top: 18px;
    right: 0;
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 11px;
}

.btn-logout:hover {
    background: rgba(244, 185, 66, 0.15);
}

.search-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar-wrap {
    grid-column: 1 / -1;
}

.results-count {
    font-size: 12px;
    color: var(--white-dim);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.consultante-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(244, 185, 66, 0.18);
    border-radius: 14px;
    margin-bottom: 14px;
    overflow: hidden;
}

.consultante-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
}

.consultante-name {
    font-family: 'Cinzel', serif;
    font-size: 16px;
    color: var(--gold);
    font-weight: 600;
}

.consultante-meta {
    font-size: 12px;
    color: var(--white-dim);
    margin-top: 3px;
}

.toggle-arrow {
    color: var(--gold);
    transition: transform 0.25s;
}

.consultante-card.open .toggle-arrow {
    transform: rotate(180deg);
}

.consultante-body {
    display: none;
    padding: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.consultante-card.open .consultante-body {
    display: block;
}

.planets-display {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

.planet-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.2);
}

.planet-tag.match {
    box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(244, 185, 66, 0.5);
    transform: scale(1.05);
}

.notes-display {
    margin-top: 12px;
    font-size: 13px;
    color: var(--white-dim);
    line-height: 1.6;
    font-style: italic;
    border-left: 2px solid var(--gold);
    padding-left: 10px;
}

/* RE-ADAPTED LOGO / LOGIN WINDOW */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 45px 35px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.login-box h1 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 26px;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.login-box p {
    color: var(--white-dim);
    font-size: 13px;
    margin-bottom: 30px;
    letter-spacing: 1px;
}

.error-message {
    color: var(--red-bright);
    background: rgba(192, 57, 43, 0.15);
    border: 1px solid rgba(192, 57, 43, 0.3);
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 20px;
}

/* COSMOGRAM WINDOW */
.mapa-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 11, 22, 0.96);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.mapa-overlay.open {
    display: flex;
}

.mapa-container {
    width: 100%;
    max-width: 650px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--gold);
    border-radius: 20px;
    padding: 24px;
    position: relative;
    text-align: center;
    box-shadow: 0 0 40px rgba(244, 185, 66, 0.2);
}

.close-mapa {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    color: var(--gold);
    cursor: pointer;
    background: none;
    border: none;
}

/* STATS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(244, 185, 66, 0.18);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.stat-number {
    font-family: 'Cinzel', serif;
    font-size: 32px;
    color: var(--gold);
    font-weight: 700;
}

.stat-label {
    font-size: 11px;
    color: var(--white-dim);
    margin-top: 6px;
    text-transform: uppercase;
}

.top-list {
    list-style: none;
}

.top-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
}

.count-badge {
    background: rgba(30, 107, 191, 0.3);
    color: var(--blue-bright);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 700;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--teal);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 700;
    transition: transform 0.3s ease;
    z-index: 1100;
    opacity: 0;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal-box {
    background: #12233a;
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 28px 24px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

.btn-cancel {
    background: transparent;
    color: var(--white-dim);
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-family: 'Cinzel', serif;
}

/* UI fixed from the very first version from Claude Code */

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--white-dim);
}

.empty-state .big-symbol {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 14px;
    line-height: 1.7;
}

/* =========================================
   COSMOGRAM CUSTOM TOOLTIP & HOVER EFFECTS
   ========================================= */
.astro-tooltip {
    position: absolute;
    background: var(--navy);
    color: var(--white);
    border: 1px solid var(--gold);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    pointer-events: none;
    /* Prevents the tooltip from blocking mouse movements */
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    z-index: 9999;
    white-space: nowrap;
    font-family: 'Lato', sans-serif;
}

.astro-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Make SVG groups smoothly transition their styles */
.planet-group circle {
    transition: fill 0.2s ease, stroke-width 0.2s ease;
}

#canvas-astral-holder {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    /* Remove background and heavy borders from here, let the SVG do the work */
    display: flex;
    justify-content: center;
    align-items: center;
}



/* =========================================
   RESPONSIVE DESIGN (MOBILE & TABLET)
   ========================================= */

/* Dispositivos Medianos (Tablets y móviles en horizontal) - Hasta 768px */
@media (max-width: 768px) {
    /* Ajuste del Header */
    header {
        display: flex;
        flex-direction: column;
        text-align: center;
        padding: 15px;
        position: relative;
    }
    
    header h1 {
        font-size: 22px;
        margin-top: 30px;
    }

    header p {
        font-size: 12px;
    }

    header .btn-logout {
        position: absolute;
        top: 15px;
        right: 15px;
        font-size: 12px;
        padding: 6px 12px;
    }

    /* Pestañas (Tabs) adaptables */
    .tabs {
        flex-wrap: wrap; /* Permite que las pestañas bajen a la siguiente línea */
        gap: 8px;
        padding: 0 10px;
        justify-content: center;
    }

    .tab-btn {
        flex: 1 1 calc(33% - 10px); /* Que ocupen el ancho disponible de forma equitativa */
        font-size: 14px;
        padding: 10px 5px;
    }

    /* Ajuste de Formularios y Filas de Planetas */
    .planet-row {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        background: var(--input-bg);
        padding: 12px;
        border-radius: 8px;
        margin-bottom: 15px;
        gap: 10px;
    }

    .planet-row select, 
    .planet-row input {
        width: 100%; /* Ocupar todo el ancho en móviles */
    }

    /* Contenedores Principales */
    .card {
        padding: 20px 15px;
        margin: 10px;
    }

    /* Modales y Cosmograma */
    .modal-box, 
    .mapa-container {
        width: 95%;
        padding: 20px 15px;
        margin: 10px auto;
        max-height: 90vh; /* Evita que el modal sea más alto que la pantalla */
        overflow-y: auto; /* Permite hacer scroll interno si el contenido es muy largo */
    }

    /* Asegurar que el SVG se encoja correctamente */
    #canvas-astral-holder {
        width: 100%;
        height: auto;
    }
    
    #canvas-astral-holder svg {
        width: 100%;
        height: auto;
        max-width: 100%;
    }
}

/* Dispositivos Pequeños (Móviles en vertical) - Hasta 480px */
@media (max-width: 480px) {
    /* Caja de Login */
    .login-box {
        width: 90%;
        padding: 25px 20px;
    }

    .tab-btn {
        flex: 1 1 100%; /* Pestañas apiladas una sobre otra en pantallas muy pequeñas */
    }

    /* Notificaciones Toast flotantes */
    .toast {
        width: 90%;
        text-align: center;
        font-size: 13px;
        padding: 10px 15px;
    }
}