/* ========================================
   LOGIN SHARED STYLES - ASI Tool & Admin Tool
   Basierend auf multi_company_finance Design
   ======================================== */

body.login-page {
    background: white;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.login-container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

.login-card {
    background: #f8f9fa;
    border-radius: 1rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.1);
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.company-branding {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.company-branding-logo {
    max-width: 120px;
    max-height: 80px;
    width: auto;
    height: auto;
    border-radius: 0.5rem;
    object-fit: contain;
}

.company-branding-logo-fallback {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #d40511 0%, #b3040e 100%);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
}

.company-branding-text {
    text-align: left;
}

.company-title {
    font-size: 2rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.5rem;
}

.company-subtitle {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 0;
}

.login-image {
    width: 100% !important;
    min-height: 200px !important;
    max-height: none !important;
    height: auto !important;
    background: linear-gradient(135deg, #d40511 0%, #b3040e 100%);
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible !important;
    border-radius: 1rem 1rem 0 0;
    padding: 20px !important;
    box-sizing: border-box;
}

/* Wenn ein Bild vorhanden ist, Hintergrund entfernen */
.login-image:has(img) {
    background: transparent !important;
}

/* Fallback für Browser ohne :has() Support */
.login-image img ~ * {
    /* Placeholder wird nicht angezeigt wenn Bild da ist */
}

/* Sehr spezifische Selektoren für Login-Bild, um Bootstrap zu überschreiben */
/* WICHTIG: Keine Höhenbegrenzung - Bilder werden vollständig angezeigt */
.login-image img,
#loginImageContainer img,
.login-image > img,
div.login-image img,
div#loginImageContainer img,
body.login-page .login-card .login-image img,
body.login-page #loginImageContainer img {
    max-width: calc(100% - 40px) !important;
    width: auto !important;
    min-width: 0 !important;
    max-height: none !important;
    height: auto !important;
    min-height: 0 !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
    flex-shrink: 0 !important;
    vertical-align: middle;
    box-sizing: border-box !important;
}

.company-image-placeholder {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border: 3px dashed rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
}

.company-image-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.company-image-placeholder div {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.company-image-placeholder small {
    opacity: 0.8;
}

.login-form {
    padding: 3rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #d40511 0%, #b3040e 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.form-control {
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
}

.form-control:focus {
    border-color: #d40511;
    box-shadow: 0 0 0 0.2rem rgba(212, 5, 17, 0.25);
}

.btn-login {
    background: linear-gradient(135deg, #d40511 0%, #b3040e 100%);
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 2rem;
    font-weight: 600;
    color: white;
    width: 100%;
    transition: all 0.2s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 5, 17, 0.3);
    color: white;
}

@media (max-width: 768px) {
    .login-container {
        padding: 1rem;
    }
    
    .login-form {
        padding: 2rem;
    }
}

/* ===== MOBILE (PHONE) OPTIMIERUNG: nur kleine Screens, Desktop bleibt unverändert ===== */
@media (max-width: 576px) {
    /* Auf Phones lieber oben beginnen (Scroll), statt hart vertikal zu zentrieren */
    body.login-page {
        align-items: flex-start;
        justify-content: flex-start;
        padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
                 max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    }

    .login-container {
        padding: 0; /* Body übernimmt Safe-Area-Padding */
        max-width: 100%;
    }

    /* Branding untereinander statt nebeneinander */
    .company-branding {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
        text-align: center;
        margin-bottom: 1rem;
    }

    .company-branding-text {
        text-align: center;
        max-width: 100%;
    }

    .company-title {
        font-size: 1.35rem;
        line-height: 1.2;
        margin-bottom: 0.25rem;
        overflow-wrap: anywhere;
    }

    .company-subtitle {
        font-size: 0.95rem;
        overflow-wrap: anywhere;
    }

    .company-branding-logo {
        max-width: 110px;
        max-height: 70px;
    }

    .company-branding-logo-fallback {
        width: 64px;
        height: 64px;
        font-size: 2rem;
    }

    /* Bildbereich kleiner, damit Login im Hochformat besser passt */
    .login-image {
        min-height: 140px !important;
        padding: 12px !important;
    }

    .login-form {
        padding: 1.25rem;
    }

    /* Eingaben/Buttons wirklich full width und gut tappbar */
    .input-group,
    .form-control,
    .btn-login,
    .btn {
        width: 100%;
    }

    .form-control {
        padding: 0.8rem 0.9rem;
        font-size: 1rem; /* verhindert iOS Zoom bei Fokus */
    }

    .btn-login {
        padding: 0.85rem 1rem;
    }
}

/* Sehr niedrige Höhen (kleine Phones / Landscape): Bildbereich optional kleiner halten */
@media (max-height: 650px) and (max-width: 768px) {
    body.login-page { align-items: flex-start; }
    .company-branding { margin-bottom: 0.75rem; }
    .login-image { min-height: 120px !important; }
    .login-form { padding: 1rem; }
}

