/* =============================================================================
   SPACE EVENTS CALENDAR — v1.2.0
   ============================================================================= */

/* =============================================================================
   CALENDARIO (Space Calendar Widget)
   ============================================================================= */

.space-cal {
    font-family: inherit;
    width: 100%;
    max-width: 340px;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

/* Header ------------------------------------------------------------------- */

.space-cal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 8px;
}

.space-cal__header-title {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
    font-size: 1.1em;
    white-space: nowrap;
}

.space-cal__header-caret {
    font-size: 0.85em;
    line-height: 1;
    margin-top: 2px;
}

.space-cal__nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.6em;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background-color 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.space-cal__nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

/* Griglia ------------------------------------------------------------------ */

.space-cal__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}

.space-cal__labels-row {
    margin-bottom: 2px;
}

.space-cal__day-label {
    font-size: 0.72em;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 0 6px;
}

/* Celle giorno ------------------------------------------------------------- */

.space-cal__day {
    padding: 2px 0;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.space-cal__day-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 0.88em;
    transition: background-color 0.15s;
    position: relative;
    line-height: 1;
    gap: 2px;
}

.space-cal__day:not(.space-cal__day--other-month):hover .space-cal__day-inner {
    background-color: rgba(255, 255, 255, 0.14);
}

.space-cal__day--other-month {
    cursor: default;
    pointer-events: none;
}

.space-cal__day--today .space-cal__day-inner {
    font-weight: 700;
}

/* Punto / sottolineatura eventi -------------------------------------------- */

.space-cal__event-dot {
    display: block;
    width: 14px;
    height: 3px;
    border-radius: 2px;
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

/* Pannello "nessun evento" nel mini calendario ----------------------------- */

.space-cal__no-events {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 13px 15px;
    border-radius: 10px;
}

.space-cal__no-events-icon {
    flex-shrink: 0;
    opacity: 0.65;
    display: flex;
    align-items: center;
}

.space-cal__no-events p {
    margin: 0;
    font-size: 0.875em;
    line-height: 1.45;
}

/* Mini anteprima evento ---------------------------------------------------- */

.space-cal__mini-preview {
    margin-top: 14px;
    padding: 14px 14px 12px;
    border-radius: 10px;
}

.space-cal__mini-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.space-cal__mini-date {
    font-size: 0.78em;
    font-weight: 600;
    white-space: nowrap;
    text-transform: capitalize;
}

.space-cal__mini-line {
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.space-cal__mini-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 6px 0;
}

.space-cal__mini-item + .space-cal__mini-item {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.space-cal__mini-thumb {
    width: 62px;
    height: 62px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
}

.space-cal__mini-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.space-cal__mini-info { flex: 1; min-width: 0; }

.space-cal__mini-title {
    font-size: 0.95em;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.space-cal__mini-title a { color: inherit; text-decoration: none; }
.space-cal__mini-title a:hover { text-decoration: underline; }

.space-cal__mini-excerpt {
    font-size: 0.76em;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Footer ------------------------------------------------------------------- */

.space-cal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.space-cal__footer-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8em;
    text-decoration: none;
    transition: color 0.18s, opacity 0.18s;
    white-space: nowrap;
}

.space-cal__footer-link:hover {
    text-decoration: none;
    opacity: 1 !important;
}

/* =============================================================================
   EVENTS DISPLAY (Space Events Display Widget)
   ============================================================================= */

.space-events {
    width: 100%;
}

.space-events__inner {
    width: 100%;
}

/* ── Spinner di caricamento ─────────────────────────────────────────────── */

.space-events__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.space-events__spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(0, 0, 0, 0.12);
    border-top-color: #d32f2f;
    border-radius: 50%;
    animation: spaceSpinnerRotate 0.7s linear infinite;
}

@keyframes spaceSpinnerRotate {
    to { transform: rotate(360deg); }
}

/* ── Titolo di sezione ──────────────────────────────────────────────────── */

.space-events__section-title {
    font-size: 1.5em;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 20px;
    color: #1a1a1a;
}

/* ── Messaggio "nessun evento" ──────────────────────────────────────────── */

.space-events__no-events-wrap {
    padding: 0 0 28px;
}

.space-events__no-events-msg {
    font-size: 1em;
    line-height: 1.6;
    color: #666;
    margin: 0;
}

/* ── Griglia card ───────────────────────────────────────────────────────── */

.space-events__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    align-items: start;
}

/* ── Card ───────────────────────────────────────────────────────────────── */

.space-events__card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: spaceCardIn 0.35s ease both;
}

.space-events__card:hover {
    transform: translateY(-4px);
}

@keyframes spaceCardIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Immagine ----------------------------------------------------------------- */

.space-events__card-img-wrap {
    width: 100%;
    padding-bottom: 56.25%;
    position: relative;
    overflow: hidden;
    background: #ebebeb;
    flex-shrink: 0;
}

.space-events__card-img-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.space-events__card:hover .space-events__card-img-wrap img {
    transform: scale(1.04);
}

.space-events__img-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.2;
}

.space-events__img-placeholder svg {
    width: 40px;
    height: 40px;
    stroke: #888;
}

/* Corpo -------------------------------------------------------------------- */

.space-events__card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.space-events__date {
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #d32f2f;
}

.space-events__title {
    font-size: 1.3em;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
    color: #d32f2f;
}

.space-events__title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.18s;
}

.space-events__title a:hover {
    text-decoration: none;
}

.space-events__excerpt {
    font-size: 0.875em;
    line-height: 1.65;
    flex: 1;
    margin: 0;
    color: #555;
}

.space-events__btn {
    display: inline-block;
    margin-top: 10px;
    padding: 14px 30px;
    background-color: #5c1010;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875em;
    border-radius: 50px;
    transition: background-color 0.22s ease, color 0.22s ease, transform 0.15s ease;
    align-self: flex-start;
    white-space: nowrap;
}

.space-events__btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 900px) {
    .space-events__grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .space-cal {
        max-width: 100%;
    }
    .space-cal__day-inner {
        width: 30px;
        height: 30px;
    }
    .space-events__section-title {
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    .space-cal__day-inner {
        width: 26px;
        height: 26px;
        font-size: 0.8em;
    }
    .space-cal__footer-link {
        font-size: 0.72em;
    }
}
