/**********************************************
 * MOBILE.CSS - Komplettes Responsive Design
 * Optimiert für die gesamte PvP Portal Website
 * Smartphones (320px+), Tablets (768px+), Desktop (1024px+)
 **********************************************/

/**********************************************
 * 1. BASE MOBILE STYLES
 **********************************************/

/* Smartphones (320px - 768px) */
@media screen and (max-width: 768px) {
    
    /* === ALLGEMEINE LAYOUT OPTIMIERUNGEN === */
    .container {
        padding: 0 1rem;
        max-width: 100%;
    }
    
    /* === HEADER & NAVIGATION === */
    header {
        padding: 0.5rem 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
    }
    
    .logo a {
        font-size: 1.4rem !important;
        font-weight: 600 !important;
    }
    
    /* Hide original navigation on mobile */
    nav ul {
        display: none;
    }
    
    /* === MOBILE HAMBURGER BUTTON === */
    .mobile-hamburger {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 22px;
        height: 16px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1001;
        transition: all 0.3s ease;
    }
    
    .mobile-hamburger span {
        display: block;
        height: 2px;
        width: 100%;
        background: var(--text-color);
        border-radius: 1px;
        transition: all 0.3s ease;
        transform-origin: center;
    }
    
    .mobile-hamburger:hover span {
        background: var(--primary-color);
    }
    
    /* Hamburger Animation - Open State */
    .mobile-hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-hamburger.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
    
    .mobile-hamburger.active span {
        background: var(--primary-color);
    }
    
    /* === MOBILE SIDEBAR === */
    .mobile-sidebar {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        max-width: 75vw;
        height: 100vh;
        background: var(--background-elevated);
        border-left: 1px solid var(--border-color);
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        transition: right 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .mobile-sidebar.active {
        right: 0;
    }
    
    .mobile-nav-content {
        padding: 1rem 0 2rem 0;
    }
    
    /* === MOBILE NAVIGATION LINKS === */
    .mobile-nav-section {
        padding: 0;
    }
    
    .mobile-nav-link {
        display: flex;
        align-items: center;
        padding: 1rem 1.5rem;
        color: var(--text-color);
        text-decoration: none;
        border-bottom: 1px solid var(--border-light);
        transition: all 0.2s ease;
        font-size: 1.1rem;
        min-height: 44px;
    }
    
    .mobile-nav-link:hover {
        background: var(--background-hover);
        color: var(--primary-color);
        padding-left: 2rem;
    }
    
    .mobile-nav-link:active {
        background: var(--primary-color);
        color: white;
    }
    
    /* Mobile Notification Badge */
    .mobile-notification-badge {
        background: var(--primary-color);
        color: white;
        border-radius: 50%;
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
        font-weight: bold;
        margin-left: auto;
        min-width: 18px;
        text-align: center;
        line-height: 1;
    }
    
    /* === MOBILE SETTINGS SECTION === */
    .mobile-settings-section {
        margin-top: 1rem;
        padding: 0;
    }
    
    .mobile-settings-divider {
        height: 2px;
        background: var(--border-color);
        margin: 1rem 0;
    }
    
    .mobile-settings-label {
        padding: 0.5rem 1.5rem;
        font-size: 0.8rem;
        color: var(--text-muted);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .mobile-settings-item {
        display: flex;
        align-items: center;
        padding: 0.8rem 1.5rem;
        color: var(--text-color);
        text-decoration: none;
        border: none;
        background: transparent;
        width: 100%;
        text-align: left;
        cursor: pointer;
        transition: all 0.2s ease;
        font-size: 1rem;
        min-height: 44px;
        gap: 0.8rem;
    }
    
    .mobile-settings-item:hover {
        background: var(--background-hover);
        color: var(--primary-color);
        padding-left: 2rem;
    }
    
    .mobile-theme-icon,
    .mobile-flag {
        font-size: 1.2rem;
        min-width: 24px;
    }
    
    /* === MOBILE OVERLAY === */
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* === MOBILE DARK MODE ANPASSUNGEN === */
    @media (prefers-color-scheme: dark) {
        .mobile-sidebar {
            box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
        }
    }
    
    /* === PROFILE FORM BUTTONS === */
    .profile-form form > div[style*="display: flex"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.8rem !important;
        justify-content: center !important;
        margin-top: 1.5rem !important;
    }
    
    .profile-form .button {
        width: 100% !important;
        max-width: none !important;
        text-align: center;
    }
    
    /* === CHARACTER MANAGEMENT BUTTONS === */
    /* "Neuen Character erstellen" Button */
    .info-box .button {
        display: inline-block;
        width: auto !important;
        max-width: 70%;
        margin: 1.2rem auto 0 auto;
        padding: 0.8rem 1.5rem;
        text-align: center;
    }
    
    /* Character Creation Buttons */
    .creation-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.8rem !important;
        align-items: center !important;
        margin-top: 2rem !important;
    }
    
    .creation-buttons .button {
        width: 70% !important;
        max-width: 300px !important;
        text-align: center !important;
    }
    
    /* === FORMS & INPUTS === */
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    .form-control {
        font-size: 1rem; /* Verhindert Zoom auf iOS */
        padding: 0.8rem;
    }
    
    /* === BUTTONS === */
    .button {
        padding: 0.8rem 1rem;
        font-size: 1rem;
        width: auto !important;
        margin: 0 auto 0.5rem auto !important;
        display: inline-block !important;
        min-height: 44px; /* Touch-Target-Größe */
        text-align: center !important;
    }
    
    /* === MODALS === */
    .modal-content {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
    
    /* === FLASH MESSAGES === */
    .flash-messages {
        margin: 0;
        padding: 0 1rem;
        width: 100%;
    }
    
    .flash-message {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
        margin: 0.5rem 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* === PROFILE SECTION === */
    .profile-header {
        text-align: center;
        padding: 1rem;
    }
    
    .profile-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.8rem;
    }
    
    .profile-actions {
        margin-top: 1rem;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    /* === CHARACTER CARDS === */
    .character-profile-cards {
        grid-template-columns: 1fr !important;
        gap: 1rem;
        max-width: none !important;
    }
    
    /* Alle Character Cards gleich formatieren */
    .character-count-1,
    .character-count-2,
    .character-count-3 {
        grid-template-columns: 1fr !important;
        max-width: none !important;
    }
    
    .character-profile-card {
        max-width: none;
        grid-column: auto !important;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .character-profile-card .delete-form {
        margin-top: auto;
        padding-top: 1rem;
    }
    
    .character-profile-card .delete-form .button {
        width: 60% !important;
        max-width: 200px !important;
        margin: 0 auto;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        text-align: center;
    }
    
    .team-members-grid {
        grid-template-columns: 1fr;
        max-width: none;
    }
    
    /* Team Grid Responsive Anpassungen */
    .team-members-2-count,
    .team-members-3-count,
    .team-members-4-count {
        grid-template-columns: 1fr;
        max-width: 320px;
    }
    
    /* === TOURNAMENT TABLES === */
    .tournament-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tournament-table {
        min-width: 600px;
    }
    
    /* === FIX: Einheitliche Tabellenbreite für ALLE Turnierphasen === */
    #semifinal-container .tournament-table,
    #thirdplace-container .tournament-table,
    #final-container .tournament-table,
    #tiebreaker-container .tournament-table,
    .tournament-accordion-content .tournament-table {
        min-width: 600px !important;
        width: 100% !important;
    }
    
    /* Stelle sicher, dass alle Container gleich breit sind */
    #semifinal-container,
    #thirdplace-container,
    #final-container,
    #tiebreaker-container,
    .tournament-accordion-content {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* === FIX: Einheitliche Spaltenbreiten für ALLE Turnierphasen === */
    #semifinal-container .matchup-pairing,
    #thirdplace-container .matchup-pairing,
    #final-container .matchup-pairing,
    #tiebreaker-container .matchup-pairing,
    .tournament-accordion-content .matchup-pairing {
        width: 70% !important;
        min-width: 300px !important;
    }
    
    /* === FIX: Feste Breiten NUR für 1vs1 in ALLEN Turnierphasen === */
    #semifinal-container:not(:has(.team-name)) .player,
    #thirdplace-container:not(:has(.team-name)) .player,
    #final-container:not(:has(.team-name)) .player,
    #tiebreaker-container:not(:has(.team-name)) .player,
    .tournament-accordion-content:not(:has(.team-name)) .player {
        width: 150px !important;  /* Gleiche feste Breite wie .team-name */
        flex: none !important;    /* Nicht mehr flexible */
        flex-shrink: 0 !important;
    }
    
    /* Hintergrundbilder für Icons wiederherstellen */
    .character-class-icon,
    .character-teaching-icon {
        background-size: contain !important;
        background-repeat: no-repeat !important;
        background-position: center !important;
    }
    
    #semifinal-container .matchup-result,
    #thirdplace-container .matchup-result,
    #final-container .matchup-result,
    #tiebreaker-container .matchup-result,
    .tournament-accordion-content .matchup-result {
        width: 15% !important;
        text-align: center !important;
    }
    
    #semifinal-container .matchup-status,
    #thirdplace-container .matchup-status,
    #final-container .matchup-status,
    #tiebreaker-container .matchup-status,
    .tournament-accordion-content .matchup-status {
        width: 15% !important;
        text-align: center !important;
    }
    
    /* === FIX: Scrollbar statt Abschneiden für ALLE Turnierphasen === */
    #semifinal-container,
    #thirdplace-container,
    #final-container,
    #tiebreaker-container,
    .tournament-accordion-content {
        overflow-x: auto !important;  /* Horizontale Scrollbar wenn nötig */
        overflow-y: visible !important;  /* Vertikal nicht abschneiden */
        -webkit-overflow-scrolling: touch !important;  /* Smooth scrolling auf iOS */
        padding-bottom: 0 !important;  /* Kein Padding unten */
        margin-bottom: 0 !important;   /* Kein Margin unten */
    }
    
    /* === FIX: Akkordeon ohne weiße Fläche nach orangenem Strich === */
    .tournament-accordion-content {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }
    
    .tournament-section {
        margin-bottom: 1rem !important;  /* Nur zwischen den Sektionen */
    }
    
    #semifinal-container .tournament-table-container,
    #thirdplace-container .tournament-table-container,
    #final-container .tournament-table-container,
    #tiebreaker-container .tournament-table-container,
    .tournament-accordion-content .tournament-table-container {
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
        min-height: auto !important;
        padding-bottom: 1rem !important;
    }
    
    /* Keine Höhenbeschränkungen für alle Turnierphasen */
    #semifinal-container tbody,
    #semifinal-container tr,
    #semifinal-container td,
    #thirdplace-container tbody,
    #thirdplace-container tr,
    #thirdplace-container td,
    #final-container tbody,
    #final-container tr,
    #final-container td,
    #tiebreaker-container tbody,
    #tiebreaker-container tr,
    #tiebreaker-container td,
    .tournament-accordion-content tbody,
    .tournament-accordion-content tr,
    .tournament-accordion-content td {
        overflow: visible !important;
        min-height: auto !important;
        height: auto !important;
    }
    
    /* === INFO SECTIONS === */
    .info-buttons-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .info-callout-item {
        padding: 0.8rem;
    }
    
    /* Step Guide Mobile */
    .info-step-number {
        width: 35px;
        height: 35px;
        font-size: 1.1em;
        margin-right: 15px;
    }
    
    .info-step-content h4 {
        font-size: 1em;
    }
    
    /* Regel-Liste Mobile */
    .info-rule-icon {
        font-size: 1.2em;
        margin-right: 12px;
        min-width: 20px;
    }
    
    .info-rule-text {
        font-size: 0.95em;
    }
    
    /* System Badges Mobile */
    .info-system-badge-container {
        padding: 20px;
    }
    
    .info-badge-header {
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .info-badge-icon {
        font-size: 1.8em;
    }
    
    .info-badge-title {
        font-size: 1.2em;
    }
    
    .info-badge-features li {
        font-size: 0.9em;
        padding-left: 18px;
    }
    
    /* FAQ Accordion Mobile */
    .info-accordion-content.active {
        padding: 15px;
        max-height: 400px;
    }
    
    .info-accordion-content p {
        font-size: 0.9em;
    }
    
    /* Team Kontakt Mobile */
    .info-team-member {
        padding: 20px;
    }
    
    .info-member-avatar {
        width: 70px;
        height: 70px;
        margin-bottom: 12px;
    }
    
    .info-member-name {
        font-size: 1.2em;
    }
    
    /* Random Draw Mobile */
    .pool-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .draw-button {
        padding: 15px 30px;
        font-size: 18px;
    }

    .option-buttons {
        flex-direction: column;
        align-items: center;
    }

    .option-buttons .btn {
        width: 100%;
        max-width: 250px;
    }
    
    /* === PODIUM === */
    .podium-place {
        min-height: 150px;
        width: 100%;
        max-width: 300px;
    }

    .first-place,
    .second-place,
    .third-place {
        order: unset;
        min-height: 150px;
    }
    
    /* === DATABASE ACTIONS === */
    .db-action-cards {
        grid-template-columns: 1fr;
    }
    
    /* === ABSTAND ZWISCHEN TURNIERBESCHREIBUNG UND ADMIN-BOXEN === */
    .info-box.tournament-registration {
        margin-top: 2rem !important;
    }
    
    /* === TEAM MANAGEMENT MOBILE FIXES === */
    /* Zurück zum Profil Button */
    .d-flex .button {
        width: auto !important;
        display: inline-block !important;
        padding: 0.6rem 1.2rem !important;
        margin: 0 !important;
        font-size: 0.9rem !important;
    }
    
    /* Team auflösen und Einladung senden Buttons */
    form .button.danger,
    form .button:not(.button-cancel) {
        width: auto !important;
        display: inline-block !important;
        padding: 0.8rem 1.5rem !important;
        margin: 0 auto !important;
    }
    
    /* Team-Status Info-Box bessere Lesbarkeit - nur Struktur */
    .info-box[style*="background"] {
        padding: 1rem !important;
        border-radius: 8px !important;
        line-height: 1.5 !important;
    }
    
    .info-box[style*="background"] p {
        margin-bottom: 0.8rem !important;
        font-size: 0.9rem !important;
    }
    
    .info-box[style*="background"] strong {
        display: block !important;
        margin-bottom: 0.3rem !important;
        font-weight: bold !important;
    }
    
    /* === OFFENE EINLADUNGEN MOBILE OPTIMIZATION === */
    .tournament-accordion-content[style*="max-height: 1000px"] {
        max-height: 60vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* === MEINE TEAMS MOBILE ABSTÄNDE === */
    .teams .team-card {
        margin-bottom: 2.5rem !important;
    }
    
    .teams .team-card:last-child {
        margin-bottom: 0 !important;
    }
    
    /* === LANDING PAGE MOBILE OPTIMIERUNG === */
    .tournament-info {
        display: flex !important;
        flex-direction: column;
        gap: 1rem;
        padding: 0.5rem;
        grid-template-areas: none;
        grid-template-columns: none;
    }
    
    .tournament-info .info-box {
        width: 100% !important;
        max-width: none !important;
        min-width: auto !important;
        margin: 0 !important;
        padding: 1rem;
        min-height: auto;
        grid-area: auto !important;
    }
    
    .tournament-info .info-box:only-child {
        width: 100% !important;
        margin: 0 !important;
    }
    
    /* Detail-Buttons in Tournament Cards sollen nicht 100% Breite haben */
    .homepage-tournament-item .button {
        width: auto !important;
        display: inline-block;
        margin: 0;
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    /* === TURNIER-LISTE MOBILE OPTIMIERUNG === */
    
    /* Aktive Turniere - untereinander, Details-Button am Ende */
    .tournament-info-active {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        padding: 0.5rem !important;
    }
    
    .tournament-info-active .info-box {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 1rem !important;
        padding-bottom: 5rem !important;
        position: relative !important;
    }
    
    /* Kürzlich abgeschlossen - untereinander, Details-Button am Ende */
    .tournament-info-completed {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        padding: 0.5rem !important;
    }
    
    .tournament-info-completed .info-box {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        flex: none !important;
        min-width: auto !important;
        padding: 1rem !important;
        padding-bottom: 5rem !important;
        position: relative !important;
    }
    
    /* Archiv - untereinander, Details-Button am Ende */
    .tournament-info-archived {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        padding: 0.5rem !important;
    }
    
    .tournament-info-archived .info-box {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        flex: none !important;
        min-width: auto !important;
        padding: 1rem !important;
        padding-bottom: 5rem !important;
        position: relative !important;
    }
    
    /* Button größer machen wie die anderen */
    .tournament-info-archived .button-small {
        padding: 0.7rem 1.2rem !important;
        font-size: 1rem !important;
        min-width: auto !important;
    }
    
    /* Alle Details-Buttons in Turnierkarten am unteren Rand positionieren */
    .tournament-info-active .info-box .button,
    .tournament-info-completed .info-box .button,
    .tournament-info-archived .info-box .button,
    .tournament-info-archived .info-box .button-small {
        position: absolute !important;
        bottom: 1rem !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin: 0 !important;
    }
    
    /* === TURNIERDETAILS MOBILE OPTIMIERUNG === */
    
    /* Turnierdetails Grid - von 3 Spalten zu 1 Spalte */
    .tournament-info-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Turnierdetails Container anpassen */
    .tournament-hero {
        padding: 1rem !important;
        margin: 0 !important;
    }
    
    .tournament-details {
        padding: 1rem !important;
    }
    
    /* Info-Items kompakter machen */
    .tournament-info-item {
        margin-bottom: 0.8rem !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0.3rem !important;
    }
    
    .tournament-info-item .info-label {
        font-weight: bold !important;
        font-size: 0.9rem !important;
    }
    
    .tournament-info-item .info-value {
        font-size: 1rem !important;
    }
    
    /* === TURNIER BEARBEITEN MOBILE === */
    
    /* Flex-between Container zu Column machen */
    .flex-between {
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: stretch !important;
    }
    
    /* Form-Groups in flex-between auf volle Breite */
    .flex-between .form-group {
        flex: none !important;
        width: 100% !important;
        margin-bottom: 1rem !important;
    }
    
    /* Form-Controls auf Mobile anpassen */
    .form-control {
        font-size: 16px !important; /* Verhindert Zoom auf iOS */
        padding: 0.75rem !important;
    }
    
    /* Labels größer und klarer */
    .form-group label {
        font-weight: bold !important;
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
        display: block !important;
    }
    
    /* === MODAL MOBILE OPTIMIERUNG === */
    
    /* Tournament Modal scrollbar machen */
    .tournament-modal {
        align-items: flex-start !important;
        overflow-y: auto !important;
        padding: 1rem 0 !important;
    }
    
    .tournament-modal-content {
        max-width: 95% !important;
        width: 95% !important;
        margin: 1rem auto !important;
        max-height: calc(100vh - 2rem) !important;
        overflow-y: auto !important;
        padding: 1rem !important;
    }
    
    /* Modal Buttons untereinander anordnen */
    .tournament-modal .tournament-modal-buttons {
        flex-direction: column !important;
        gap: 0.8rem !important;
    }
    
    /* Fix für Modal-Buttons */
    .tournament-modal-buttons form,
    .tournament-modal-buttons {
        width: 100% !important;
    }
    
    .tournament-modal-buttons .button {
        width: 100% !important;
        display: block !important;
    }
    
    /* Modal Optionen kompakter */
    .tournament-modal-option {
        margin-bottom: 1rem !important;
        padding: 0.8rem !important;
    }
    
    /* Warning Box kompakter */
    .warning-box {
        margin: 0.8rem 0 !important;
        padding: 0.8rem !important;
    }
    
    /* Modal Buttons fixiert am Ende */
    .tournament-modal-buttons {
        margin-top: 1.5rem !important;
        padding-top: 1rem !important;
        border-top: 1px solid var(--border-color) !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
    
    .tournament-modal-buttons .button {
        min-width: auto !important;
        flex: 1 1 auto !important;
        padding: 0.8rem 1rem !important;
        font-size: 0.9rem !important;
    }

    /* === PARTICIPANTS LIST MOBILE OPTIMIZATION === */
    .participants-list-container {
        padding: 1rem !important;
    }
    
    .participant-item {
        padding: 1rem !important;
    }
    
    .participant-info {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }
    
    .character-details {
        width: 100% !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }
    
    .username-wrapper {
        min-width: unset !important;
        max-width: unset !important;
        width: 100% !important;
        margin-right: 0 !important;
    }
    
    /* Character icons für 1vs1 - horizontal layout */
    .character-icons {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }
    
    .character-icons .icon-group {
        display: flex !important;
        align-items: center !important;
        gap: 0.3rem !important;
        flex-shrink: 0 !important;
    }
    
    .character-icons .character-name {
        display: block !important;
        font-size: 0.85rem !important;
        color: var(--text-color) !important;
        font-weight: 500 !important;
        margin-top: 0 !important;
    }
    
    .character-icons-group {
        display: flex !important;
        align-items: center !important;
        gap: 0.3rem !important;
        flex-wrap: wrap !important;
    }
    
    /* Team line container für mobile - column layout */
    .team-line-container {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        width: 100% !important;
        gap: 0.8rem !important;
    }
    
    /* Team name section für mobile */
    .team-name-section {
        min-width: unset !important;
        max-width: unset !important;
        width: 100% !important;
        margin-right: 0 !important;
        margin-bottom: 0 !important;
    }
    
    /* Team characters section für mobile */
    .team-characters-section {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.8rem !important;
        width: 100% !important;
    }
    
    /* Team member cards für mobile - horizontal layout wie 1vs1 */
    .team-member-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.5rem !important;
        margin-right: 0 !important;
        min-width: unset !important;
        width: 100% !important;
        padding: 0.4rem 0 !important;
    }
    
    /* Team member icons größer machen */
    .team-member-card .character-icons-group {
        display: flex !important;
        align-items: center !important;
        gap: 0.4rem !important;
        flex-shrink: 0 !important;
    }
    
    /* Team member character name größer und besser lesbar */
    .team-member-card .character-name {
        font-size: 0.85rem !important;
        color: var(--text-color) !important;
        font-weight: 500 !important;
        word-break: break-word !important;
        line-height: 1.3 !important;
    }
    
    /* Fix für Team-Charaktere in Turnierübersicht - alle Teammitglieder nebeneinander anzeigen */
    .team-characters {
        flex-wrap: nowrap !important;
        overflow: visible !important;
        gap: 0.4rem !important;
    }
    
    .team-member-character {
        width: auto !important;
        flex-shrink: 0 !important;
        min-width: 130px !important;
        margin-right: 0.5rem !important;
    }
    
    .team-member-character .character-name {
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: unset !important;
        max-width: none !important;
    }
    
    /* Nur für Team-Turniere: "Ausstehend" kompakter machen wenn ein anderes Team vorhanden ist */
    .player-vs:has(.team-characters) .player:not(:has(.team-characters)) {
        flex-shrink: 2 !important;
        min-width: 60px !important;
        max-width: 100px !important;
        text-align: center !important;
    }
    
    /* Fallback für ältere Browser - nur wenn team-name class vorhanden ist */
    .player-vs .player:has(.team-name) ~ .vs-indicator ~ .player:not(:has(.team-name)) {
        flex-shrink: 2 !important;
        min-width: 60px !important;
        max-width: 100px !important;
        text-align: center !important;
    }
    

    /* === PARTICIPANTS MANAGEMENT MOBILE OPTIMIZATION === */
    .tournament-accordion-content[style*="max-height: 300px"] {
        max-height: 400px !important;
        padding-bottom: 2rem !important;
    }
    
    /* Form layout für Teilnehmer hinzufügen */
    .tournament-accordion-content .flex-between[style*="flex-wrap: wrap"] {
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: stretch !important;
    }
    
    .tournament-accordion-content .flex-between[style*="flex-wrap: wrap"] > div {
        flex: unset !important;
        margin-top: 0 !important;
    }
    
    .tournament-accordion-content .flex-between[style*="flex-wrap: wrap"] button {
        margin-top: 1rem !important;
        padding: 1rem !important;
        font-size: 1rem !important;
    }

    /* === PARTICIPANTS TABLE MOBILE OPTIMIZATION === */
    .tournament-table {
        font-size: 0.8rem !important;
        min-width: 100% !important;
    }
    
    .tournament-table th,
    .tournament-table td {
        padding: 0.5rem 0.3rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    /* Spaltenbreiten für mobile */
    .tournament-table th:nth-child(1), /* Benutzer */
    .tournament-table td:nth-child(1) {
        width: 20% !important;
        min-width: 80px !important;
    }
    
    .tournament-table th:nth-child(2), /* Charakter */
    .tournament-table td:nth-child(2) {
        width: 25% !important;
        min-width: 100px !important;
    }
    
    .tournament-table th:nth-child(3), /* Team */
    .tournament-table td:nth-child(3) {
        width: 15% !important;
        min-width: 60px !important;
    }
    
    .tournament-table th:nth-child(4), /* Anmeldezeitpunkt */
    .tournament-table td:nth-child(4) {
        width: 25% !important;
        min-width: 100px !important;
        font-size: 0.7rem !important;
    }
    
    .tournament-table th:nth-child(5), /* Aktionen */
    .tournament-table td:nth-child(5) {
        width: 15% !important;
        min-width: 70px !important;
    }
    
    
    /* Remove button in table */
    .tournament-table .button {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.7rem !important;
        margin: 0 !important;
        width: 100% !important;
    }
    
    /* Scrollable table container */
    .tournament-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Speichern/Korrektur Buttons kleiner für mobile */
    .tournament-table .save-match-result,
    .tournament-table .match-action-button {
        padding: 0.05rem 1.0rem !important;
        font-size: 0.7rem !important;
        line-height: 0.9 !important;
        min-width: unset !important;
        width: auto !important;
        height: auto !important;
        margin-top: 0.9rem !important;
    }

    /* === FINALE PLATZIERUNGEN MOBILE OPTIMIZATION === */
    .final-standings-table {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
    }
    
    .final-standings-table .tournament-table {
        min-width: 600px !important;
        font-size: 0.8rem !important;
    }
    
    .final-standings-table .tournament-table th,
    .final-standings-table .tournament-table td {
        padding: 0.5rem 0.3rem !important;
        white-space: nowrap !important;
    }
    
    /* === VORRUNDEN MATCHUPS MOBILE OPTIMIZATION === */
    /* Round Robin und Poule System Matchups */
    .tournament-accordion-content .tournament-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .tournament-accordion-content .tournament-table {
        min-width: auto !important;
        width: max-content !important;
        table-layout: auto !important;
    }
    
    .tournament-accordion-content .tournament-table td:first-child {
        white-space: nowrap !important;
        width: auto !important;
        min-width: auto !important;
        padding-right: 1rem !important;
    }
    
    .tournament-accordion-content .tournament-table td:not(:first-child) {
        white-space: nowrap !important;
        width: auto !important;
        min-width: 60px !important;
    }
    
    /* Fix für orange Border auf Mobile - verhindert Spalten-Verschiebung */
    /* Gilt für ALLE Turniertabellen: Matchups, Rankings, Gruppentabellen, etc. */
    .tournament-table .user-ranking,
    .tournament-table .matchup-pairing.user-matchup,
    .tournament-table .current-user-highlight {
        box-sizing: border-box !important;
        padding-left: 0.3rem !important; /* Standard padding wie andere Zeilen */
    }
    
    /* Alle Turniertabellen-Zeilen bekommen gleichen Border-Platz */
    .tournament-table tr,
    .final-standings-table .tournament-table tr,
    .group-section .tournament-table tr {
        border-left: 3px solid transparent !important;
        box-sizing: border-box !important;
    }
    
    /* Markierte Zeilen bekommen sichtbaren orange Border */
    .tournament-table .user-ranking,
    .final-standings-table .user-ranking,
    .group-section .tournament-table .user-ranking {
        border-left-color: var(--accent-color) !important;
    }
    
    .tournament-table .matchup-pairing.user-matchup {
        border-left-color: var(--accent-color) !important;
    }
    
    .tournament-table .current-user-highlight,
    .final-standings-table .current-user-highlight {
        border-left-color: var(--accent-color) !important;
    }
    
    /* Mobile Override für Team-Turnier-Tabellen - höhere Spezifität */
    .group-section .tournament-table.team-tournament-table th:nth-child(1),
    .group-section .tournament-table.team-tournament-table td:nth-child(1),
    .tournament-table.team-tournament-table th:nth-child(1),
    .tournament-table.team-tournament-table td:nth-child(1) {
        width: 60px !important;
        min-width: 50px !important;
        max-width: 70px !important;
    }
    
    .group-section .tournament-table.team-tournament-table th:nth-child(2),
    .group-section .tournament-table.team-tournament-table td:nth-child(2),
    .tournament-table.team-tournament-table th:nth-child(2),
    .tournament-table.team-tournament-table td:nth-child(2) {
        width: auto !important;
        min-width: 120px !important;
    }
    
}

/**********************************************
 * 2. ADMIN PANEL MOBILE OPTIMIERUNG
 **********************************************/

@media screen and (max-width: 768px) {
    
    /* === ADMIN PANEL LAYOUT === */
    .admin-panel {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        border: none;
    }
    
    .admin-header {
        padding: 1rem;
        text-align: center;
    }
    
    .admin-header h1 {
        font-size: 1.5rem;
        margin: 0;
    }
    
    .admin-container {
        flex-direction: column;
        min-height: auto;
    }
    
    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid var(--border-color);
        padding: 0;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    
    .admin-menu {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0;
        padding: 0;
        margin: 0;
    }
    
    .admin-menu li {
        margin: 0;
        border-right: 1px solid var(--border-color);
    }
    
    .admin-menu li:last-child {
        border-right: none;
    }
    
    .admin-menu a {
        display: block;
        padding: 0.8rem 0.5rem;
        text-align: center;
        font-size: 0.85rem;
        line-height: 1.2;
        border-left: none;
        border-bottom: 3px solid transparent;
        transition: all 0.3s ease;
    }
    
    .admin-menu a:hover,
    .admin-menu a.active {
        border-left-color: transparent;
        border-bottom-color: var(--primary-color);
        background-color: var(--background-elevated);
    }
    
    .admin-content {
        padding: 1rem 0.5rem;
        border-left: none;
        box-shadow: none;
    }
    
    /* === ADMIN DASHBOARD === */
    .dashboard-header {
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: center;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .status-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .dashboard-card,
    .status-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .dashboard-card h3,
    .status-card h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    /* === ADMIN TABELLEN (REVOLUTIONÄR) === */
    /* Tabellen werden zu Karten umgewandelt für bessere Mobile UX */
    .admin-table-container {
        overflow-x: visible;
    }
    
    .admin-table {
        display: block;
        width: 100%;
    }
    
    .admin-table thead {
        display: none;
    }
    
    .admin-table tbody {
        display: block;
    }
    
    .admin-table tr {
        display: block;
        background: var(--background-card);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        margin-bottom: 1rem;
        padding: 1.2rem;
        box-shadow: var(--shadow-light);
        position: relative;
    }
    
    .admin-table tr:hover {
        box-shadow: var(--shadow-medium);
        transform: translateY(-2px);
        transition: all 0.3s ease;
    }
    
    .admin-table td {
        display: block;
        border: none;
        padding: 0.6rem 0;
        text-align: left;
        white-space: normal;
        word-wrap: break-word;
        position: relative;
        padding-left: 130px;
        min-height: 1.5rem;
    }
    
    .admin-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 0.6rem;
        font-weight: bold;
        color: var(--primary-color);
        width: 120px;
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.5px;
        line-height: 1.2;
    }
    
    /* Action Buttons in Karten-Ansicht */
    .admin-table .action-buttons {
        padding-left: 0 !important;
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-light);
    }
    
    .admin-table .action-buttons:before {
        display: none;
    }
    
    .admin-table .action-buttons .admin-action-btn {
        flex: 1;
        text-align: center;
        padding: 0.7rem;
        font-size: 0.9rem;
        border-radius: 6px;
        white-space: nowrap;
        min-height: 44px;
    }
    
    /* === ADMIN FILTER & ACTIONS === */
    .user-filter {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .user-filter .form-group {
        margin-bottom: 0.5rem;
    }
    
    .admin-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .admin-actions .button {
        width: 100%;
        padding: 0.8rem;
        font-size: 1rem;
    }
    
    /* === POLL ADMIN ACTIONS === */
    .admin-poll-actions {
        justify-content: center;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .admin-poll-actions .button-small {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* === POLLS RESPONSIVE === */
    .poll-card {
        padding: 1rem;
    }
    
    .poll-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .poll-actions,
    .admin-poll-actions {
        flex-direction: column;
    }
    
    .datetime-row {
        grid-template-columns: 1fr;
    }
    
    .poll-info-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    /* === AUTH RESPONSIVE === */
    .auth-header {
        padding: 1.5rem;
    }
    
    .auth-header h1 {
        font-size: 1.5rem;
    }
    
    .auth-body {
        padding: 1.5rem;
    }
}

/**********************************************
 * 3. SEHR KLEINE SMARTPHONES (480px und kleiner)
 **********************************************/

@media screen and (max-width: 480px) {
    
    /* === ALLGEMEINE ANPASSUNGEN === */
    .container {
        padding: 0 0.5rem;
    }
    
    .profile-header h1 {
        font-size: 1.3rem;
    }
    
    .logo a {
        font-size: 1.1rem;
    }
    
    /* === ADMIN PANEL KLEINE SMARTPHONES === */
    .admin-header h1 {
        font-size: 1.3rem;
    }
    
    .admin-menu {
        grid-template-columns: 1fr 1fr;
    }
    
    .admin-menu a {
        font-size: 0.8rem;
        padding: 0.6rem 0.3rem;
    }
    
    .admin-content {
        padding: 0.5rem 0.3rem;
    }
    
    /* === ADMIN TABELLEN KOMPAKT === */
    .admin-table tr {
        padding: 1rem;
    }
    
    .admin-table td {
        padding: 0.5rem 0;
        padding-left: 110px;
        font-size: 0.9rem;
    }
    
    .admin-table td:before {
        width: 100px;
        font-size: 0.7rem;
    }
    
    .admin-table .action-buttons .admin-action-btn {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
    
    /* === BUTTONS KOMPAKTER === */
    .button {
        padding: 0.7rem 0.8rem;
        font-size: 0.9rem;
    }
    
    /* === MODALS KOMPAKTER === */
    .modal-content {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
    }
    
    /* === AUTH KOMPAKTER === */
    .auth-header {
        padding: 1rem;
    }
    
    .auth-body {
        padding: 1rem;
    }
}

/**********************************************
 * 4. TABLET OPTIMIERUNGEN (769px - 1024px)
 **********************************************/

@media screen and (min-width: 769px) and (max-width: 1024px) {
    
    /* === ADMIN PANEL TABLET === */
    .admin-container {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 0;
    }

    .admin-menu {
        display: flex;
        flex-wrap: wrap;
        padding: 0.5rem;
        justify-content: center;
        gap: 0.5rem;
    }

    .admin-menu li {
        margin: 0;
    }

    .admin-menu a {
        padding: 0.7rem 1.2rem;
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
        border-radius: 6px;
    }

    .admin-menu a:hover,
    .admin-menu a.active {
        border-left-color: transparent;
        border-bottom-color: var(--primary-color);
        background-color: var(--background-hover);
    }

    .admin-content {
        padding: 1.5rem;
    }

    /* === DASHBOARD TABLET === */
    .dashboard-stats,
    .status-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* === TABELLEN TABLET === */
    .admin-table {
        display: table; /* Normale Tabelle auf Tablet */
    }
    
    .admin-table thead {
        display: table-header-group;
    }
    
    .admin-table tbody {
        display: table-row-group;
    }
    
    .admin-table tr {
        display: table-row;
        background: initial;
        border: none;
        border-radius: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }
    
    .admin-table td {
        display: table-cell;
        padding: 0.8rem;
        padding-left: 0.8rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .admin-table td:before {
        display: none;
    }
    
    .admin-table .action-buttons {
        display: flex;
        flex-direction: row;
        gap: 0.3rem;
        margin: 0;
        padding: 0;
        border: none;
    }
    
    .admin-table .action-buttons .admin-action-btn {
        flex: initial;
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}

/**********************************************
 * 5. LANDSCAPE SMARTPHONE OPTIMIERUNGEN
 **********************************************/

@media screen and (max-width: 896px) and (orientation: landscape) {
    
    /* === ADMIN PANEL LANDSCAPE === */
    .admin-menu {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .admin-menu a {
        padding: 0.5rem 0.3rem;
        font-size: 0.8rem;
    }
    
    .admin-header {
        padding: 0.5rem 1rem;
    }
    
    .admin-header h1 {
        font-size: 1.2rem;
    }
    
    /* === HEADER LANDSCAPE === */
    header {
        padding: 0.5rem 1rem;
        flex-direction: row;
        justify-content: space-between;
    }
    
    nav ul {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    nav ul li {
        width: auto;
    }
    
    nav ul li a {
        padding: 0.5rem 0.8rem;
        background: transparent;
    }
}

/**********************************************
 * 6. TOUCH-OPTIMIERUNGEN
 **********************************************/

@media (hover: none) and (pointer: coarse) {
    
    /* === HOVER STATES DEAKTIVIEREN === */
    .admin-table tr:hover {
        background-color: initial;
        transform: none;
    }
    
    .button:hover,
    .admin-action-btn:hover {
        transform: none;
        box-shadow: initial;
    }
    
    /* === TOUCH-FRIENDLY SIZES === */
    .button,
    .admin-action-btn,
    .form-control,
    nav ul li a {
        min-height: 44px; /* Apple empfohlene Touch-Target-Größe */
        min-width: 44px;
    }
    
    /* === TOUCH FEEDBACK === */
    .button:active,
    .admin-action-btn:active {
        transform: scale(0.98);
        opacity: 0.8;
    }
}

/**********************************************
 * 7. HIGH-DPI DISPLAYS (RETINA)
 **********************************************/

@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
    
    /* === SCHÄRFERE BORDERS === */
    .admin-table tr,
    .button,
    .form-control {
        border-width: 0.5px;
    }
}

/**********************************************
 * 8. DARK MODE MOBILE ANPASSUNGEN
 **********************************************/

@media screen and (max-width: 768px) and (prefers-color-scheme: dark) {
    
    /* === BESSERE KONTRASTE AUF MOBIL === */
    .admin-table tr {
        background: var(--background-elevated);
        border-color: var(--border-light);
    }
    
    .admin-table td:before {
        color: var(--accent-color);
    }
    
    /* === SCHATTEN REDUZIEREN === */
    .admin-table tr:hover {
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
}

/**********************************************
 * 9. ACCESSIBILITY VERBESSERUNGEN
 **********************************************/

@media screen and (max-width: 768px) {
    
    /* === FOKUS VERBESSERUNGEN === */
    .button:focus,
    .admin-action-btn:focus,
    .form-control:focus {
        outline: 3px solid var(--primary-color);
        outline-offset: 2px;
    }
    
    /* === BESSERE LESBARKEIT === */
    .admin-table td {
        line-height: 1.5;
    }
    
    .admin-table td:before {
        line-height: 1.3;
    }
    
    /* === REDUCED MOTION === */
    @media (prefers-reduced-motion: reduce) {
        .admin-table tr:hover {
            transform: none;
            transition: none;
        }
        
        .button,
        .admin-action-btn {
            transition: none;
        }
    }
}

/**********************************************
 * 10. PRINT STYLES (BONUS)
 **********************************************/

@media print {
    
    /* === ADMIN TABELLEN DRUCKBAR === */
    .admin-table {
        display: table !important;
    }
    
    .admin-table thead {
        display: table-header-group !important;
    }
    
    .admin-table tbody {
        display: table-row-group !important;
    }
    
    .admin-table tr {
        display: table-row !important;
        background: white !important;
        border: 1px solid #000 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .admin-table td {
        display: table-cell !important;
        padding: 0.5rem !important;
        border: 1px solid #000 !important;
    }
    
    .admin-table td:before {
        display: none !important;
    }
    
    .admin-table .action-buttons {
        display: none !important;
    }
}

    
    
    