/* ============================================================
   CALENDARIO LUNAR — Azul noche / plateado lunar
   Fuentes: Cormorant Garamond (títulos) + DM Sans (UI)
   ============================================================ */

/* Variables */
:root {
    --bg-deep:       #050a14;
    --bg-card:       #0a1628;
    --bg-card2:      #0d1e35;
    --bg-hover:      #122240;
    --border:        rgba(148, 192, 234, 0.12);
    --border-bright: rgba(148, 192, 234, 0.28);

    --silver:        #c8dff2;
    --silver-dim:    #8aaec8;
    --silver-faint:  rgba(200, 223, 242, 0.35);
    --white:         #f0f6ff;
    --gold-moon:     #f5d76e;
    --blue-accent:   #4a9edd;
    --blue-glow:     rgba(74, 158, 221, 0.18);

    --phase-full:    #f5d76e;
    --phase-new:     #1a2e4a;
    --phase-quarter: #8aaec8;
    --phase-crescent:#c8dff2;

    --today-ring:    #4a9edd;
    --today-bg:      rgba(74, 158, 221, 0.15);

    --font-title:    'Cormorant Garamond', serif;
    --font-ui:       'DM Sans', sans-serif;

    --radius:        12px;
    --radius-sm:     8px;
    --transition:    0.22s ease;
}

/* Reset mínimo */
#calendario-lunar-app *,
#calendario-lunar-app *::before,
#calendario-lunar-app *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#calendario-lunar-app {
    background: var(--bg-deep);
    min-height: 100vh;
    font-family: var(--font-ui);
    color: var(--silver);
    padding: 0 0 60px 0;
    position: relative;
    overflow-x: hidden;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Fondo de estrellas (canvas) */
#cl-stars-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

.cl-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================
   ENCABEZADO
   ============================================================ */
.cl-header {
    text-align: center;
    padding: 44px 0 32px;
}

.cl-header-deco {
    font-size: 22px;
    letter-spacing: 14px;
    color: var(--silver-dim);
    opacity: 0.55;
    margin-bottom: 12px;
    display: block;
}

.cl-title {
    font-family: var(--font-title);
    font-size: clamp(32px, 6vw, 56px);
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--white);
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: 8px;
}

.cl-subtitle {
    font-family: var(--font-title);
    font-style: italic;
    font-size: clamp(14px, 2.5vw, 18px);
    color: var(--silver-dim);
    letter-spacing: 0.12em;
}

.cl-header-line {
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-bright), transparent);
    margin: 16px auto 0;
}

/* ============================================================
   TARJETA HOY
   ============================================================ */
.cl-today-card {
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: 32px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 28px;
    position: relative;
    overflow: hidden;
}

.cl-today-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(74,158,221,0.06) 0%, transparent 60%);
    pointer-events: none;
}

/* Luna animada grande */
.cl-big-moon {
    width: 88px;
    height: 88px;
    flex-shrink: 0;
}

/* Info de hoy */
.cl-today-info {}

.cl-today-date {
    font-family: var(--font-title);
    font-size: clamp(15px, 2.5vw, 18px);
    color: var(--silver-dim);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.cl-today-phase-name {
    font-family: var(--font-title);
    font-size: clamp(22px, 4vw, 32px);
    color: var(--white);
    font-weight: 600;
    line-height: 1.1;
    margin-bottom: 6px;
}

.cl-today-illumination {
    font-size: 13px;
    color: var(--silver-dim);
    letter-spacing: 0.06em;
}

.cl-today-illumination span {
    color: var(--gold-moon);
    font-weight: 600;
}

/* Zodiac badge */
.cl-zodiac-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(148,192,234,0.07);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    min-width: 90px;
    text-align: center;
}

.cl-zodiac-symbol {
    font-size: 26px;
    line-height: 1;
}

.cl-zodiac-name {
    font-size: 11px;
    color: var(--silver-dim);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ============================================================
   PRÓXIMOS EVENTOS
   ============================================================ */
.cl-events-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.cl-event-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 40px;
    padding: 8px 16px 8px 10px;
    font-size: 13px;
    color: var(--silver-dim);
    flex: 1;
    min-width: 160px;
}

.cl-event-moon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.cl-event-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--silver-dim);
    opacity: 0.6;
    display: block;
    line-height: 1;
    margin-bottom: 2px;
}

.cl-event-date {
    color: var(--silver);
    font-weight: 500;
    font-size: 13px;
    line-height: 1.2;
}

/* ============================================================
   CALENDARIO MENSUAL
   ============================================================ */
.cl-calendar-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

/* Navegación de mes */
.cl-cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card2);
}

.cl-nav-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--silver-dim);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-family: var(--font-ui);
}

.cl-nav-btn:hover {
    border-color: var(--blue-accent);
    color: var(--white);
    background: var(--blue-glow);
}

.cl-cal-month-title {
    font-family: var(--font-title);
    font-size: clamp(18px, 3vw, 24px);
    font-weight: 600;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-align: center;
}

/* Días de la semana */
.cl-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
}

.cl-weekday {
    text-align: center;
    padding: 10px 4px;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--silver-dim);
    opacity: 0.55;
}

/* Grid de días */
.cl-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
}

.cl-day {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    min-height: 72px;
    padding: 8px 6px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: default;
    transition: background var(--transition);
    position: relative;
}

.cl-day:nth-child(7n) {
    border-right: none;
}

.cl-day.empty {
    background: transparent;
    opacity: 0.2;
}

.cl-day:not(.empty):hover {
    background: var(--bg-hover);
}

.cl-day.today {
    background: var(--today-bg);
}

.cl-day.today .cl-day-num {
    background: var(--today-ring);
    color: var(--white);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cl-day-num {
    font-size: 12px;
    color: var(--silver);
    font-weight: 500;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cl-day.other-month .cl-day-num {
    opacity: 0.25;
}

/* Icono de luna en cada día */
.cl-day-moon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

/* Etiqueta de evento (luna llena/nueva) */
.cl-day-event {
    font-size: 9px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.2;
    max-width: 52px;
}

.cl-day-event.full {
    color: var(--gold-moon);
}

.cl-day-event.new {
    color: var(--blue-accent);
}

.cl-day-event.quarter {
    color: var(--silver-dim);
}

/* ============================================================
   LEYENDA
   ============================================================ */
.cl-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-card2);
}

.cl-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--silver-dim);
}

.cl-legend-moon {
    width: 20px;
    height: 20px;
}

/* ============================================================
   LUNA SVG — Renderizado
   ============================================================ */
/* (Las lunas se dibujan en JS con SVG) */

/* ============================================================
   TOOLTIP de día
   ============================================================ */
.cl-day-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #0d1e35;
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--silver);
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.cl-day:hover .cl-day-tooltip {
    opacity: 1;
}

.cl-day-tooltip strong {
    display: block;
    color: var(--white);
    margin-bottom: 2px;
    font-family: var(--font-title);
    font-size: 13px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    .cl-today-card {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        padding: 20px;
        gap: 16px;
    }

    .cl-zodiac-badge {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: center;
        gap: 10px;
        min-width: unset;
    }

    .cl-day {
        min-height: 52px;
        padding: 5px 2px 4px;
    }

    .cl-day-moon {
        width: 22px;
        height: 22px;
    }

    .cl-day-event {
        font-size: 8px;
    }

    .cl-events-bar {
        flex-direction: column;
    }

    .cl-cal-nav {
        padding: 14px 16px;
    }

    .cl-legend {
        gap: 12px;
        padding: 16px;
    }
}

@media (max-width: 400px) {
    .cl-day {
        min-height: 44px;
    }
    .cl-day-moon {
        width: 18px;
        height: 18px;
    }
    .cl-weekday {
        font-size: 9px;
    }
}

/* ============================================================
   ANIMACIONES
   ============================================================ */
@keyframes cl-fade-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cl-header    { animation: cl-fade-in 0.6s ease both; }
.cl-today-card{ animation: cl-fade-in 0.6s 0.1s ease both; }
.cl-events-bar{ animation: cl-fade-in 0.6s 0.2s ease both; }
.cl-calendar-section { animation: cl-fade-in 0.6s 0.3s ease both; }

/* Pulso en la luna de hoy */
@keyframes cl-moon-pulse {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(245,215,110,0.4)); }
    50%       { filter: drop-shadow(0 0 16px rgba(245,215,110,0.8)); }
}

.cl-big-moon svg {
    animation: cl-moon-pulse 3.5s ease-in-out infinite;
}

/* Transición al cambiar mes */
.cl-days-grid.cl-anim-out {
    opacity: 0;
    transform: translateX(-12px);
    transition: opacity 0.15s, transform 0.15s;
}

.cl-days-grid.cl-anim-in {
    opacity: 0;
    transform: translateX(12px);
}

.cl-days-grid {
    transition: opacity 0.2s, transform 0.2s;
}
