/* Geo Media Calendar - Stile Apple */

/* Reset e variabili CSS */
:root {
    --primary-color: #007AFF;
    --secondary-color: #5856D6;
    --background-color: #F2F2F7;
    --surface-color: #FFFFFF;
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --border-color: #E5E5E7;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Container principale */
.geo-calendar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background-color);
    min-height: 100vh;
}

/* Header del calendario */
.calendar-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
}

.calendar-header h1 {
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.nav-btn {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
}

.nav-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
    box-shadow: var(--shadow-medium);
}

#current-month {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 200px;
}

/* Griglia del calendario */
.calendar-grid {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    overflow: hidden;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
}

.calendar-weekdays > div {
    padding: 16px 8px;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
}

.calendar-day {
    background: var(--surface-color);
    min-height: 80px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

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

.calendar-day.has-photos {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-weight: 600;
}

.calendar-day.has-photos:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-medium);
}

.calendar-day .day-number {
    font-size: 18px;
    font-weight: 500;
}

.calendar-day.has-photos::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
}

.calendar-day.empty {
    background: var(--background-color);
    cursor: default;
}

.calendar-day.empty:hover {
    background: var(--background-color);
}

/* Modal per il giorno */
.day-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

.day-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    max-width: 90vw;
    max-height: 90vh;
    width: 1000px;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-color);
}

.modal-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-modal:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 32px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Sezioni dipartimenti */
.department-section {
    margin-bottom: 40px;
}

.department-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
}

.station-group {
    margin-bottom: 30px;
    background: var(--background-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-light);
}

.station-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.station-title::before {
    content: '📍';
    font-size: 16px;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    min-height: 120px; /* Altezza minima per evitare sezioni vuote */
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* Messaggio quando non ci sono foto */
.photos-grid:empty::after {
    content: 'Nessuna foto disponibile per questa stazione';
    display: block;
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-style: italic;
    grid-column: 1 / -1;
}

.photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    aspect-ratio: 1;
}

.photo-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-medium);
}

.photo-item img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: var(--transition);
    display: block !important; /* Assicura che l'immagine sia visibile */
    min-height: 120px !important; /* Altezza minima per evitare elementi vuoti */
    max-width: none !important; /* Forza la visualizzazione */
    visibility: visible !important; /* Forza la visibilità */
    opacity: 1 !important; /* Forza l'opacità */
}

/* Stili base per photo-item */
.photo-item {
    min-height: 120px;
    display: block;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    aspect-ratio: 1;
}

/* Fallback per immagini mancanti */
.photo-item img:not([src]), 
.photo-item img[src=""],
.photo-item img[src*="error"] {
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.photo-item img:not([src])::after, 
.photo-item img[src=""]::after,
.photo-item img[src*="error"]::after {
    content: 'Immagine non disponibile';
}

.photo-item:hover img {
    filter: brightness(1.1);
}

/* Lightbox */
.photo-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    backdrop-filter: blur(20px);
    animation: fadeIn 0.3s ease-out;
}

.photo-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: -70px;
}

.lightbox-next {
    right: -70px;
}

.lightbox-info {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    font-weight: 500;
}

/* Animazioni */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .geo-calendar-container {
        padding: 10px;
    }
    
    .calendar-header h1 {
        font-size: 32px;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 4px;
    }
    
    .calendar-day .day-number {
        font-size: 14px;
    }
    
    .modal-content {
        max-width: 95vw;
        margin: 10px;
        max-height: 90vh;
        overflow: hidden;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .department-title {
        font-size: 20px;
    }
    
    .station-title {
        font-size: 16px;
    }
    
    .photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
        width: 100%;
        overflow: hidden;
    }
    
    .photo-item {
        min-height: 80px;
        max-height: 80px;
        aspect-ratio: 1;
        overflow: hidden;
    }
    
    .photo-item img {
        min-height: 80px !important;
        max-height: 80px !important;
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .calendar-nav {
        gap: 10px;
    }
    
    .nav-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    #current-month {
        font-size: 18px;
        min-width: 150px;
    }
    
    .calendar-weekdays > div {
        padding: 12px 4px;
        font-size: 12px;
    }
    
    .photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 6px;
        width: 100%;
        overflow: hidden;
    }
    
    .photo-item {
        min-height: 70px;
        max-height: 70px;
        aspect-ratio: 1;
        overflow: hidden;
    }
    
    .photo-item img {
        min-height: 70px !important;
        max-height: 70px !important;
    }
    
    .station-group {
        margin-bottom: 20px;
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
        max-height: 80vh;
    }
}

/* Schermi molto piccoli */
@media (max-width: 320px) {
    .photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 4px;
    }
    
    .photo-item {
        min-height: 60px;
        max-height: 60px;
    }
    
    .photo-item img {
        min-height: 60px !important;
        max-height: 60px !important;
    }
    
    .modal-content {
        max-width: 98vw;
        margin: 5px;
    }
    
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 12px;
    }
    
    .department-title {
        font-size: 18px;
    }
    
    .station-title {
        font-size: 14px;
    }
    
    .station-group {
        padding: 12px;
        margin-bottom: 16px;
    }
}

/* Scrollbar personalizzata */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
} 

/* Messaggi di errore e autenticazione */
.error, .auth-error {
    text-align: center;
    padding: 40px 20px;
    border-radius: 12px;
    margin: 20px 0;
    font-weight: 500;
}

.error {
    background: #FFE5E5;
    color: #D70015;
    border: 1px solid #FFB3B3;
}

.auth-error {
    background: #FFF3E0;
    color: #E65100;
    border: 1px solid #FFCC80;
}

.auth-error a {
    color: #007AFF;
    text-decoration: none;
    font-weight: 600;
}

.auth-error a:hover {
    text-decoration: underline;
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: #86868B;
    font-size: 16px;
}

/* Animazione loading */
.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #E5E5E7;
    border-radius: 50%;
    border-top-color: #007AFF;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

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