/* ============================================
   CSS Variables & Reset
   ============================================ */
:root {
    --primary-color: #007AFF;
    --secondary-color: #5856D6;
    --success-color: #34C759;
    --warning-color: #FF9500;
    --error-color: #FF3B30;
    --background-color: #F2F2F7;
    --surface-color: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #8E8E93;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.3);
    --adendorf-highlight: linear-gradient(135deg, rgba(255, 149, 0, 0.25), rgba(255, 149, 0, 0.15));
    --adendorf-color: #FF9500;
}

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

html, body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: linear-gradient(135deg,
        rgba(0, 122, 255, 0.1),
        rgba(88, 86, 214, 0.05),
        rgba(255, 45, 85, 0.05));
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* iOS Safe Area Support */
@supports (padding: max(0px)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .app-header {
        padding-top: calc(1.5rem + env(safe-area-inset-top));
    }

    .app-header.scrolled {
        padding-top: calc(0.4rem + env(safe-area-inset-top));
    }
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 160px; /* Space for fixed header + tab nav */
    transition: padding-top 0.3s ease;
}

body.scrolled #app {
    padding-top: 100px; /* Reduced space when scrolled */
}

/* ============================================
   Header
   ============================================ */
.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem 1rem 1.25rem;
    box-shadow: 0 4px 12px var(--shadow-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
    transition: all 0.3s ease;
}

.app-header.scrolled {
    padding: 0.4rem 1rem 0.4rem;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.header-content {
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: all 0.3s ease;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-right {
    display: none;
}

@media (min-width: 768px) {
    .header-right {
        display: flex;
        gap: 0.5rem;
    }

    .header-right .tab-button {
        background: rgba(255, 255, 255, 0.2);
        border: none;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        font-weight: 500;
        color: white;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.3s ease;
        white-space: nowrap;
    }

    .header-right .tab-button.active {
        background: rgba(255, 255, 255, 0.95);
        color: var(--primary-color);
        font-weight: 600;
    }

    .header-right .tab-button:hover:not(.active) {
        background: rgba(255, 255, 255, 0.3);
    }

    .app-header.scrolled .header-right .tab-button {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .tab-nav {
        display: none;
    }

    #app {
        padding-top: 100px;
    }

    body.scrolled #app {
        padding-top: 60px;
    }
}

.header-icon {
    font-size: 2.5rem;
    animation: bounce 2s infinite;
    transition: font-size 0.3s ease;
}

.app-header.scrolled .header-icon {
    font-size: 1.5rem;
    animation: none;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.header-text {
    transition: all 0.3s ease;
}

.header-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    transition: font-size 0.3s ease;
}

.app-header.scrolled .header-text h1 {
    font-size: 1.1rem;
    margin-bottom: 0;
}

.header-text p {
    font-size: 0.9rem;
    opacity: 0.9;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
    max-height: 2rem;
    overflow: hidden;
}

.app-header.scrolled .header-text p {
    opacity: 0;
    max-height: 0;
    margin: 0;
    font-size: 0;
}

/* ============================================
   Tab Navigation
   ============================================ */
.tab-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 100px;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 90;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    transition: top 0.3s ease;
}

body.scrolled .tab-nav {
    top: 50px;
}

.tab-scroll {
    display: flex;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    min-width: min-content;
}

.tab-button {
    background: none;
    border: none;
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.tab-button.active {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.tab-button:hover:not(.active) {
    background: rgba(0, 122, 255, 0.1);
}

/* ============================================
   View Mode Switcher
   ============================================ */
.view-mode-switcher {
    padding: 1rem;
    margin: 0 auto;
}

.segmented-control {
    display: flex;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0.25rem;
    box-shadow: 0 2px 8px var(--shadow-color);
    min-width: 240px;
}

.segment {
    flex: 1;
    background: none;
    border: none;
    padding: 0.7rem 0.4rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    min-width: 0;
}

.segment span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.segment.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 2px 6px var(--shadow-color);
}

/* ============================================
   Main Content
   ============================================ */
.content {
    flex: 1;
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
}

/* ============================================
   Loading State
   ============================================ */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 122, 255, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-state p {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   Error State
   ============================================ */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 2rem;
    gap: 1rem;
    text-align: center;
}

.error-icon {
    font-size: 4rem;
}

.error-state h3 {
    font-size: 1.5rem;
    color: var(--error-color);
}

.error-state p {
    color: var(--text-secondary);
    max-width: 400px;
}

.retry-button {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    transition: transform 0.2s;
}

.retry-button:active {
    transform: scale(0.95);
}

/* ============================================
   Glass Card Effect
   ============================================ */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px var(--shadow-color);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border-color);
}

.card-header .icon {
    font-size: 1.75rem;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.card-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ============================================
   Table View
   ============================================ */
.table-container {
    margin-bottom: 1.5rem;
}

.table-content {
    padding: 1rem;
}

.table-row {
    display: grid;
    grid-template-columns: 40px 1fr auto auto auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(0, 122, 255, 0.05);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.table-row:hover {
    background: rgba(0, 122, 255, 0.1);
    transform: translateX(2px);
}

.table-row.highlighted {
    background: var(--adendorf-highlight);
    border: 1.5px solid var(--adendorf-color);
    font-weight: 600;
}

.position {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
}

.table-row.highlighted .position {
    color: var(--adendorf-color);
}

.team-name {
    font-size: 0.9rem;
    line-height: 1.3;
}

.table-row.highlighted .team-name {
    color: var(--adendorf-color);
}

.stats-compact {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.stat-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 32px;
}

.stat-value {
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.stat-cell.wins .stat-value { color: var(--success-color); }
.stat-cell.draws .stat-value { color: var(--warning-color); }
.stat-cell.losses .stat-value { color: var(--error-color); }

.points {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
}

.points-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
}

.table-row.highlighted .points-value {
    color: var(--adendorf-color);
}

.points-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* ============================================
   Matches View
   ============================================ */
.matches-container {
    margin-bottom: 1.5rem;
}

.match-row {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: rgba(142, 142, 147, 0.1);
    border-radius: 14px;
    transition: all 0.2s ease;
}

.match-row:hover {
    background: rgba(142, 142, 147, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.match-row.adendorf-match {
    background: var(--adendorf-highlight);
    border: 1.5px solid rgba(255, 149, 0, 0.3);
}

.match-row.match-clickable {
    cursor: pointer;
}

.match-row.match-clickable:hover {
    background: rgba(0, 122, 255, 0.15);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.2);
}

.match-row.adendorf-match.match-clickable:hover {
    background: linear-gradient(135deg, rgba(255, 149, 0, 0.3), rgba(255, 149, 0, 0.2));
    border-color: var(--adendorf-color);
}

.match-info {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.match-info-left {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.match-info-right {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.match-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.match-badge.date { color: var(--primary-color); }
.match-badge.time { color: var(--success-color); }
.match-badge.report-link {
    color: var(--primary-color);
    background: rgba(0, 122, 255, 0.15);
    font-weight: 600;
}

.match-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.75rem;
    align-items: center;
}

.team {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.team.home {
    text-align: right;
    align-items: flex-end;
}

.team.away {
    text-align: left;
    align-items: flex-start;
}

.team-name-match {
    font-size: 0.95rem;
    line-height: 1.3;
}

.team-name-match.adendorf {
    font-weight: 700;
    color: var(--adendorf-color);
}

.team-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.team-badge.away {
    background: linear-gradient(135deg, var(--secondary-color), #9F3EB6);
}

.match-result {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    padding: 0.6rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
}

.match-result.no-result {
    background: linear-gradient(135deg, rgba(142, 142, 147, 0.5), rgba(142, 142, 147, 0.3));
    font-size: 0.9rem;
}

/* ============================================
   Dashboard View
   ============================================ */
.stats-container {
    display: block;
}

/* Kompaktere Darstellung für Kacheln auf Desktop */
@media (min-width: 768px) {
    .dashboard-content {
        padding: 1rem;
        gap: 1rem;
    }

    .countdown-section {
        padding: 1rem;
    }

    .countdown-timer {
        gap: 0.5rem;
    }

    .countdown-item {
        min-width: 50px;
        padding: 0.5rem 0.75rem;
    }

    .countdown-value {
        font-size: 1.4rem;
    }

    .form-circle {
        width: 38px;
        height: 38px;
    }

    .form-letter {
        font-size: 0.95rem;
    }

    .radar-chart {
        width: 160px;
        height: 160px;
    }

    .milestone-item {
        padding: 0.75rem;
    }

    .milestone-icon {
        font-size: 1.25rem;
    }

    .dashboard-section {
        margin-bottom: 0;
    }
}

.dashboard-section {
    margin-bottom: 1.5rem;
}

.team-badge-large {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
}

.dashboard-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.dashboard-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(0, 122, 255, 0.05);
    border-radius: 12px;
}

.stat-icon {
    font-size: 2rem;
}

.dashboard-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.dashboard-stat .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
}

/* Dashboard Matches */
.dashboard-matches {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dashboard-match {
    padding: 1.25rem;
    background: rgba(142, 142, 147, 0.1);
    border-radius: 12px;
}

.dashboard-match.upcoming {
    background: rgba(52, 199, 89, 0.1);
    border: 1.5px solid rgba(52, 199, 89, 0.3);
}

.dashboard-match.completed {
    background: rgba(0, 122, 255, 0.1);
    border: 1.5px solid rgba(0, 122, 255, 0.3);
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.match-label {
    font-weight: 600;
    color: var(--primary-color);
}

.match-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.match-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.match-team {
    font-weight: 500;
    text-align: center;
}

.match-vs {
    padding: 0.5rem 0.75rem;
    background: white;
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-secondary);
}

.match-result {
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 8px;
    font-weight: 700;
}

/* Dashboard Bilanz */
.dashboard-bilanz {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 0;
}

.dashboard-bilanz h4 {
    margin: 0;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.bilanz-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bilanz-row {
    display: grid;
    grid-template-columns: 40px 1fr auto auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.bilanz-row:hover {
    background: rgba(0, 122, 255, 0.05);
    transform: translateX(2px);
}

.bilanz-rang {
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
}

.bilanz-name {
    font-weight: 500;
}

.bilanz-einsaetze {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.bilanz-gesamt {
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--success-color);
    min-width: 60px;
    text-align: right;
}

/* ============================================
   Footer
   ============================================ */
.app-footer {
    margin-top: auto;
    padding: 2rem 1rem 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.footer-hint {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ============================================
   Install Hint (iOS)
   ============================================ */
.install-hint {
    position: fixed;
    bottom: -200px;
    left: 1rem;
    right: 1rem;
    z-index: 1000;
    transition: bottom 0.3s ease;
}

.install-hint.visible {
    bottom: 1rem;
}

.install-hint-content {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.install-hint-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.install-hint-text {
    flex: 1;
}

.install-hint-text strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.install-hint-text p {
    font-size: 0.85rem;
    opacity: 0.9;
    margin: 0;
}

.install-hint-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.install-hint-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   Match Report Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--surface-color);
    border-radius: 20px;
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 20px 20px 0 0;
    transition: padding 0.3s ease;
    gap: 1rem;
    flex-wrap: wrap;
}

.modal-header.scrolled {
    padding: 1rem 1.5rem;
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    transition: font-size 0.3s ease;
}

.modal-header.scrolled h2 {
    font-size: 1.1rem;
}

.modal-refresh-info {
    display: none !important;
}

@media (min-width: 768px) {
    .modal-refresh-info {
        display: flex !important;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.75rem;
        background: rgba(255, 255, 255, 0.15);
        padding: 0.4rem 0.6rem;
        border-radius: 8px;
    }

    .modal-refresh-info .refresh-icon {
        font-size: 0.9rem;
    }

    .modal-refresh-info .refresh-status {
        color: rgba(255, 255, 255, 0.9);
        font-size: 0.75rem;
    }

    .modal-refresh-info .refresh-live {
        color: rgba(255, 255, 255, 0.95);
        font-weight: 600;
        font-size: 0.75rem;
    }
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    overflow-y: auto;
    padding: 1.5rem;
    flex: 1;
}

.modal-body .loading-state {
    padding: 3rem 1rem;
}

.match-report-content {
    padding: 1rem 0;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.report-table th,
.report-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.report-table th {
    background: rgba(0, 122, 255, 0.1);
    font-weight: 600;
    color: var(--primary-color);
}

.report-table tr:hover {
    background: rgba(0, 122, 255, 0.05);
}

.report-table tr:last-child td {
    border-bottom: none;
}

/* Hervorhebung der vorletzten Spalte (Sätze) */
.report-table td:nth-last-child(2),
.report-table th:nth-last-child(2) {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.05em;
}

/* Letzte Spalte (Gesamt) normal */
.report-table td:last-child,
.report-table th:last-child {
    font-weight: 400;
    color: var(--text-primary);
    font-size: 1em;
}

/* Gewinner-Zeile fett (letzte Zeile im tbody ist normalerweise der Gesamt) */
.report-table tbody tr:last-child td {
    font-weight: 700;
    background: rgba(0, 122, 255, 0.08);
}

/* Aber die letzte Zelle der Gewinner-Zeile bleibt normal */
.report-table tbody tr:last-child td:last-child {
    font-weight: 400;
}

/* Responsive table for small screens */
@media (max-width: 768px) {
    .report-table {
        display: block;
    }

    .report-table thead {
        display: none; /* Hide header on mobile */
    }

    .report-table tbody {
        display: block;
    }

    .report-table tr {
        display: block;
        margin-bottom: 1rem;
        background: rgba(0, 122, 255, 0.05);
        border-radius: 12px;
        padding: 0.75rem;
        border: 1px solid var(--border-color);
    }

    .report-table td {
        display: block;
        text-align: left !important;
        padding: 0.5rem 0;
        border: none;
        position: relative;
        padding-left: 50%;
        min-height: 1.5rem; /* Verhindert Zusammenrutschen */
    }

    /* Verstecke leere Zellen komplett */
    .report-table td:empty {
        display: none;
    }

    .report-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: var(--primary-color);
    }

    .report-table td:first-child {
        font-size: 1.1rem;
        font-weight: 700;
        padding-left: 0;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 0.5rem;
    }

    .report-table td:first-child:before {
        display: none;
    }

    /* Letztes TD ist das "Gesamt" Ergebnis - mache es fett */
    .report-table td:last-child {
        font-weight: 700;
        font-size: 1.05rem;
        color: var(--primary-color);
        margin-top: 0.5rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border-color);
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
    display: none !important;
}

/* Dashboard Mobile/Desktop layout containers */
.dashboard-countdowns-mobile {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-details-mobile {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.dashboard-full-desktop {
    display: none;
}

/* Desktop: Show full layout, hide mobile sections */
@media (min-width: 1024px) {
    .dashboard-countdowns-mobile {
        display: none;
    }

    .dashboard-details-mobile {
        display: none;
    }

    .dashboard-full-desktop {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
        align-items: start;
    }
}

/* Tablet: 2 columns for desktop view */
@media (min-width: 768px) and (max-width: 1023px) {
    .dashboard-countdowns-mobile {
        display: none;
    }

    .dashboard-details-mobile {
        display: none;
    }

    .dashboard-full-desktop {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        align-items: start;
    }

    .dashboard-full-desktop .dashboard-section:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

/* No match section styling */
.no-match-section {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    background: rgba(142, 142, 147, 0.1);
    border-radius: 12px;
}

.no-match-section p {
    margin: 0;
    font-size: 0.95rem;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .header-text h1 { font-size: 1.25rem; }
    
    .table-row {
        font-size: 0.85rem;
        grid-template-columns: 35px 1fr auto auto;
    }
    
    .stats-compact {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .stat-cell {
        flex-direction: row;
        gap: 0.25rem;
    }
    
    .match-teams {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .team.home, .team.away {
        text-align: center;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .content { padding: 0.75rem; }
    .tab-button { font-size: 0.85rem; padding: 0.5rem 1rem; }

    .segment {
        font-size: 0.8rem;
        padding: 0.6rem 0.3rem;
        min-width: 0;
        gap: 0.2rem;
    }

    .segment span {
        gap: 0.2rem;
    }

    .header-text h1 {
        font-size: 1.25rem;
    }

    .app-header.scrolled .header-text h1 {
        font-size: 1.1rem;
    }

    .header-icon {
        font-size: 2rem;
    }

    .app-header.scrolled .header-icon {
        font-size: 1.5rem;
    }
}

@media (max-width: 375px) {
    .segment {
        font-size: 0.75rem;
        padding: 0.6rem 0.25rem;
    }

    .segmented-control {
        padding: 0.2rem;
    }
}

html { scroll-behavior: smooth; }

/* ============================================
   Countdown Section
   ============================================ */
.countdown-section {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.15), rgba(88, 86, 214, 0.1));
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid rgba(0, 122, 255, 0.2);
}

.countdown-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.countdown-icon {
    font-size: 1.5rem;
}

.countdown-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.countdown-timer {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    min-width: 60px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.countdown-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    line-height: 1;
}

.countdown-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-top: 0.25rem;
}

.countdown-match-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.vs-badge {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.countdown-date {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ============================================
   Form Curve Section
   ============================================ */
.form-curve-section {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.section-icon {
    font-size: 1.25rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
}

.form-trend {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.form-trend.trending-up {
    background: rgba(52, 199, 89, 0.15);
    color: var(--success-color);
}

.form-trend.trending-down {
    background: rgba(255, 59, 48, 0.15);
    color: var(--error-color);
}

.form-trend.neutral {
    background: rgba(142, 142, 147, 0.15);
    color: var(--text-secondary);
}

.form-curve {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: default;
}

.form-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.form-circle:hover {
    transform: scale(1.1);
}

.form-circle.win {
    background: linear-gradient(135deg, #34C759, #30B350);
    color: white;
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.4);
}

.form-circle.loss {
    background: linear-gradient(135deg, #FF3B30, #E8352B);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.4);
}

.form-circle.draw {
    background: linear-gradient(135deg, #FF9500, #E88A00);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.4);
}

.form-letter {
    font-size: 1.1rem;
}

.form-score {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   Home/Away Section
   ============================================ */
.home-away-section {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.home-away-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.home-away-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.home-away-card.home {
    border-left: 3px solid var(--success-color);
}

.home-away-card.away {
    border-left: 3px solid var(--warning-color);
}

.ha-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ha-icon {
    font-size: 1.25rem;
}

.ha-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.ha-stats {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.75rem;
}

.ha-record {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ha-percentage {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.ha-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.ha-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.ha-bar-fill.home {
    background: linear-gradient(90deg, var(--success-color), #2AA04A);
}

.ha-bar-fill.away {
    background: linear-gradient(90deg, var(--warning-color), #E88A00);
}

/* ============================================
   Radar Chart Section
   ============================================ */
.radar-section {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.radar-chart-container {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}

.radar-chart {
    width: 200px;
    height: 200px;
}

.radar-grid {
    fill: none;
    stroke: rgba(0, 0, 0, 0.1);
    stroke-width: 1;
}

.radar-axis {
    stroke: rgba(0, 0, 0, 0.15);
    stroke-width: 1;
}

.radar-area {
    fill: rgba(0, 122, 255, 0.25);
    stroke: var(--primary-color);
    stroke-width: 2;
    transition: all 0.3s ease;
}

.radar-area:hover {
    fill: rgba(0, 122, 255, 0.35);
}

.radar-point {
    fill: var(--primary-color);
    stroke: white;
    stroke-width: 2;
}

.radar-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.radar-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-label {
    flex: 1;
    color: var(--text-secondary);
}

.legend-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   Milestones Section
   ============================================ */
.milestones-section {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.milestones-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.milestone-item {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

.milestone-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.milestone-item.achieved {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.1), rgba(52, 199, 89, 0.05));
    border: 1px solid rgba(52, 199, 89, 0.3);
}

.milestone-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.milestone-icon {
    font-size: 1.5rem;
}

.milestone-title {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
}

.milestone-badge {
    background: var(--success-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.milestone-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 5px;
    transition: width 0.5s ease;
}

.milestone-item.achieved .progress-fill {
    background: linear-gradient(90deg, var(--success-color), #2AA04A);
}

.progress-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: right;
}

.milestone-countdown {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--warning-color);
    font-weight: 500;
}

/* ============================================
   Responsive adjustments for new sections
   ============================================ */
@media (max-width: 480px) {
    .countdown-timer {
        gap: 0.5rem;
    }

    .countdown-item {
        min-width: 50px;
        padding: 0.5rem 0.75rem;
    }

    .countdown-value {
        font-size: 1.4rem;
    }

    .form-curve {
        gap: 0.75rem;
    }

    .form-circle {
        width: 38px;
        height: 38px;
    }

    .form-letter {
        font-size: 1rem;
    }

    .home-away-grid {
        grid-template-columns: 1fr;
    }

    .radar-chart {
        width: 160px;
        height: 160px;
    }

    .radar-legend {
        grid-template-columns: 1fr;
    }
}
