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

body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
}

.content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

button {
    background-color: #3498db;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-bottom: 20px;
}

button:hover {
    background-color: #2980b9;
}

.response-box {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    min-height: 50px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
}

/* Calendar Styles */
.calendar-container {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

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

.calendar-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5rem;
}

.user-selector {
    margin-bottom: 20px;
    text-align: center;
}

.user-selector label {
    margin-right: 10px;
    font-weight: bold;
    color: #2c3e50;
}

.user-selector select {
    padding: 8px 12px;
    border: 2px solid #3498db;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

.nav-btn {
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background-color: #2980b9;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.day-header {
    background-color: #34495e;
    color: white;
    padding: 12px;
    text-align: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.calendar-days {
    display: contents;
}

.calendar-day {
    background-color: white;
    padding: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    min-height: 60px;
    display: flex;
    flex-direction: column;
}

.calendar-day span {
    align-self: flex-start;
    font-weight: bold;
    margin-bottom: auto;
}

.calendar-day:hover {
    background-color: #ecf0f1;
}

.calendar-day.other-month {
    color: #bdc3c7;
    background-color: #f8f9fa;
}

.calendar-day.today {
    background-color: #3498db;
    color: white;
    font-weight: bold;
}

.calendar-day.has-workout {
    background-color: #f8f9fa;
    border: 2px solid #3498db;
    position: relative;
}

.calendar-day.has-workout:hover {
    background-color: #ecf0f1;
}

.calendar-day.has-event {
    background-color: #fff5ee;
    border: 2px solid #f39c12;
    position: relative;
}

.calendar-day.has-event:hover {
    background-color: #ffeaa7;
}

.calendar-day.has-workout.has-event {
    background: linear-gradient(135deg, #f8f9fa 50%, #fff5ee 50%);
    border: 2px solid #9b59b6;
}

.calendar-day.has-workout.has-event:hover {
    background: linear-gradient(135deg, #ecf0f1 50%, #ffeaa7 50%);
}

.calendar-day.has-training {
    background-color: #fdfdfd;
    border: 1px solid #ddd;
    position: relative;
}

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

/* Activity Icons */
.activity-icons {
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
}

.activity-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.activity-icon.swim {
    background-color: #3498db;
}

.activity-icon.bike {
    background-color: #e67e22;
}

.activity-icon.run {
    background-color: #e74c3c;
}

.activity-icon.other {
    background-color: #95a5a6;
}

.event-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f39c12;
    color: white;
    font-weight: bold;
}

.training-icon {
    opacity: 0.4;
    border: 1px solid #bdc3c7;
    background-color: #ecf0f1 !important;
    color: #7f8c8d !important;
}

.training-icon:hover {
    opacity: 0.7;
}

/* Strava Authentication Styles */
.auth-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 2px dashed #bdc3c7;
    text-align: center;
    margin-bottom: 30px;
}

.auth-container h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.auth-container p {
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.strava-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}

.strava-btn:hover {
    transform: scale(1.05);
}

.strava-logo {
    height: 48px;
    width: auto;
}

/* Hide auth section when authenticated */
.authenticated .auth-section {
    display: none;
}

.authenticated #calendarSection {
    display: block !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .calendar-container {
        padding: 15px;
    }
    
    .calendar-header {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .calendar-header h2 {
        font-size: 1.2rem;
    }
    
    .nav-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .day-header {
        padding: 8px 4px;
        font-size: 0.8rem;
    }
    
    .calendar-day {
        min-height: 50px;
        padding: 3px;
    }
    
    .activity-icon {
        width: 18px;
        height: 18px;
        font-size: 12px;
    }
    
    .event-icon {
        width: 18px;
        height: 18px;
        font-size: 12px;
    }
    
    .training-icon {
        width: 18px;
        height: 18px;
        font-size: 12px;
    }
    
    .user-selector {
        margin-bottom: 15px;
    }
    
    .user-selector select {
        padding: 6px 8px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
    }
    
    .calendar-container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .calendar-header h2 {
        font-size: 1.1rem;
    }
    
    .nav-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .day-header {
        padding: 6px 2px;
        font-size: 0.7rem;
    }
    
    .calendar-day {
        min-height: 40px;
        padding: 2px;
    }
    
    .calendar-day span {
        font-size: 0.9rem;
    }
    
    .activity-icon {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
    
    .event-icon {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
    
    .training-icon {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
    
    .user-selector label {
        display: block;
        margin-bottom: 5px;
        margin-right: 0;
    }
    
    .user-selector select {
        width: 100%;
        max-width: 200px;
    }
    
    .auth-container p {
        font-size: 1rem;
    }
    
    .strava-logo {
        height: 40px;
    }
}

/* Activity Hover Card */
.activity-hover-card {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 12px;
    z-index: 1000;
    display: none;
    min-width: 200px;
    max-width: 300px;
    pointer-events: none;
}

/* Event Hover Card */
.event-hover-card {
    position: absolute;
    background: white;
    border: 1px solid #f39c12;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 12px;
    z-index: 1000;
    display: none;
    min-width: 200px;
    max-width: 300px;
    pointer-events: none;
}

/* Training Hover Card */
.training-hover-card {
    position: absolute;
    background: white;
    border: 1px solid #95a5a6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 12px;
    z-index: 1000;
    display: none;
    min-width: 200px;
    max-width: 300px;
    pointer-events: none;
}

.hover-card-content {
    font-size: 14px;
}

.activity-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #2c3e50;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
}

.event-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #f39c12;
    font-weight: bold;
    border-bottom: 1px solid #f39c12;
    padding-bottom: 6px;
}

.training-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #95a5a6;
    font-weight: bold;
    border-bottom: 1px solid #95a5a6;
    padding-bottom: 6px;
}

.training-description {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #5d6d7e;
    line-height: 1.3;
    font-style: italic;
    padding: 4px 0;
}

.activity-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.event-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.event-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.training-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.training-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    color: #7f8c8d;
    font-weight: 500;
}

.stat-value {
    color: #2c3e50;
    font-weight: bold;
}

.stat-value.distance {
    color: #e74c3c;
}

.stat-value.duration {
    color: #3498db;
}

.stat-value.speed {
    color: #9b59b6;
}

.stat-value.pace {
    color: #f39c12;
}

.stat-value.type {
    color: #27ae60;
}

/* Responsive hover card */
@media (max-width: 480px) {
    .activity-hover-card {
        min-width: 180px;
        max-width: 250px;
        font-size: 13px;
    }
    
    .activity-title {
        font-size: 14px;
    }
    
    .event-hover-card {
        min-width: 180px;
        max-width: 250px;
        font-size: 13px;
    }
    
    .event-title {
        font-size: 14px;
    }
    
    .training-hover-card {
        min-width: 180px;
        max-width: 250px;
        font-size: 13px;
    }
    
    .training-title {
        font-size: 14px;
    }
}