:root {
    --primary-color: #2e7d32;
    --primary-dark: #1b5e20;
    --secondary-color: #4a5d23;
    --background-light: #ecf0f1;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --success-color: #388e3c;
    --error-color: #d32f2f;
    --border-color: #bdc3c7;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    padding-top: calc(20px + 8vh);
}

.login-container {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-hover);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    animation: slideIn 0.6s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--text-dark) 100%);
    color: white;
    padding: 10px;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.login-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.login-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    position: relative;
    z-index: 1;
}

.login-header .subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 300;
    position: relative;
    z-index: 1;
    margin: 0;
}

.header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fire-icon {
    font-size: 2.5rem;
    margin: 0;
    display: flex;
    align-items: center;
    animation: bounce 2s infinite;
    position: relative;
    z-index: 1;
}

/* Fallback when emoji isn't available: use an inline SVG that inherits color */
.fire-icon--fallback {
    line-height: 0; /* remove extra line height from replaced content */
}

.fire-icon--fallback svg {
    width: 2.5rem;
    height: 2.5rem;
    display: block;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.login-form {
    padding: 40px 30px;
}

.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-group label {
    display: block;
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group select {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.form-group select:disabled {
    background-color: #f5f5f5;
    color: var(--text-light);
    cursor: not-allowed;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
    transform: translateY(-1px);
}

.tenant-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.form-group input::placeholder {
    color: var(--text-light);
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-light);
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: var(--primary-color);
}

.login-button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading .button-spinner {
    display: inline-block;
}

.loading .button-text {
    opacity: 0.7;
}

.alert {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 500;
    display: none;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert.success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.alert.info {
    background: rgba(52, 152, 219, 0.1);
    color: #2980b9;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.alert.error {
    background: rgba(231, 76, 60, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.remember-forgot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 0.9rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
}

.remember-me input[type="checkbox"] {
    width: auto;
}

.forgot-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.login-footer {
    text-align: center;
    padding: 20px 30px 30px;
    color: var(--text-light);
    font-size: 0.9rem;
    border-top: 1px solid #f1f2f6;
}

.version-badge {
    display: inline-flex;
    align-items: stretch;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    line-height: 1;
    margin-top: 8px;
}

.version-badge:empty {
    display: none;
}

.version-badge-label {
    padding: 3px 6px;
    background: #555;
    color: #fff;
}

.version-badge-value {
    padding: 3px 6px;
    background: #007ec6;
    color: #fff;
}

/* Responsive Design */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .login-container {
        max-width: 100%;
    }

    .login-header {
        padding: 10px;
        flex-direction: column;
        gap: 8px;
    }

    .fire-icon {
        font-size: 2rem;
    }

    .header-text h1 {
        font-size: 1.5rem;
    }

    .header-text .subtitle {
        font-size: 0.8rem;
    }

    .login-header h1 {
        font-size: 1.8rem;
    }

    .login-form {
        padding: 30px 20px;
    }

    .fire-icon {
        font-size: 2.5rem;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    /* no-op: demo-credentials removed */
}

/* =============================================================================
   Utility
   ============================================================================= */

.hidden { display: none !important; }

.alert.show { display: block; }

/* =============================================================================
   Passwort-Reset Modal
   ============================================================================= */

.reset-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.reset-modal-overlay.visible {
    display: flex;
}

.reset-modal {
    background: var(--surface-color, #1e2130);
    border: 1px solid var(--border-color, #2d3148);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    position: relative;
    margin: 16px;
}

.reset-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted, #888);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

.reset-modal-close:hover {
    color: var(--text-primary, #e0e4f0);
}

.reset-modal-title {
    margin: 0 0 8px;
    font-size: 1.2rem;
    color: var(--text-primary, #e0e4f0);
}

.reset-modal-meta {
    margin: 0 0 20px;
    font-size: .85rem;
    color: var(--text-muted, #888);
}

.reset-meta-highlight {
    color: var(--accent-color, #5b7cf7);
}

.reset-modal-fields {
    margin-bottom: 20px;
}

.reset-field-row {
    margin-bottom: 10px;
}

.reset-field-label {
    display: block;
    font-size: .8rem;
    color: var(--text-muted, #888);
    margin-bottom: 4px;
}

.reset-input select,
select.reset-input {
    appearance: none;
    cursor: pointer;
}

.reset-error {
    display: none;
    background: rgba(220, 38, 38, .15);
    border: 1px solid rgba(220, 38, 38, .4);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: .875rem;
    color: var(--error-color, #f87171);
}

.reset-error.visible {
    display: block;
}

.reset-text {
    font-size: .875rem;
    color: var(--text-secondary, #a0a8c0);
    margin: 0 0 10px;
}

.reset-text--spacer {
    margin-bottom: 16px;
}

.reset-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #2d3148);
    background: var(--input-bg, #141728);
    color: var(--text-primary, #e0e4f0);
    font-size: 1rem;
    margin-bottom: 16px;
}

.reset-input--code {
    font-size: 1.1rem;
    letter-spacing: .2em;
    text-align: center;
}

.reset-input--sm {
    margin-bottom: 10px;
}

.reset-btn {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.reset-btn--primary { background: var(--accent-color, #5b7cf7); }
.reset-btn--success { background: var(--success-color, #22c55e); }

.reset-success-msg {
    display: none;
    text-align: center;
    padding: 16px 0;
}

.reset-success-msg.visible {
    display: block;
}

.reset-success-icon  { font-size: 2.5rem; margin-bottom: 8px; }

.reset-success-title {
    color: var(--success-color, #22c55e);
    font-weight: 600;
    margin: 0 0 8px;
}

.reset-success-text {
    font-size: .85rem;
    color: var(--text-muted, #888);
    margin: 0;
}
