/* --- GOOGLE FONTS IMPORT --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

/* --- PALETA DE COLORES Y VARIABLES GLOBALES --- */
:root {
    --font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    
    /* Fondo con degradado radial sutil */
    --bg-gradient-start: #0055aa;
    --bg-gradient-end: #12181f;

    /* Colores para paneles con efecto "Glassmorphism" */
    --panel-bg: rgba(31, 31, 31, 0.75);
    --panel-blur: backdrop-filter(blur(12px));
    --panel-border-color: rgba(129, 140, 153, 0.2);

    /* Paleta de colores de acento */
    --accent-primary: #22d3ee;  /* Cyan vibrante */
    --accent-secondary: #f59e0b; /* Ámbar/Dorado */
    --accent-purple: #a78bfa;   /* Lavanda */

    /* Colores funcionales para los días */
    --red-work-start: #ff2b4e;
    --red-work-end: #a71237;
    --green-free-start: #00d841;
    --green-free-end: #059629;

    /* Colores de texto */
    --text-primary: #f0f4f8;
    --text-secondary: #94a3b8;
    --text-headers: #ffffff;
    
    /* Tamaños y espaciados */
    --sidebar-width: 310px;
    --header-height: 80px;
    --border-radius-main: 16px;
    --border-radius-sub: 10px;
}

/* --- ESTILOS BASE Y DE FONDO --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    background-color: var(--bg-gradient-end);
    background-image: radial-gradient(ellipse at center, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- SIDEBAR RE-DISEÑADO --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--panel-bg);
    -webkit-backdrop-filter: var(--panel-blur);
    backdrop-filter: var(--panel-blur);
    padding: 30px;
    border-right: 1px solid var(--panel-border-color);
    display: flex;
    flex-direction: column;
    gap: 30px;
    flex-shrink: 0;
    z-index: 1100;
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
}
.sidebar-overlay {
    display: none; position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1050;
}
.sidebar h2 {
    color: var(--text-headers);
    text-align: center;
    font-size: 1.8em;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}
.sidebar-section {
    background: rgba(0,0,0,0.2);
    padding: 25px;
    border-radius: var(--border-radius-main);
    border: 1px solid var(--panel-border-color);
    border-top: 1px solid rgba(34, 211, 238, 0.5);
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.sidebar-section h3 {
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 1.25em;
    font-weight: 600;
}
.sidebar label {
    font-size: 0.95em;
    color: var(--text-secondary);
    font-weight: 400;
}
.form-control {
    width: 100%; padding: 12px 15px;
    border: 1px solid var(--panel-border-color);
    border-radius: var(--border-radius-sub);
    background-color: rgba(17, 24, 39, 0.8);
    color: var(--text-primary);
    font-size: 1em;
    font-family: inherit;
    transition: all 0.2s ease;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.2);
}
.help-text { font-size: 0.85em; color: var(--text-secondary); opacity: 0.8; }

/* --- BOTONES CON DEGRADADOS Y ESTILO PREMIUM --- */
.btn {
    display: flex; align-items: center; justify-content: center;
    width: 100%; padding: 14px 15px;
    border: 1px solid transparent;
    border-radius: var(--border-radius-sub);
    cursor: pointer;
    font-size: 1em; font-weight: 600;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    transition: all 0.2s ease-out; /* <-- MEJORA: Transición para todos los efectos */
}
.btn .fas { margin-right: 10px; font-size: 1.1em; }
.btn-primary { background-image: linear-gradient(to right, #22d3ee, #0ea5e9); border-color: #22d3ee; }
.btn-success { background-image: linear-gradient(to right, #34d399, #10b981); border-color: #34d399; }
.btn-info    { background-image: linear-gradient(to right, #a78bfa, #8b5cf6); border-color: #a78bfa; }
.btn-danger  { background-image: linear-gradient(to right, #f43f5e, #e11d48); border-color: #f43f5e; }
.btn-warning { background-image: linear-gradient(to right, #f59e0b, #d97706); border-color: #f59e0b; }

/* <-- MEJORA: Estilos HOVER y ACTIVE para los botones --> */
.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    filter: brightness(1.15); /* Aumenta el brillo del degradado */
}
.btn:active {
    transform: translateY(-1px);
    filter: brightness(1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.color-legend { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 5px; }
.legend-item { display: flex; align-items: center; font-size: 0.9em; }
.color-box { width: 22px; height: 22px; border-radius: 6px; margin-right: 8px; }
.color-box.red { background-image: linear-gradient(var(--red-work-start), var(--red-work-end)); }
.color-box.green { background-image: linear-gradient(var(--green-free-start), var(--green-free-end)); }

/* --- CONTENIDO PRINCIPAL Y CABECERA DEL AÑO --- */
.main-content { flex-grow: 1; }
.calendar-header {
    display: flex; justify-content: center; align-items: center;
    padding: 0 30px; gap: 25px;
    height: var(--header-height);
}
.calendar-header h1 {
    font-size: 3em; font-weight: 700; color: transparent;
    background-clip: text; -webkit-background-clip: text;
    background-image: linear-gradient(to right, #e0e7ff, #c7d2fe);
    text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}
.nav-button {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--panel-border-color);
    padding: 10px 16px;
    border-radius: var(--border-radius-sub);
    cursor: pointer;
    font-size: 1.5em;
    transition: all 0.2s ease; /* <-- MEJORA: Transición para el hover */
}
/* <-- MEJORA: Estilo HOVER para botones de navegación --> */
.nav-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(129, 140, 153, 0.4);
}
.hamburger-button { display: none; }

/* --- CUADRÍCULA DE MESES CON ESTILO DE TARJETA --- */
#calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 35px;
    padding: 35px;
}
.month {
    background: var(--panel-bg);
    -webkit-backdrop-filter: var(--panel-blur);
    backdrop-filter: var(--panel-blur);
    border-radius: var(--border-radius-main);
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid transparent;
    border-image: linear-gradient(to bottom right, var(--panel-border-color), rgba(0,0,0,0)) 1;
    transition: all 0.3s ease; /* <-- MEJORA: Transición para el hover */
}
/* <-- MEJORA: Estilo HOVER para las tarjetas de mes --> */
.month:hover {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    border-image: linear-gradient(to bottom right, var(--accent-primary), rgba(0,0,0,0)) 1;
}
.month-header {
    width: 100%; display: flex; justify-content: space-between;
    align-items: baseline; margin-bottom: 20px;
    border-bottom: 1px solid var(--panel-border-color);
    padding-bottom: 15px;
}
.month-header h2 { font-size: 1.8em; color: var(--text-headers); font-weight: 600; }
.month-counters { font-size: 0.85em; color: var(--text-secondary); }

/* --- DÍAS DEL CALENDARIO --- */
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); width: 100%; margin-bottom: 15px; }
.weekday { text-align: center; font-weight: 600; color: var(--accent-primary); font-size: 0.9em; }
.days-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; width: 100%; }
.day {
    width: 100%; aspect-ratio: 1 / 1;
    display: flex; justify-content: center; align-items: center;
    border-radius: 50%; cursor: pointer; font-weight: 600;
    border: 1px solid transparent; font-size: 1em;
    transition: all 0.2s ease; /* <-- MEJORA: Transición para todos los efectos del día */
}
/* <-- MEJORA: Estilo HOVER para los días del calendario --> */
.day:not(.outside-month):not(.work):not(.free):hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}
.day.today {
    border-color: #eeff00;
    box-shadow: 0 0 15px rgba(251, 255, 0, 0.918);
    color: var(--accent-secondary);
    font-size: 1.1em;
}
.day.outside-month { color: #4b5563; pointer-events: none; }
.day.work {
    background-image: linear-gradient(135deg, var(--red-work-start), var(--red-work-end));
    color: white; text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
}
.day.free {
    background-image: linear-gradient(135deg, var(--green-free-start), var(--green-free-end));
    color: white; text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
}
/* <-- MEJORA: Efecto HOVER para los días de trabajo y libres --> */
.day.work:hover, .day.free:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    filter: brightness(1.2);
}


/* --- POPUP Y SPINNER --- */
.popup-message, .loader-overlay {
    position: fixed; opacity: 0; visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.popup-message {
    bottom: 20px; right: 20px;
    background: linear-gradient(to right, #1f2937, #374151);
    border: 1px solid var(--panel-border-color);
    padding: 14px 22px; border-radius: var(--border-radius-sub);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); z-index: 2000;
}
.popup-message.show, .loader-overlay.show { opacity: 1; visibility: visible; }
.loader-overlay {
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(17, 24, 31, 0.8);
    -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center; z-index: 3000;
}
.spinner {
    width: 60px; height: 60px;
    border: 6px solid rgba(34, 211, 238, 0.2);
    border-left-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- RESPONSIVE Y ESTILOS DE IMPRESIÓN --- */
@media (max-width: 768px) {
    .sidebar { position: fixed; top: 0; left: 0; height: 100vh; transform: translateX(-100%); }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-overlay.is-open { display: block; }
    .main-content { width: 100%; }
    .hamburger-button { display: block; }
    .calendar-header { justify-content: space-between; }
    .calendar-header h1 { font-size: 2.2em; }
    #calendar-grid { padding: 15px; gap: 15px; grid-template-columns: 1fr; }
    .month { padding: 20px; }
}

@media print {
    body { background: #fff !important; color: #000; }
    .sidebar, .calendar-header, .popup-message, .loader-overlay { display: none; }
    .main-content { height: auto; }
    #calendar-grid { display: block; padding: 0; }
    .month { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; margin-bottom: 20px; }
    .day { color: #000; }
    .day.work { background: var(--red-work-start) !important; color: #fff !important; }
    .day.free { background: var(--green-free-start) !important; color: #fff !important; }
    .day.today { border-color: var(--accent-secondary) !important; color: #000 !important; }
}