/* CSS per la barra di progresso indeterminata */
:root {
    --progress-bar-color: #007bff; /* Colore di default della barra */
    --progress-bar-height: 4px;   /* Spessore di default della barra */

    /* Calendario - Variabili personalizzabili */
    --jo-calendar-event-color: #28a745;
    --jo-calendar-today-bg: #e3f2fd;
    --jo-calendar-today-text: #0056b3;
    --jo-calendar-today-event-color: #0056b3;
    --jo-calendar-hover-bg: #d0e9fc;
}

.job-offer__search-progress {
    position: relative;
    width: 100%;
    height: var(--progress-bar-height);
    background-color: #f1f1f1; /* Colore di sfondo */
    overflow: hidden;
    display: none; /* La barra è nascosta di default */
}

.job-offer__search-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--progress-bar-color);
    transform: translateX(-100%);
    animation: indeterminate-progress 1.2s linear infinite;
}

@keyframes indeterminate-progress {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Classe per mostrare la barra */
.job-offer__search-progress.active {
    display: block;
}

/* ============================================
   CALENDARIO STYLES
   ============================================ */

.jo-calendar-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-width: 400px;
    margin: 0 auto;
}

/* Header del calendario */
.jo-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 10px;
}

.jo-calendar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #333;
    text-transform: capitalize;
}

.jo-calendar-nav {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jo-calendar-nav:hover {
    background-color: #f0f0f0;
}

.jo-calendar-nav:active {
    background-color: #e0e0e0;
}

.jo-calendar-nav svg {
    width: 20px;
    height: 20px;
}

/* Giorni della settimana */
.jo-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
    gap: 4px;
}

.jo-calendar-weekday {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    padding: 8px 4px;
    text-transform: uppercase;
}

/* Giorni del mese */
.jo-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 4px;
}

.jo-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background-color: #f9f9f9;
}

.jo-calendar-day:hover {
    background-color: #e8f4f8;
}

.jo-calendar-day.empty {
    background-color: transparent;
    cursor: default;
}

.jo-calendar-day.today {
    background-color: var(--jo-calendar-today-bg);
    color: var(--jo-calendar-today-text);
    font-weight: 600;
}

.jo-calendar-day.today:hover {
    background-color: var(--jo-calendar-hover-bg);
}

.jo-calendar-day .day-number {
    font-size: 0.95rem;
}

/* Indicatore di eventi */
.jo-calendar-day.has-events {
    cursor: pointer;
    position: relative;
}

.jo-calendar-day.has-events::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background-color: var(--jo-calendar-event-color);
    border-radius: 50%;
    z-index: 1;
}

.jo-calendar-day.today.has-events::after {
    background-color: var(--jo-calendar-today-event-color);
}

.jo-calendar-day.has-events:hover {
    background-color: var(--jo-calendar-hover-bg);
}

/* Tooltip */
.jo-calendar-tooltip {
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.jo-calendar-tooltip strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.jo-calendar-tooltip ul {
    margin: 0;
    padding-left: 20px;
    list-style: disc;
}

.jo-calendar-tooltip li {
    margin: 2px 0;
    line-height: 1.3;
}

/* Modal */
.jo-calendar-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jo-calendar-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.jo-calendar-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10001;
}

.jo-calendar-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.jo-calendar-modal-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

.jo-calendar-modal-title {
    margin: 0 0 20px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    padding-right: 40px;
}

.jo-calendar-event-item {
    padding: 16px;
    margin-bottom: 16px;
    background-color: #f9f9f9;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

.jo-calendar-event-item:last-child {
    margin-bottom: 0;
}

.jo-calendar-event-title {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.jo-calendar-event-description {
    margin: 0 0 12px 0;
    color: #555;
    line-height: 1.5;
}

.jo-calendar-event-location {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: #666;
}

.jo-calendar-event-dates {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
}

/* Loading state */
.jo-calendar-days.jo-calendar-loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.jo-calendar-days.jo-calendar-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #007bff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: calendar-spin 0.6s linear infinite;
}

@keyframes calendar-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* -----------------------------------------------------------------------
   Detail rendering (jo_detail shortcode)
   Struttura minima: layout, spacing, marker. Nessun colore/font/typography:
   tutto resta sovrascrivibile dal tema host via enqueue_custom_css.
   ----------------------------------------------------------------------- */

.jo-detail__section {
    margin: 0.5rem 0;
}

.jo-detail__section > .jo-detail__section-title {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.jo-detail__section > .jo-detail__section-title::-webkit-details-marker {
    display: none;
}

.jo-detail__section > .jo-detail__section-title::before {
    content: '\25B8';
    display: inline-block;
    transition: transform 0.15s ease-in-out;
}

.jo-detail__section[open] > .jo-detail__section-title::before {
    transform: rotate(90deg);
}

.jo-detail__section-body {
    padding: 0.25rem 0 0.25rem 1rem;
}

.jo-detail__section-description:empty {
    display: none;
}

.jo-detail__section-fields {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.jo-field {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.125rem;
}

.jo-field-label {
    margin: 0;
}

.jo-field-name {
    font-weight: bold;
}

.jo-field-description {
    display: block;
}

.jo-field-description:empty {
    display: none;
}

.jo-field-value {
    margin: 0;
}

.jo-field--unavailable {
    opacity: 0.6;
}

.jo-field-array {
    margin: 0;
    padding-left: 1.25rem;
}

.jo-field-array-item {
    margin: 0;
}

.jo-field-chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.jo-chip {
    display: inline-block;
    padding: 0.125rem 0.625rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    line-height: 1.4;
}

.jo-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.jo-table__cell {
    padding: 0.25rem 0.5rem;
    border: 1px solid currentColor;
    text-align: left;
    vertical-align: top;
}

.jo-table__cell--header {
    font-weight: bold;
}
