/**
 * GTM Calendar Frontend Styles
 * MOBILE-FIRST design for young smartphone users
 * Brand colors: #A71928 (red), #333 (black)
 */

/* Reset and Base */
.gtm-calendar-container * {
    box-sizing: border-box;
}

.gtm-calendar-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Calendar Header */
.gtm-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #A71928, #8b1420);
    border-radius: 8px;
    color: #fff;
}

.gtm-calendar-header * {
    color: #ffffff !important;
}

.gtm-month-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.gtm-nav-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.gtm-nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.gtm-nav-btn:active {
    transform: scale(0.95);
}

.gtm-calendar-header .gtm-month-title {
    font-size: 20px !important;
    font-weight: 600 !important;
    margin: 0 !important;
    min-width: 120px !important;
    text-align: center !important;
    color: white !important;
    background: transparent !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5) !important;
}

.gtm-month-title {
    color: white !important;
    background: transparent !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5) !important;
}

/* Legend */
.gtm-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 12px;
}

.gtm-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gtm-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.gtm-legend-color.red { background: #dc3545; }
.gtm-legend-color.green { background: #28a745; }
.gtm-legend-color.yellow { background: #ffc107; }
.gtm-legend-color.grey { background: #6c757d; }

/* Calendar Grid */
.gtm-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: #e9ecef;
    border-radius: 6px;
    padding: 2px;
    overflow: hidden;
}

/* Day Headers */
.gtm-day-header {
    background: #333;
    color: #fff;
    padding: 12px 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Calendar Days */
.gtm-day {
    background: #fff;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    touch-action: manipulation;
    border-radius: 2px;
}

.gtm-day:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.gtm-day:active {
    transform: scale(0.95);
}

/* Day States */
.gtm-day.other-month {
    color: #adb5bd;
    background: #f8f9fa;
    cursor: default;
}

.gtm-day.other-month:hover {
    transform: none;
    box-shadow: none;
}

.gtm-day.past {
    opacity: 0.5;
    cursor: default;
}

.gtm-day.past:hover {
    transform: none;
    box-shadow: none;
}

.gtm-day.today {
    border: 2px solid #A71928;
    font-weight: 700;
}

.gtm-day.has-event {
    font-weight: 700;
    color: #fff;
}

/* Event Colors */
.gtm-day.event-red {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.gtm-day.event-green {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}

.gtm-day.event-yellow {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #333;
}

.gtm-day.event-grey {
    background: linear-gradient(135deg, #6c757d, #5a6268);
}

/* Event Indicator */
.gtm-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
}

.gtm-day.event-yellow.has-event::after {
    background: rgba(0,0,0,0.6);
}

/* Event Modal/Popup */
.gtm-event-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.gtm-event-modal.active {
    display: flex;
}

.gtm-event-content {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: gtm-modal-slide-up 0.3s ease-out;
}

@keyframes gtm-modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gtm-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.gtm-modal-close:hover {
    background: #f8f9fa;
    color: #A71928;
}

.gtm-event-date {
    font-size: 18px;
    font-weight: 700;
    color: #A71928;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.gtm-event-status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.gtm-event-status.red {
    background: #dc3545;
    color: #fff;
}

.gtm-event-status.green {
    background: #28a745;
    color: #fff;
}

.gtm-event-status.yellow {
    background: #ffc107;
    color: #333;
}

.gtm-event-status.grey {
    background: #6c757d;
    color: #fff;
}

.gtm-event-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.gtm-event-time {
    font-size: 16px;
    color: #A71928;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gtm-event-time::before {
    content: '🕒';
    font-size: 14px;
}

.gtm-event-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.gtm-event-price {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    font-weight: 600;
    color: #333;
    border-left: 4px solid #A71928;
}

/* Loading State */
.gtm-calendar-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    font-size: 16px;
    color: #666;
}

.gtm-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e9ecef;
    border-top-color: #A71928;
    border-radius: 50%;
    margin-right: 12px;
    animation: gtm-spin 1s linear infinite;
}

@keyframes gtm-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error State */
.gtm-calendar-error {
    text-align: center;
    padding: 30px;
    color: #dc3545;
    background: #f8d7da;
    border-radius: 6px;
    margin: 15px 0;
}

/* Responsive Tablet */
@media (min-width: 768px) {
    .gtm-calendar-container {
        padding: 25px;
        max-width: 600px;
    }
    
    .gtm-day {
        min-height: 50px;
        font-size: 16px;
    }
    
    .gtm-day-header {
        padding: 15px 8px;
        font-size: 14px;
    }
    
    .gtm-month-title {
        font-size: 24px;
    }
    
    .gtm-legend {
        grid-template-columns: repeat(4, 1fr);
        font-size: 14px;
    }
    
    .gtm-event-content {
        max-width: 500px;
        padding: 30px;
    }
}

/* Responsive Desktop */
@media (min-width: 1024px) {
    .gtm-calendar-container {
        max-width: 700px;
        padding: 30px;
    }
    
    .gtm-day {
        min-height: 60px;
        font-size: 18px;
    }
    
    .gtm-day-header {
        padding: 18px 12px;
        font-size: 16px;
    }
    
    .gtm-calendar-grid {
        gap: 4px;
        padding: 4px;
    }
    
    .gtm-day:hover {
        transform: scale(1.02);
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .gtm-calendar-container {
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    }
    
    .gtm-event-content {
        box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .gtm-calendar-container {
        background: #1e1e1e;
        color: #fff;
    }
    
    .gtm-day {
        background: #2a2a2a;
        color: #fff;
    }
    
    .gtm-day.other-month {
        background: #333;
        color: #666;
    }
    
    .gtm-event-content {
        background: #2a2a2a;
        color: #fff;
    }
    
    .gtm-legend {
        background: #333;
    }
    
    .gtm-calendar-grid {
        background: #333;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .gtm-day,
    .gtm-nav-btn,
    .gtm-modal-close {
        transition: none;
    }
    
    .gtm-day:hover {
        transform: none;
    }
    
    .gtm-loading-spinner {
        animation: none;
    }
    
    .gtm-event-content {
        animation: none;
    }
}

/* Focus States for Accessibility */
.gtm-day:focus,
.gtm-nav-btn:focus,
.gtm-modal-close:focus {
    outline: 2px solid #A71928;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .gtm-calendar-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .gtm-event-modal {
        display: none !important;
    }
    
    .gtm-nav-btn {
        display: none;
    }
}