/**
 * History Calendar Styles
 * Apple Fitness-inspired calendar design
 */

.history-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Location Selector */
.location-selector-wrapper {
    margin-bottom: 20px;
    margin-top: -5px;
    text-align: center;
}

.location-select {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 87, 51, 0.3);
    border-radius: 12px;
    color: #fff;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: auto;
    max-width: 100%;
    display: inline-block;
}

.location-select:hover {
    border-color: rgba(255, 87, 51, 0.6);
    background: rgba(255, 255, 255, 0.08);
}

.location-select:focus {
    outline: none;
    border-color: #FF5733;
    box-shadow: 0 0 0 3px rgba(255, 87, 51, 0.2);
}

.location-select option {
    background: #1a1a1a;
    color: #fff;
}

/* Month Navigation */
.month-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.month-nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 87, 51, 0.3);
    border-radius: 12px;
    color: #FF5733;
    padding: 12px 16px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.month-nav-btn:hover {
    background: rgba(255, 87, 51, 0.1);
    border-color: rgba(255, 87, 51, 0.6);
    transform: scale(1.05);
}

.month-nav-btn:active {
    transform: scale(0.95);
}

.month-title {
    flex: 1;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

/* Loading & Error States */
.loading-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 87, 51, 0.2);
    border-top-color: #FF5733;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.loading-state p,
.error-state p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
}

.retry-btn {
    margin-top: 16px;
    background: linear-gradient(135deg, #FF5733, #FFA500);
    border: none;
    border-radius: 12px;
    color: #fff;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 87, 51, 0.4);
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 32px;
    width: 100%;
    box-sizing: border-box;
}

.day-label {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    padding: 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.day-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 4px;
    transition: all 0.3s ease;
    position: relative;
    box-sizing: border-box;
    min-width: 0;
}

.day-cell-empty {
    background: transparent;
}

.day-cell-clickable {
    cursor: pointer;
}

.day-cell-clickable:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.05);
}

.day-gauge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.day-gauge-empty {
    background: #4b5563;
    color: rgba(255, 255, 255, 0.4);
}

.day-number {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

/* Legend */
.legend {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 20px;
    margin-top: 24px;
}

.legend-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 16px 0;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.legend-colour {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Day Detail Modal */
.day-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.day-modal-overlay.active {
    display: flex;
}

.day-modal {
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.98), rgba(20, 20, 20, 0.98));
    border: 2px solid rgba(255, 87, 51, 0.3);
    border-radius: 20px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    position: relative;
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-gauge {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px 0;
}

.modal-rating {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.modal-details {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

.modal-details p {
    margin: 8px 0;
}

.modal-details strong {
    color: #fff;
}

.modal-details ul {
    margin: 4px 0 8px 20px;
    padding: 0;
}

.modal-details li {
    margin: 4px 0;
}

/* Responsive Design */
@media (max-width: 480px) {
    .history-container {
        padding: 12px;
    }

    .month-title {
        font-size: 18px;
    }

    .month-nav-btn {
        padding: 10px 12px;
        font-size: 18px;
    }

    .day-gauge {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .day-number {
        font-size: 9px;
    }

    .calendar-grid {
        gap: 4px;
    }

    .day-label {
        font-size: 10px;
        padding: 6px 0;
    }

    .location-select {
        width: 100%;
        max-width: 100%;
        font-size: 14px;
        padding: 10px 16px;
    }

    .legend {
        padding: 16px;
    }

    .legend-title {
        font-size: 14px;
    }

    .legend-items {
        gap: 10px;
    }

    .legend-item {
        font-size: 13px;
    }

    .day-modal {
        padding: 20px;
        max-width: 90vw;
    }

    .modal-gauge {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    .modal-title {
        font-size: 18px;
    }

    .modal-details {
        font-size: 14px;
    }
}