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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #001a33 0%, #003366 50%, #004d99 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    padding-bottom: 350px;
    color: #333;
    text-align: center;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Offline Page Styles */
.offline-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
    padding: 20px;
}

.offline-container.active {
    display: flex;
}

.offline-logo {
    width: 150px;
    height: 150px;
    margin-bottom: 30px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.offline-message {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.offline-message h2 {
    color: #003366;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.offline-message p {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
}

.retry-button {
    margin-top: 20px;
    padding: 12px 30px;
    background: linear-gradient(135deg, #003366, #004d99);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 51, 102, 0.3);
}

/* Header */
h1 {
    text-align: center;
    color: white;
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    margin-bottom: 15px;
    animation: fadeInDown 0.6s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Status Info */
.infos {
    text-align: center;
    color: white;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 25px;
    border-radius: 50px;
    display: inline-block;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.8s ease-out;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* Countdown Box */
#countdown {
    background: linear-gradient(135deg, #dc143c, #ff4444);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 20px auto;
    max-width: 600px;
    box-shadow: 0 8px 25px rgba(220, 20, 60, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

/* Push Einstellungen Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.overlay-content {
    background: #fff;
    margin: 10% auto;
    padding: 20px;
    width: 90%;
    max-width: 400px;
    border-radius: 10px;
    position: relative;
}

.close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
}

#tagsForm button[type="submit"] {
    width: 100%;
    padding: 12px;
    font-size: 1.2em;
    border: none;
    border-radius: 8px;
    background-color: #1e90ff;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

#tagsForm button[type="submit"]:hover {
    background-color: #0d6efd;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

#tagsForm button[type="submit"]:active {
    transform: translateY(1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

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

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

/* Game Cards */
.game-card {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    width: 350px;
    flex-direction: column;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.game-card:hover {
    transform: scale(1.03);
    background: rgba(255, 255, 255, 0.15);
}

.game-card.adler {
    background: rgba(255, 0, 0, 0.2);
    border: 2px solid rgba(255, 0, 0, 0.5);
}

/* Score Display */
.score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
}

.score-row img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.team-box {
    width: 60px;
    height: 60px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.team-box img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.team-text-box {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

.team-text {
	color: white;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
    text-align: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 5px;
}

.team-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.team-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-align: center;
    min-height: 20px;
    max-width: 80px;
    word-wrap: break-word;
}

.score {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    margin: 0 5px;
    padding: 2px 5px;
    border-radius: 4px;
}

/* Winner Score gold markieren */
.winner-left {
    background: gold;
    color: black;
}

.winner-right {
    background: gold;
    color: black;
}

.status {
    margin-top: 10px;
    font-size: 1rem;
    font-weight: bold;
}

.status.live {
    color: red;
    font-weight: bold;
}

/* Playoff Container */
.container {
    display: flex;
    justify-content: center;
    gap: 80px;
    flex-wrap: wrap;
    align-items: flex-start;
    min-height: 400px;
}

.column {
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 220px;
    gap: 20px;
}

.column.preplayoffs { justify-content: center; }
.column.viertel { justify-content: flex-start; }
.column.halb { justify-content: center; }
.column.finale { justify-content: center; }

.column h2 { margin-bottom: 15px; }

/* Champion Box */
#champion-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 30px;
}

#champion {
    background: rgba(255, 215, 0, 0.15);
    border: 2px solid gold;
    border-radius: 15px;
    padding: 20px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.5s ease-out;
}

#champion.show {
    opacity: 1;
    transform: scale(1);
}

#champion h2 {
    margin: 5px;
    color: gold;
    font-size: 1.3rem;
}

#champion img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin: 10px 0;
}

#champion .team-text {
    width: 80px;
    height: 80px;
    font-size: 1rem;
    margin: 10px 0;
}

#champion-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

/* Tables */
table {
    width: 95%;
    max-width: 1000px;
    margin: 20px auto;
    border-collapse: separate;
    border-spacing: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-radius: 25px;
    overflow: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Toggle-Section Boxen */
.toggle-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 25px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: none !important;
    overflow: hidden;
    margin: 20px auto !important;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

.toggle-header {
    background: linear-gradient(135deg, #003366, #004d99) !important;
    border-radius: 0 !important;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    padding: 15px;
    font-weight: 600;
}

.toggle-header:hover {
    background: linear-gradient(135deg, #004d99, #0066cc) !important;
}

.toggle-content {
    background: transparent;
    display: block;
}

th, td {
    padding: 14px 12px;
    text-align: center;
}

th {
    background: linear-gradient(135deg, #003366, #004d99);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border: none;
}

td {
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
}

tr:hover td {
    background-color: #f8f9fa;
}

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

tr:nth-child(even) td {
    background-color: #f9f9f9;
}

tr:nth-child(even):hover td {
    background-color: #f0f0f0;
}

/* Legende Tabelle */
.toggle-content td[bgcolor] {
    color: white !important;
    font-weight: normal !important;
    background: transparent !important;
}

.toggle-content td[bgcolor="red"] {
    background-color: #f00 !important;
}

.toggle-content td[bgcolor="#0088ff"] {
    background-color: #0088ff !important;
}

.toggle-content td[bgcolor="#6d6d6d"] {
    background-color: #6d6d6d !important;
}

/* Footer Navigation */
#footer-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

#footer-toggle {
    display: none;
    width: 100%;
    background: linear-gradient(135deg, rgba(0, 51, 102, 0.95), rgba(0, 68, 136, 0.95));
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    padding: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

#footer-toggle:active {
    background: linear-gradient(135deg, rgba(0, 68, 136, 0.95), rgba(0, 51, 102, 0.95));
    transform: scale(0.98);
}

#footer-toggle .arrow {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 1rem;
    margin-left: 8px;
}

#footer-toggle.open .arrow {
    transform: rotate(180deg);
}

#footer-link {
    background: rgba(0, 51, 102, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

#footer-link a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 20px;
    margin: 0 10px;
    border-radius: 25px;
    transition: all 0.3s ease;
    display: inline-block;
    font-size: 0.95rem;
}

#footer-link a:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    text-decoration: none;
    color: white;
}

/* Scrollbar Styling */
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #003366, #0066cc);
    border-radius: 10px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #003366;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        align-items: center;
    }
    
    .column {
        justify-content: flex-start;
    }
    
    #footer-toggle {
        display: block;
    }
    
    #footer-link {
        max-height: 0;
        overflow: hidden;
        padding: 0 15px;
        opacity: 0;
    }
    
    #footer-link.active {
        max-height: 200px;
        padding: 15px;
        opacity: 1;
    }
    
    #footer-link a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin: 8px 5px;
        min-height: 44px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    body {
        padding-bottom: 70px;
    }
}

@media only screen and (max-width: 600px) {
    body {
        padding: 10px;
        padding-bottom: 100px;
        -webkit-overflow-scrolling: touch;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
        padding: 0 10px;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    .infos {
        font-size: 0.85rem;
        padding: 8px 15px;
        margin-bottom: 15px;
    }

    #countdown {
        font-size: 1rem;
        padding: 15px;
        margin: 15px auto;
    }

    .offline-logo {
        width: 120px;
        height: 120px;
        font-size: 3rem;
    }

    .offline-message h2 {
        font-size: 1.5rem;
    }

    .offline-message p {
        font-size: 1rem;
    }

    table {
        width: 100%;
        border-radius: 20px;
        margin: 15px auto;
    }

    table:not(.standings), table:not(.standings) thead, table:not(.standings) tbody {
        display: block;
        width: 100%;
    }

    table:not(.standings) tr {
        display: block;
        margin-bottom: 12px;
        background: white;
        padding: 10px;
        border-radius: 15px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    table:not(.standings) tr:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    table:not(.standings) th {
        display: none;
    }

    table:not(.standings) td {
        display: flex;
        justify-content: space-between;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        padding: 10px 5px;
        text-align: left;
        flex-wrap: nowrap;
        overflow-x: auto;
        background: transparent !important;
        -webkit-overflow-scrolling: touch;
    }

    table:not(.standings) td:last-child {
        border-bottom: none;
    }

    table:not(.standings) td:empty {
        display: none;
    }

    table:not(.standings) td::before {
        content: attr(data-label);
        font-weight: 600;
        width: 45%;
        flex-shrink: 0;
        margin-right: 10px;
        color: #003366;
        text-align: left;
        font-size: 0.85rem;
    }

    table:not(.standings) td span {
        flex-grow: 1;
        text-align: right;
        max-width: 55%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.85rem;
    }

    /* Mobile Legende Fix */
    .toggle-content td[bgcolor] {
        background: transparent !important;
        display: table-cell !important;
        border: none !important;
        padding: 8px !important;
    }

    .toggle-content td[bgcolor]::before {
        content: '' !important;
    }

    .toggle-content td[bgcolor="red"] {
        background-color: #f00 !important;
    }

    .toggle-content td[bgcolor="#0088ff"] {
        background-color: #0088ff !important;
    }

    .toggle-content td[bgcolor="#6d6d6d"] {
        background-color: #6d6d6d !important;
    }
}