/**
 * Centro Studi Eventi - Frontend Styles
 * 
 * BEM methodology CSS for easy customization
 */

/* Events List Components */
.cse-eventi {
    margin: 1.5em 0;
}

.cse-eventi__message {
    padding: 1em;
    background: #f1f1f1;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.cse-eventi__list {
    display: grid;
    gap: 1.5em;
}

/* Individual Event Item */
.cse-evento {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    padding: 1.5em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.cse-evento:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.cse-evento--prossimi {
    border-left: 4px solid rgb(0, 103, 72);
}

.cse-evento--passati {
    border-left: 4px solid rgb(208, 19, 44);
    opacity: 0.9;
}

.cse-evento__thumbnail {
    margin-bottom: 1em;
}

.cse-evento__thumbnail img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.cse-evento__content {
    flex: 1;
}

.cse-evento__title {
    margin: 0 0 0.75em;
    font-size: 1.25em;
    font-weight: 600;
    line-height: 1.3;
}

.cse-evento__link {
    color: rgb(0, 103, 72);
    text-decoration: none;
    transition: all 0.3s ease;
}

.cse-evento__link:hover {
    color: rgb(0, 82, 54);
    text-decoration: underline;
}

.cse-evento__meta {
    margin-bottom: 1em;
    font-size: 0.9em;
    color: #666;
}

.cse-evento__date,
.cse-evento__location {
    margin-bottom: 0.5em;
}

.cse-evento__date strong,
.cse-evento__location strong {
    color: #333;
}

.cse-evento__excerpt {
    margin-bottom: 1em;
    line-height: 1.5;
}

.cse-evento__external {
    margin-top: 1em;
}

.cse-evento__external-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5em 1em;
    background: rgb(0, 103, 72);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.cse-evento__external-link:hover {
    background: rgb(208, 19, 44);
    color: white;
}

.cse-evento__external-link::after {
    content: ' ↗';
    margin-left: 0.5em;
}

/* Materials List */
.cse-materiali {
    margin: 1.5em 0;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1.5em;
}

.cse-materiali__title {
    margin: 0 0 1em;
    font-size: 1.1em;
    color: #495057;
    border-bottom: 2px solid rgb(0, 103, 72);
    padding-bottom: 0.5em;
}

.cse-materiali__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cse-materiali__item {
    display: flex;
    align-items: center;
    padding: 0.75em;
    margin-bottom: 0.5em;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.cse-materiali__item:hover {
    border-color: rgb(0, 103, 72);
}

.cse-materiali__item:last-child {
    margin-bottom: 0;
}

.cse-materiali__icon {
    margin-right: 0.75em;
    flex-shrink: 0;
}

.cse-icon {
    display: block;
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.cse-icon--pdf {
    color: #d63384;
}

.cse-icon--doc {
    color: #0d6efd;
}

.cse-icon--excel {
    color: #198754;
}

.cse-icon--ppt {
    color: #fd7e14;
}

.cse-icon--image {
    color: #6f42c1;
}

.cse-icon--file {
    color: #6c757d;
}

.cse-materiali__content {
    flex: 1;
    margin-right: 0.75em;
}

.cse-materiali__link {
    color: rgb(0, 103, 72);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.cse-materiali__link:hover {
    color: rgb(0, 82, 54);
    text-decoration: underline;
}

.cse-materiali__info {
    font-size: 0.8em;
    color: #6c757d;
    margin-left: 0.5em;
}

.cse-materiali__download {
    flex-shrink: 0;
}

.cse-materiali__button {
    display: inline-flex;
    align-items: center;
    padding: 0.375em 0.75em;
    background: rgb(0, 103, 72);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.85em;
    transition: background-color 0.3s ease;
}

.cse-materiali__button:hover {
    background: rgb(208, 19, 44);
    color: white;
}

.cse-materiali__button::before {
    content: '⬇';
    margin-right: 0.5em;
}

/* Calendar Component */
.cse-calendario {
    margin: 1.5em 0;
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    padding: 1em;
}

/* Calendar customizations for FullCalendar */
.cse-calendario .fc-toolbar {
    flex-wrap: wrap;
    gap: 0.5em;
}

.cse-calendario .fc-button-group .fc-button {
    background: rgb(0, 103, 72);
    border-color: rgb(0, 103, 72);
}

.cse-calendario .fc-button-group .fc-button:hover {
    background: rgb(208, 19, 44);
    border-color: rgb(208, 19, 44);
}

.cse-calendario .fc-event {
    background: rgb(0, 103, 72);
    border-color: rgb(0, 103, 72);
    padding: 2px 4px;
}

.cse-calendario .fc-event:hover {
    background: rgb(208, 19, 44);
}

.cse-calendario .fc-day-number {
    color: #495057;
}

.cse-calendario .fc-today {
    background: #fff3cd !important;
}

/* Responsive Design */
@media (min-width: 768px) {
    .cse-evento {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .cse-evento__thumbnail {
        width: 200px;
        margin-right: 1.5em;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .cse-materiali__item {
        padding: 1em;
    }
}

@media (max-width: 767px) {
    .cse-calendario .fc-toolbar {
        flex-direction: column;
    }
    
    .cse-calendario .fc-toolbar .fc-left,
    .cse-calendario .fc-toolbar .fc-center,
    .cse-calendario .fc-toolbar .fc-right {
        display: flex;
        justify-content: center;
        margin-bottom: 0.5em;
    }
    
    .cse-materiali__item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5em;
    }
    
    .cse-materiali__content {
        margin-right: 0;
    }
}

/* Accessibility Improvements */
.cse-evento__link:focus,
.cse-materiali__link:focus,
.cse-materiali__button:focus {
    outline: 2px solid rgb(0, 103, 72);
    outline-offset: 2px;
}

/* Shortcodes singoli per Divi */
.cse-evento-data,
.cse-evento-ora,
.cse-evento-luogo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.cse-evento-data .cse-icon,
.cse-evento-ora .cse-icon,
.cse-evento-luogo .cse-icon {
    font-size: 1.1em;
}

/* Status evento */
.cse-evento-status {
    display: inline-block;
    margin-bottom: 0.5rem;
}

.cse-status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cse-status--prossimo .cse-status-badge {
    background: rgba(0, 103, 72, 0.1);
    color: rgb(0, 103, 72);
    border: 1px solid rgba(0, 103, 72, 0.3);
}

.cse-status--passato .cse-status-badge {
    background: rgba(208, 19, 44, 0.1);
    color: rgb(208, 19, 44);
    border: 1px solid rgba(208, 19, 44, 0.3);
}

/* Link esterno */
.cse-evento-external-wrapper {
    margin-top: 1rem;
}

.cse-link--link {
    color: rgb(0, 103, 72);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.cse-link--link:hover {
    color: rgb(0, 82, 54);
    text-decoration: underline;
}

.cse-link--button {
    display: inline-block;
    background: rgb(0, 103, 72);
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.cse-link--button:hover {
    background: rgb(208, 19, 44);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(208, 19, 44, 0.25);
    color: #ffffff;
}

.cse-link--badge {
    display: inline-block;
    background: #f8f9fa;
    color: rgb(0, 103, 72);
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgb(0, 103, 72);
    transition: all 0.2s ease;
}

.cse-link--badge:hover {
    background: rgb(0, 103, 72);
    color: #ffffff;
}

/* Info completa layouts */
.cse-evento-info-completa {
    margin-bottom: 2rem;
}

.cse-layout--card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cse-layout--lista .cse-info-item {
    display: block;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.cse-layout--lista .cse-info-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.cse-layout--inline {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.cse-layout--inline .cse-info-item {
    flex: none;
}

.cse-info-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.cse-info-icon {
    flex-shrink: 0;
    font-size: 1.2em;
    margin-top: 0.1rem;
}

.cse-info-content {
    flex-grow: 1;
    line-height: 1.5;
}

.cse-info-content strong {
    color: rgb(0, 103, 72);
    font-weight: 600;
}

/* Maps link */
.cse-maps-link {
    color: rgb(0, 103, 72);
    text-decoration: none;
    border-bottom: 1px dotted rgb(0, 103, 72);
    transition: all 0.2s ease;
}

.cse-maps-link:hover {
    color: rgb(0, 82, 54);
    border-bottom-style: solid;
}

/* Responsive per Divi */
@media (max-width: 768px) {
    .cse-layout--inline {
        flex-direction: column;
    }
    
    .cse-layout--card {
        padding: 1rem;
    }
    
    .cse-link--button {
        display: block;
        text-align: center;
        width: 100%;
    }
}

/* Divi integration specifics */
.et_pb_module .cse-evento-data,
.et_pb_module .cse-evento-ora,
.et_pb_module .cse-evento-luogo,
.et_pb_module .cse-evento-status {
    margin-bottom: 0;
}

.et_pb_text .cse-evento-info-completa {
    margin-top: 0;
}

/* Dark mode support for Divi */
.et_pb_bg_layout_dark .cse-layout--card {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.et_pb_bg_layout_dark .cse-info-content strong {
    color: #ffffff;
}

.et_pb_bg_layout_dark .cse-link--button {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.et_pb_bg_layout_dark .cse-link--button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Calendario semplificato */
.cse-calendario {
    margin: 2rem 0;
}

.cse-calendario-empty {
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    color: #6c757d;
}

.cse-calendario-title {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgb(0, 103, 72);
}

.cse-calendario-month {
    margin-bottom: 2rem;
}

.cse-calendario-month-title {
    color: rgb(0, 103, 72);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #dee2e6;
}

.cse-calendario-evento {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.cse-calendario-evento:hover {
    border-color: rgb(0, 103, 72);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 103, 72, 0.15);
}

.cse-calendario-evento__date {
    flex-shrink: 0;
    text-align: center;
    background: rgb(0, 103, 72);
    color: #ffffff;
    border-radius: 8px;
    padding: 0.5rem;
    min-width: 60px;
}

.cse-calendario-evento__day {
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
}

.cse-calendario-evento__month {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

.cse-calendario-evento__content {
    flex-grow: 1;
}

.cse-calendario-evento__title {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.cse-calendario-evento__title a {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 600;
}

.cse-calendario-evento__title a:hover {
    color: rgb(0, 103, 72);
    text-decoration: underline;
}

.cse-calendario-evento__time,
.cse-calendario-evento__location {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.cse-calendario-evento__location {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Vista griglia */
.cse-calendario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.cse-calendario-evento--grid {
    flex-direction: column;
    text-align: center;
    margin-bottom: 0;
    height: 100%;
    min-height: 200px;
}

.cse-calendario-evento--grid .cse-calendario-evento__date {
    align-self: center;
    margin-bottom: 1rem;
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 50%;
}

.cse-calendario-evento--grid .cse-calendario-evento__day {
    font-size: 1.8rem;
    font-weight: bold;
    line-height: 1;
}

.cse-calendario-evento--grid .cse-calendario-evento__month {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.cse-calendario-evento--grid .cse-calendario-evento__content {
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cse-calendario-evento--grid .cse-calendario-evento__title {
    margin-bottom: 0.75rem;
}

.cse-calendario-evento--grid .cse-calendario-evento__excerpt {
    font-size: 0.9rem;
    color: #6c757d;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    flex-grow: 1;
}

.cse-calendario-evento--grid .cse-calendario-evento__time,
.cse-calendario-evento--grid .cse-calendario-evento__location {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
    .cse-calendario-evento {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .cse-calendario-evento__date {
        align-self: center;
    }
    
    .cse-calendario-evento__content {
        text-align: center;
    }
    
    .cse-calendario--griglia .cse-calendario-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .cse-materiali__button,
    .cse-calendario {
        display: none;
    }
    
    .cse-evento {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .cse-link--button,
    .cse-evento-external-wrapper {
        display: none;
    }
}