/* CSS-Variablen für einheitliches Design */
:root {
    --primary-color: #2c0052;
    --primary-light: #4a136b;
    --primary-dark: #1f003a;
    --text-color: #333333;
    --text-light: #666666;
    --text-white: #ffffff;
    --bg-color: #ffffff;
    --bg-light: #f8f9fa;
    --border-color: #e0e0e0;
    --shadow-light: 0 2px 8px rgba(44, 0, 82, 0.1);
    --shadow-medium: 0 4px 16px rgba(44, 0, 82, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
    /* Z-Index System - höchste Priorität für Toasts */
    --z-dropdown: 1000;
    --z-header: 1010;
    --z-modal: 1050;
    --z-toast: 9999;
    /* Einheitliche Größen basierend auf Game.razor */
    --button-icon-size: 36px;
    --avatar-size: 40px;
    --avatar-size-lg: 50px;
    --badge-min-width: 28px;
    --card-padding: 1.5rem;
    --card-padding-sm: 1rem;
    --gap-standard: 1rem;
    --gap-sm: 0.5rem;
}

/* Loading Screen - das große blinzelnde Auge! */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    overflow: hidden;
}

.loading-content {
    text-align: center;
    color: var(--text-white);
}

.loading-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    gap: 0.5rem;
}

.logo-text {
    color: var(--text-white);
}

/* Das große blinzelnde Auge */
.loading-eye {
    position: relative;
    width: 4em;
    height: 4em;
    background: radial-gradient(ellipse 80% 100%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.85) 100%);
    border: 3px solid rgba(255,255,255,0.4);
    border-radius: 50%;
    display: inline-block;
    overflow: hidden;
    animation: loading-eye-blink 3s ease-in-out infinite;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

/* Die große Pupille */
.loading-pupil {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, #1a0033 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    animation: loading-pupil-wander 8s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

/* Der große Glitzer im Auge */
.loading-sparkle {
    position: absolute;
    top: 25%;
    left: 30%;
    width: 20%;
    height: 20%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    animation: loading-sparkle 2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Blinzel-Animation für das große Auge */
@keyframes loading-eye-blink {
    0%, 85%, 100% {
        transform: scaleY(1);
        background: radial-gradient(ellipse 80% 100%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.85) 100%);
    }

    87%, 93% {
        transform: scaleY(0.05);
        background: radial-gradient(ellipse 80% 5%, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.3) 100%);
    }
}

/* Pupillen-Bewegung für das große Auge */
@keyframes loading-pupil-wander {
    0% {
        transform: translate(-50%, -50%);
    }

    12% {
        transform: translate(-70%, -50%);
    }

    25% {
        transform: translate(-70%, -30%);
    }

    37% {
        transform: translate(-50%, -25%);
    }

    50% {
        transform: translate(-30%, -30%);
    }

    62% {
        transform: translate(-25%, -50%);
    }

    75% {
        transform: translate(-30%, -70%);
    }

    87% {
        transform: translate(-50%, -75%);
    }

    100% {
        transform: translate(-50%, -50%);
    }
}

/* Glitzer-Animation */
@keyframes loading-sparkle {
    0%, 60%, 100% {
        opacity: 0.95;
        transform: scale(1);
    }

    30% {
        opacity: 0.4;
        transform: scale(0.6);
    }

    80% {
        opacity: 1;
        transform: scale(1.3);
    }
}

/* Loading Text */
.loading-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    animation: loading-text-pulse 2s ease-in-out infinite;
}

@keyframes loading-text-pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Loading Dots */
.loading-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

    .loading-dots span {
        width: 12px;
        height: 12px;
        background: var(--text-white);
        border-radius: 50%;
        animation: loading-dots 1.5s ease-in-out infinite;
        opacity: 0.7;
    }

        .loading-dots span:nth-child(1) {
            animation-delay: 0s;
        }

        .loading-dots span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .loading-dots span:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes loading-dots {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }

    30% {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* Mobile Optimierung für Loading Screen */
@media (max-width: 768px) {
    .loading-logo {
        font-size: 2.5rem;
        margin-bottom: 1.5rem;
    }

    .loading-eye {
        width: 3em;
        height: 3em;
    }

    .loading-text {
        font-size: 1.2rem;
    }
}

/* Mobile Overflow Prevention - WICHTIG! */
html {
    width: 100%;
    height: 100%;
}

body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    position: relative;
}

/* Basis-Styles */
html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-light);
}

body, p, h1, h2, h3, h4, h5, h6, span, div {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Alle Container sicher machen */
*, *::before, *::after {
    box-sizing: border-box;
    max-width: 100%;
}

/* Container und Layout-Elemente */
.container, .container-fluid, .row, .col, [class*="col-"] {
    width: 100%;
    max-width: 100%;
}

/* Bootstrap Container Fix */
.container {
    padding-left: 15px;
    padding-right: 15px;
}

/* Einheitliche Titel-Größen */
h1, .h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

h2, .h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

h3, .h3 {
    font-size: 1.375rem;
    font-weight: 600;
}

h4, .h4 {
    font-size: 1.25rem;
    font-weight: 600;
}

h5, .h5 {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Links */
a, .btn-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

    a:hover, .btn-link:hover {
        color: var(--primary-light);
        text-decoration: none;
    }

/* Einheitliche Button-Styles */
.btn {
    border-radius: var(--radius);
    transition: var(--transition);
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    max-width: 100%;
}

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

    .btn-primary:hover:not(:disabled) {
        background-color: var(--primary-light);
        border-color: var(--primary-light);
        color: var(--text-white);
    }

    .btn-primary:disabled {
        background-color: #6c757d !important;
        border-color: #6c757d !important;
        color: #ffffff !important;
        opacity: 0.65;
        cursor: not-allowed;
        transform: none !important;
        box-shadow: none !important;
    }

/* Einheitliche Icon-Button-Größen (wie in Game.razor) */
.btn-icon {
    width: var(--button-icon-size);
    height: var(--button-icon-size);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Content */
.content {
    padding: var(--card-padding);
    width: 100%;
    max-width: 100%;
}

/* Einheitliche Card-Styles */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    background: var(--bg-color);
    width: 100%;
    max-width: 100%;
}

    .card:hover {
        box-shadow: var(--shadow-medium);
    }

.card-body {
    padding: var(--card-padding);
    width: 100%;
    max-width: 100%;
}

    .card-body.p-2 {
        padding: 0.5rem !important;
    }

/* Einheitliche Avatar-Größen */
.avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.avatar-lg {
    width: var(--avatar-size-lg);
    height: var(--avatar-size-lg);
}

.avatar-connected {
    border-color: var(--primary-color);
}

.offline-avatar {
    filter: grayscale(100%);
    opacity: 0.5;
    border-color: var(--text-light) !important;
}

/* Einheitliche Badge-Styles */
.badge {
    min-width: var(--badge-min-width);
    padding: 0.375rem 0.75rem;
    font-weight: 600;
    border-radius: var(--radius);
}

/* Einheitliche Form-Styles */
.form-control {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
    padding: 0.75rem 1rem;
    width: 100%;
    max-width: 100%;
}

.form-group {
    margin-bottom: var(--gap-standard);
    width: 100%;
    max-width: 100%;
}

.form-label {
    font-weight: 500;
    margin-bottom: var(--gap-sm);
    color: var(--text-color);
}

/* Einheitliche Layout-Gaps */
.gap-standard {
    gap: var(--gap-standard) !important;
}

.gap-sm {
    gap: var(--gap-sm) !important;
}

/* Einheitliche Player-Liste (wie in Game.razor) */
.player-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
    width: 100%;
    max-width: 100%;
}

    .player-item:hover {
        background: var(--bg-light);
    }

.player-name {
    font-size: 0.9rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Toast System - Höchste Priorität! */
.blazored-toast-container {
    z-index: var(--z-toast) !important;
    position: fixed !important;
    max-width: calc(100vw - 2rem);
}

.blazored-toast {
    z-index: var(--z-toast) !important;
    position: relative !important;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-medium);
    transition: var(--transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    max-width: 100%;
}

    /* Toast-Varianten mit Primärfarbe */
    .blazored-toast.blazored-toast-info {
        border-left: 4px solid var(--primary-color);
        background: linear-gradient(135deg, var(--bg-color) 0%, #f8f6ff 100%);
    }

    .blazored-toast.blazored-toast-success {
        border-left: 4px solid #28a745;
        background: linear-gradient(135deg, var(--bg-color) 0%, #f8fff8 100%);
    }

    .blazored-toast.blazored-toast-warning {
        border-left: 4px solid #ffc107;
        background: linear-gradient(135deg, var(--bg-color) 0%, #fffef8 100%);
    }

    .blazored-toast.blazored-toast-error {
        border-left: 4px solid #dc3545;
        background: linear-gradient(135deg, var(--bg-color) 0%, #fff8f8 100%);
    }

/* Toast Close Button */
.blazored-toast-close {
    color: var(--text-light);
    transition: var(--transition);
}

    .blazored-toast-close:hover {
        color: var(--primary-color);
        transform: scale(1.1);
    }

/* Toast Progress Bar */
.blazored-toast-progressbar {
    background: rgba(44, 0, 82, 0.1);
    width: 100%;
    overflow: hidden;
}

    .blazored-toast-progressbar span {
        background: var(--primary-color);
    }

/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

/* Error Boundary */
.blazor-error-boundary {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    padding: 1rem 1rem 1rem 3.5rem;
    color: white;
    border-radius: var(--radius);
    margin: 1rem;
    position: relative;
    max-width: calc(100% - 2rem);
}

    .blazor-error-boundary::before {
        content: "?";
        position: absolute;
        left: 1rem;
        font-size: 1.5rem;
    }

    .blazor-error-boundary::after {
        content: "Ein Fehler ist aufgetreten.";
    }

/* Checkboxes */
.darker-border-checkbox.form-check-input {
    border-color: var(--primary-color);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Form Floating */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--text-light);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Modal Overlay */
.warning-modal-overlay {
    background-color: rgba(220, 53, 69, 0.3) !important;
}

/* Utility Classes für einheitliches Spacing */
.mt-standard {
    margin-top: var(--gap-standard) !important;
}

.mb-standard {
    margin-bottom: var(--gap-standard) !important;
}

.p-standard {
    padding: var(--card-padding) !important;
}

.p-standard-sm {
    padding: var(--card-padding-sm) !important;
}

/* Mobile-spezifische Fixes */
@media (max-width: 768px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
        width: 100%;
        max-width: 100%;
    }

    .card-padding {
        padding: var(--card-padding-sm);
    }

    /* Kleinere Buttons auf Mobile */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
    }
}

:focus {
    outline: none !important;
    box-shadow: none !important;
}