/* ==========================================
   CONFIGURACIÓ GENERAL I RESETEO
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background-color: #f4f6f9;
    padding: 20px;
}

.calendar-container {
    max-width: 1050px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* ==========================================
   ENCAPÇALAMENT SUPERIOR
   ========================================== */
.calendar-header {
    background: linear-gradient(135deg, #ff7e5f, #feb47b);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.calendar-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.calendar-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 10px 15px;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s, transform 0.1s;
}

.calendar-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.calendar-btn:active {
    transform: scale(0.95);
}

/* ==========================================
   ORGANITZACIÓ DEL COS
   ========================================== */
.calendar-body {
    display: flex;
    width: 100%;
}

.calendar-main-grid {
    flex: 1;
}

/* ==========================================
   GRAELLA DEL CALENDARI DE 7 COLUMNES
   ========================================== */
.weekdays, .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.weekdays {
    background: #f1f1f1;
    text-align: center;
    font-weight: bold;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
    align-items: center;
}

.weekdays h4 {
    display: block;
    font-size: 0.9rem;
    color: #495057;
}

.weekdays abbr {
    display: none;
}

.calendar-grid {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Caselles de dies individuals */
.calendar-day {
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    min-height: 115px;
    padding: 10px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.calendar-day h3 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 2px;
}

.calendar-day-hidden {
    visibility: hidden;
}

a {
    color: #ffffff; /* El color verd que prefereixis */
    text-decoration: none; /* Treu el subratllat */
}

/* Estil quan es passa el ratolí per sobre (hover) */
a:hover {
    text-decoration: underline; /* Afegeix el subratllat al fer hover */
}

/* ==========================================
   CLASSES D'EVENTS (ETIQUETES I TEXTOS)
   ========================================== */
.text-red { color: #e53935 !important; font-weight: bold; }
.text-black { color: #000000 !important; font-weight: bold; }
.text-green { color: #2e7d32 !important; font-weight: bold; } /* Número de dia en verd */

.db-event-badge {
    font-size: 0.72rem;
    padding: 4px 6px;
    border-radius: 4px;
    line-height: 1.2;
    word-break: break-word;
    display: block;
}

/* Estils generals per als enllaços dins les etiquetes */
.db-event-badge a {
    color: inherit; 
    text-decoration: underline;
    font-weight: bold;
}

/* Colors de fons i vores de les etiquetes */
.badge-red { background-color: #ffebee; color: #c62828; border-left: 3px solid #e53935; }
.badge-black { background-color: #f5f5f5; color: #212121; border-left: 3px solid #000000; }
.badge-green { background-color: #e8f5e9; color: #1b5e20; border-left: 3px solid #4caf50; } /* Etiqueta Verda */


/* ==========================================
   RESPONSIVE (ADAPTACIÓ PER A MÒBILS)
   ========================================== */
@media (max-width: 700px) {
    body {
        padding: 5px;
    }

    .calendar-header {
        padding: 12px;
    }

    .calendar-title {
        font-size: 1.1rem;
    }

    .calendar-btn {
        padding: 6px 12px;
        font-size: 1rem;
    }

    .weekdays h4 { display: none; }
    .weekdays abbr { display: block; font-size: 0.8rem; color: #495057; text-decoration: none; }
    
    .calendar-day { 
        min-height: 70px; 
        padding: 4px; 
        align-items: center;
        justify-content: flex-start;
    }

    .calendar-day h3 {
        font-size: 0.9rem;
    }
    
    /* Transformació de les cel·les per a dispositius mòbils en indicadors compactes (punts) */
    .db-event-badge { 
        font-size: 0;
        padding: 0;
        height: 8px;
        width: 8px;
        margin: 2px auto 0 auto;
        border-radius: 50%;
        border-left: none; 
        display: inline-block;
    }
    
    .badge-red { background-color: #e53935; }
    .badge-black { background-color: #000000; }
    .badge-green { background-color: #4caf50; } /* Punt verd en mòbils */
}

