:root {
    /* Fondos */
    --bg-color: #0d0d0f;
    /* Fondo principal de la app (Casi negro) */
    --surface-color: #1a1a1f;
    /* Fondo de tarjetas o paneles */
    --surface-color-hover: #23232a;
    /* Fondo en hover para elementos interactivos */

    /* Textos */
    --text-primary: #f0f0f5;
    /* Texto principal (Casi blanco) */
    --text-secondary: #a0a0ab;
    /* Texto secundario, descripciones y subtítulos (Gris plata) */

    /* Bordes */
    --border-color: #2a2a35;
    /* Color sutil para separar tarjetas y paneles */

    /* Colores de Acento (Elegantes y apagados) */
    --accent-blue: #4a88cc;
    /* Color principal para botones y resaltados */
    --accent-blue-hover: #5b9ce0;
    /* Azul ligeramente más claro para hover */

    /* Estados y Similitudes */
    --similarity-high: #4acc88;
    /* Verde para éxito / alta similitud */
    --similarity-med: #ccaa4a;
    /* Amarillo/Dorado para advertencia / similitud media */
    --similarity-low: #cc4a4a;
    /* Rojo para error / baja similitud / peligro */

    /* Variables Globales Visuales */
    --border-radius: 8px;
    --transition-speed: 0.3s;
}

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

/* Custom Scrollbar for the dark theme */
::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-color);
    border-radius: var(--border-radius);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--border-radius);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue-hover);
}



body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    padding: 2rem 1rem;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    margin-bottom: 2rem;
    text-align: center;
}

h1 {
    font-weight: 300;
    background: linear-gradient(135deg, #ffffff 0%, #a0a0ab 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-weight: 300;
    font-size: 1.1rem;
}

.card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.input-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: center;
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 300;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input[type="number"],
input[type="text"] {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 0.5rem;
    border-radius: var(--border-radius);
    font-family: var(--font-mono, 'Inter', monospace);
    font-size: 1.1rem;
    outline: none;
    transition: all var(--transition-speed);
    width: 80px;
    /* Small width for numbers */
    text-align: center;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
    /* Remove arrows */
}

/* Remove arrows in WebKit/Blink (Chrome/Safari/Edge) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"]:focus,
input[type="text"]:focus {
    border-color: var(--accent-blue);
}

.month-durations-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    max-width: 650px;
    /* Forces wrap after 6 elements (approx 80px + gaps each) */
    margin-left: auto;
    margin-right: auto;
}

.actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all var(--transition-speed);
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--accent-blue-hover);
    box-shadow: 0 4px 12px rgba(74, 136, 204, 0.3);
}

.btn-secondary {
    background-color: transparent;
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
}

.btn-secondary:hover {
    background-color: rgba(74, 136, 204, 0.1);
    box-shadow: 0 4px 12px rgba(74, 136, 204, 0.15);
}

/* Calendar Display */
.calendar-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 2rem;
}

.calendar-info {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 0;
    background: linear-gradient(145deg, var(--surface-color), #111115);
    border: 1px solid rgba(74, 136, 204, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.calendar-info .info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.calendar-info .info-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
}

.calendar-info .info-value {
    font-size: 1.8rem;
    font-weight: 300;
    color: var(--text-primary);
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.1);
}

.calendar-info .info-value.highlight {
    color: var(--accent-blue);
    text-shadow: 0 0 15px rgba(74, 136, 204, 0.4);
    font-weight: 400;
}

.month-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    overflow-x: auto;
}

.month-card h2 {
    font-weight: 400;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-align: center;
}

.days-grid {
    display: grid;
    gap: 2px;
    min-width: max-content;
    /* Ensure the grid expands beyond the card container if needed */
}

.day-header {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.day-cell {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    aspect-ratio: 1;
    /* Make cells square */
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all var(--transition-speed);
    font-weight: 400;
    font-size: 1.1rem;
    color: var(--text-primary);
    user-select: none;
}

.day-cell:hover:not(.empty) {
    transform: scale(0.95);
    background-color: var(--surface-color-hover);
    border-color: rgba(74, 136, 204, 0.3);
}

.day-cell.empty {
    background: transparent;
    border: none;
    cursor: default;
}

/* Normal Highlight (Yellow) */
.day-cell.highlighted[data-moon="none"] {
    border-color: var(--similarity-med);
    background-color: rgba(204, 170, 74, 0.15);
    box-shadow: 0 0 15px rgba(204, 170, 74, 0.4);
    color: var(--similarity-med);
    font-weight: 600;
}

.day-cell.highlighted[data-moon="none"]:hover {
    transform: scale(1.05);
}

/* Moon Phase Highlights */
.day-cell[data-moon="new"] {
    border-color: var(--accent-blue);
    background-color: rgba(74, 136, 204, 0.15);
    box-shadow: 0 0 15px rgba(74, 136, 204, 0.4);
    color: var(--accent-blue);
    font-weight: 600;
}

.day-cell[data-moon="new"]:hover {
    transform: scale(1.05);
    /* Glow pop effect on hover */
}

.day-cell[data-moon="full"] {
    border-color: #f0f0f5;
    background-color: rgba(240, 240, 245, 0.15);
    box-shadow: 0 0 15px rgba(240, 240, 245, 0.4);
    color: #f0f0f5;
    font-weight: 600;
}

.day-cell[data-moon="full"]:hover {
    transform: scale(1.05);
}

/* Moon Icons */
.moon-icon {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    pointer-events: none;
    /* Let clicks pass through to the day cell */
}

.moon-new {
    background-color: var(--bg-color);
    border: 2px solid var(--accent-blue);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.8);
}

.moon-full {
    background-color: #fff;
    border: 2px solid #a0a0ab;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

/* Context Menu */
.context-menu {
    position: absolute;
    z-index: 1000;
    width: 200px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    padding: 0.5rem 0;
    transition: opacity 0.2s;
}

.context-menu.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.context-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.context-menu li {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color var(--transition-speed);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.context-menu li:hover {
    background-color: var(--surface-color-hover);
    color: #fff;
}

.context-menu li.hidden {
    display: none;
}

.context-menu .separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
    padding: 0;
    cursor: default;
}



/* Help Button & Modal */
.help-btn {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--surface-color);
    border: 2px solid var(--accent-blue);
    color: var(--accent-blue);
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 999;
    transition: all var(--transition-speed);
}

.help-btn:hover {
    background-color: var(--accent-blue);
    color: #fff;
    box-shadow: 0 0 20px rgba(74, 136, 204, 0.6);
    transform: scale(1.1);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 13, 15, 0.85);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    position: relative;
    max-width: 550px;
    width: 90%;
    margin: 0;
    /* Override .card margin */
    padding: 2.5rem 3rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.modal.hidden .modal-content {
    transform: translateY(-20px);
}

.modal-content h2 {
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 2rem;
    font-size: 1.8rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.help-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.help-list li {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.8;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    background-color: var(--bg-color);
    padding: 1.25rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.help-list li strong {
    color: var(--accent-blue);
    font-weight: 500;
}

.help-list .highlight-icon {
    font-size: 1.8rem;
    margin-top: 0;
    background-color: var(--surface-color);
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Responsive Design for Mobile Devices */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .card {
        padding: 1rem;
    }

    .input-grid {
        gap: 1.5rem;
    }

    .input-group {
        width: 100%;
        /* Take full width on mobile for larger touch areas */
    }

    input[type="number"] {
        width: 100%;
        max-width: 150px;
        /* Keep them somewhat constrained but larger than 80px */
    }

    .month-durations-grid {
        gap: 1rem;
        justify-content: space-around;
        padding-top: 1rem;
    }

    .calendar-container {
        grid-template-columns: 1fr;
        /* Stack months vertically on mobile */
        gap: 1.5rem;
    }

    .month-card {
        padding: 1rem;
    }

    .day-cell {
        min-height: 40px;
        /* Make cells smaller for mobile */
        font-size: 0.95rem;
    }

    .moon-icon {
        width: 14px;
        height: 14px;
        bottom: 4px;
        right: 4px;
    }

    /* Modal Mobile Adjustments */
    .modal-content {
        padding: 1.5rem 1rem;
        width: 95%;
    }

    .modal-content h2 {
        font-size: 1.4rem;
        margin-bottom: 1.5rem;
    }

    .help-list {
        gap: 1rem;
    }

    .help-list li {
        font-size: 0.95rem;
        padding: 1rem;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .help-list .highlight-icon {
        margin-bottom: 0.5rem;
    }

    .help-btn {
        bottom: 1.5rem;
        left: 1.5rem;
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }
}

/* Score UI Elements */
.btn-info {
    background-color: var(--similarity-med);
    color: #fff;
}

.btn-info:hover {
    background-color: #e0bb55;
    box-shadow: 0 4px 12px rgba(204, 170, 74, 0.3);
}

.scoring-results {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--surface-color);
    border: 1px solid var(--similarity-high);
    border-radius: var(--border-radius);
    text-align: left;
    transition: opacity var(--transition-speed);
}

.scoring-results.hidden {
    display: none;
}

.score-header h3 {
    color: var(--text-primary);
    font-weight: 400;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.score-header span {
    font-weight: 600;
    color: var(--similarity-high);
}

.score-hints {
    list-style-type: disc;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.score-hints li {
    margin-bottom: 0.5rem;
}

.score-hints li.perfect {
    color: var(--similarity-high);
}