/* ============================================================================
   TRIATHLON AI TRAINER - COMPLETE STYLES
   ============================================================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0066cc;
    --secondary-color: #4a90e2;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark: #1a1a1a;
    --gray: #6c757d;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: var(--light-gray);
}

/* Language Selector */
.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.language-selector select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    font-size: 0.95em;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.language-selector select:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.language-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
}

.loading-screen.active {
    display: flex;
}

.loader {
    border: 4px solid var(--light-gray);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* ============================================================================
   AUTHENTICATION SCREEN
   ============================================================================ */

#auth-screen {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
}

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

.auth-header h1 {
    font-size: 3em;
    margin-bottom: 10px;
}

.auth-header h2 {
    color: var(--dark);
    margin-bottom: 5px;
}

.auth-header p {
    color: var(--gray);
    font-size: 0.95em;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h3 {
    margin-bottom: 20px;
    color: var(--dark);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--dark);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--gray);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

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

/* ============================================================================
   ONBOARDING SCREEN
   ============================================================================ */

#onboarding-screen {
    padding: 40px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.onboarding-container {
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 700px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.onboarding-container h2 {
    margin-bottom: 10px;
}

.onboarding-container > p {
    color: var(--gray);
    margin-bottom: 30px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.checkbox-group {
    display: flex;
    gap: 20px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* ============================================================================
   DASHBOARD LAYOUT
   ============================================================================ */

.header {
    background: white;
    padding: 20px 40px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.5em;
    color: var(--dark);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

#user-name {
    font-weight: 500;
}

/* Navigation */
.navigation {
    background: white;
    padding: 0 40px;
    display: flex;
    gap: 5px;
    border-bottom: 1px solid var(--border-color);
}

.nav-btn {
    background: none;
    border: none;
    padding: 15px 20px;
    cursor: pointer;
    font-size: 1em;
    color: var(--gray);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-btn:hover {
    color: var(--primary-color);
}

.nav-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 500;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 40px;
}

.tab-content.active {
    display: block;
}

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

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card h3 {
    margin-bottom: 15px;
    color: var(--dark);
}

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

.full-width {
    grid-column: 1 / -1;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Gradient Card */
.gradient-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.gradient-card h3 {
    color: white;
}

/* Metrics */
.metric-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--light-gray);
}

.metric-row:last-child {
    border-bottom: none;
}

.status-text {
    margin-top: 15px;
    padding: 15px;
    background: var(--light-gray);
    border-radius: 6px;
    font-size: 0.95em;
    color: var(--gray);
}

/* Risk Indicator */
.risk-indicator {
    text-align: center;
    padding: 20px 0;
}

.risk-score {
    font-size: 3em;
    font-weight: bold;
    margin-bottom: 10px;
}

.risk-level {
    font-size: 1.2em;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
}

.risk-level.low {
    background: var(--success-color);
    color: white;
}

.risk-level.medium {
    background: var(--warning-color);
    color: var(--dark);
}

.risk-level.high {
    background: var(--danger-color);
    color: white;
}

/* Race Countdown */
.countdown-number {
    font-size: 4em;
    font-weight: bold;
    margin: 20px 0;
}

.countdown-label {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.event-details {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    padding: 15px;
    background: var(--light-gray);
    border-radius: 8px;
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    gap: 15px;
    align-items: center;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    background: white;
}

.activity-info {
    display: flex;
    flex-direction: column;
}

.activity-name {
    font-weight: 500;
    margin-bottom: 3px;
}

.activity-date {
    font-size: 0.85em;
    color: var(--gray);
}

.activity-stat {
    text-align: right;
}

.activity-stat-value {
    font-weight: 500;
    display: block;
}

.activity-stat-label {
    font-size: 0.85em;
    color: var(--gray);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--gray);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-link {
    background: none;
    color: var(--primary-color);
    padding: 8px 16px;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

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

.modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--gray);
}

.modal-close:hover {
    color: var(--dark);
}

.modal-body {
    padding: 30px;
}

/* Training Plan Styles */
.week-container {
    margin-bottom: 30px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.week-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.day-card {
    background: white;
    padding: 15px;
    min-height: 120px;
}

.day-card.rest {
    background: var(--light-gray);
}

.day-name {
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.day-discipline {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    margin-bottom: 5px;
    font-weight: 500;
}

.day-discipline.swim {
    background: #e3f2fd;
    color: #1976d2;
}

.day-discipline.bike {
    background: #f3e5f5;
    color: #7b1fa2;
}

.day-discipline.run {
    background: #fff3e0;
    color: #e65100;
}

.day-discipline.brick {
    background: #e8f5e9;
    color: #2e7d32;
}

.day-discipline.rest {
    background: var(--light-gray);
    color: var(--gray);
}

.day-tss {
    font-size: 0.85em;
    color: var(--gray);
    margin-top: 5px;
}

/* Race Prediction Styles */
.prediction-summary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 30px;
}

.prediction-time {
    font-size: 3em;
    font-weight: bold;
    margin: 20px 0;
}

.prediction-confidence {
    font-size: 1.1em;
    opacity: 0.9;
}

.splits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.split-card {
    background: var(--light-gray);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.split-discipline {
    font-size: 0.9em;
    color: var(--gray);
    margin-bottom: 5px;
}

.split-time {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--dark);
}

/* Recommendations List */
.recommendations {
    margin-top: 20px;
}

.recommendation-item {
    padding: 15px;
    background: var(--light-gray);
    border-left: 4px solid var(--primary-color);
    margin-bottom: 10px;
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .week-days {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
    }
    
    .header h1 {
        font-size: 1.2em;
    }
    
    .navigation {
        padding: 0 20px;
        overflow-x: auto;
    }
    
    .nav-btn {
        white-space: nowrap;
        padding: 12px 15px;
    }
    
    .tab-content {
        padding: 20px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .week-days {
        grid-template-columns: 1fr;
    }
    
    .activity-item {
        grid-template-columns: auto 1fr;
        gap: 10px;
    }
    
    .splits-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .auth-container,
    .onboarding-container {
        padding: 20px;
    }
    
    .header-right {
        flex-direction: column;
        gap: 10px;
        align-items: flex-end;
    }
}

/* DSGVO/GDPR Styles */
.gdpr-links {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85em;
    color: var(--gray);
}

.gdpr-links a {
    color: var(--gray);
    text-decoration: none;
    transition: color 0.3s;
}

.gdpr-links a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.gdpr-footer {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 20px 40px;
    margin-top: 40px;
    text-align: center;
}

.footer-links {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--gray);
    text-decoration: none;
    transition: color 0.3s;
    margin: 0 8px;
}

.footer-links a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.footer-links span {
    color: var(--border-color);
    margin: 0 4px;
}

.footer-copyright {
    font-size: 0.85em;
    color: var(--gray);
}

@media (max-width: 768px) {
    .gdpr-footer {
        padding: 15px 20px;
    }
    
    .footer-links {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .footer-links span {
        display: none;
    }
}
