/* Calendar Styles */
.calendar-wrapper {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
}

.calendar-nav h5 {
    margin: 0;
    color: #2c3e50;
    font-weight: 600;
}

.calendar-nav button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-grid {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.calendar-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
}

.calendar-day-header {
    padding: 15px;
    text-align: center;
    font-weight: 600;
    color: #495057;
    border-right: 1px solid #e9ecef;
}

.calendar-day-header:last-child {
    border-right: none;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
    min-height: 60px;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

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

.calendar-day:hover {
    background: #f8f9fa;
}

.calendar-day.has-fairs {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
}

.calendar-day.has-fairs:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.calendar-day.empty {
    background: #f8f9fa;
    cursor: default;
}

.calendar-day.empty:hover {
    background: #f8f9fa;
}

.day-number {
    font-weight: 600;
}

.fair-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 12px;
}

/* Fair Detail Modal Styles */
.fair-detail-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.fair-detail-item h6 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
}

.fair-detail-item p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.fair-detail-item i {
    color: #667eea;
    margin-right: 8px;
    width: 16px;
}

/* Fair Calendar Styles */
.calendar-container {
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.calendar-header {
    text-align: center;
    margin-bottom: 30px;
}

.calendar-header h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

#fair-calendar {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

/* Monthly Fairs Styles */
.monthly-fairs {
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.monthly-fairs h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

.monthly-fairs p {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.month-section {
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.month-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.month-header:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.month-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.month-header .badge {
    background: rgba(255,255,255,0.2) !important;
    color: white;
    font-size: 12px;
}

.month-header i {
    transition: transform 0.3s ease;
}

.month-header[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.month-content {
    padding: 20px;
    background: #f8f9fa;
}

.fair-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.fair-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.fair-item:last-child {
    margin-bottom: 0;
}

.fair-date {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    min-width: 80px;
    margin-right: 20px;
}

.fair-date .day {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.fair-date .month {
    display: block;
    font-size: 12px;
    opacity: 0.9;
}

.fair-info {
    flex: 1;
}

.fair-info h6 {
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 600;
}

.fair-info p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.fair-info i {
    color: #667eea;
    margin-right: 8px;
    width: 16px;
}

/* Feature Box Styles */
.feature-box {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    height: 100%;
}

.feature-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
}

.feature-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.feature-icon i {
    font-size: 32px;
    color: white;
}

.feature-content h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

.feature-content p {
    color: #666;
    line-height: 1.6;
}

/* Month Selection Styles */
.month-selection {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.month-selection .form-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.month-selection .form-select {
    border: 2px solid #e9ecef;
    border-radius: 6px;
    padding: 10px 15px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.month-selection .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Month Section Visibility */
.month-section {
    transition: all 0.3s ease;
}

.month-section[style*="display: none"] {
    opacity: 0;
    transform: translateY(-20px);
}

/* Sector Filtering Animation */
.fair-item {
    transition: all 0.3s ease;
}

.fair-item[style*="display: none"] {
    opacity: 0;
    transform: scale(0.95);
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Enhanced Calendar Styles */
.calendar-day.has-fairs {
    position: relative;
    overflow: hidden;
}

.calendar-day.has-fairs::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.3) 100%);
    pointer-events: none;
}

.fair-indicator {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Loading and Error States */
.loading-state {
    padding: 40px 20px;
    text-align: center;
}

.loading-state .spinner-border {
    width: 3rem;
    height: 3rem;
}

.error-state {
    padding: 40px 20px;
    text-align: center;
}

.error-state .fa-exclamation-triangle {
    color: #dc3545;
}

.error-state .btn {
    margin-top: 15px;
}

/* Data Source Info */
.month-selection small a {
    color: #667eea;
    text-decoration: none;
}

.month-selection small a:hover {
    text-decoration: underline;
}

/* Refresh Button */
.btn-outline-primary {
    border-color: #667eea;
    color: #667eea;
}

.btn-outline-primary:hover {
    background-color: #667eea;
    border-color: #667eea;
    color: white;
}

/* Dynamic Content Animation */
.month-content {
    transition: all 0.3s ease;
    position: relative;
}

.month-content.loading {
    opacity: 0.6;
    pointer-events: none;
}

.month-content.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Real-time Data Indicator */
.real-time-indicator {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.real-time-indicator i {
    animation: pulse 2s infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .fair-item {
        flex-direction: column;
        text-align: center;
    }
    
    .fair-date {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .calendar-container,
    .monthly-fairs {
        padding: 20px;
    }
    
    .month-header {
        padding: 15px;
    }
    
    .month-header h5 {
        font-size: 16px;
    }
    
    .month-selection {
        padding: 15px;
    }
    
    .month-selection .row > div {
        margin-bottom: 15px;
    }
    
    .month-selection .d-flex {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}
