* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-container {
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
}
.login-form {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-form h2 {
    color: #333;
    margin-bottom: 30px;
    text-align: center;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}
.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}
.form-group input:focus {
    outline: none;
    border-color: #667eea;
}
.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
}
.btn-primary {
    background: #667eea;
    color: white;
}
.btn-primary:hover:not(:disabled) {
    background: #5a67d8;
    transform: translateY(-2px);
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.btn-secondary {
    background: #e2e8f0;
    color: #1e293b;
}
.btn-secondary:hover { background: #cbd5e0; }
.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.alert-error {
    background: #fed7d7;
    color: #742a2a;
    border-left: 4px solid #f56565;
}
.alert-success {
    background: #c6f6d5;
    color: #22543d;
    border-left: 4px solid #48bb78;
}

[hidden] { display: none !important; }

.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

/* Trigger: a single round flag button */
.lang-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: box-shadow 0.15s, transform 0.15s;
}
.lang-trigger:hover  { box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.lang-trigger:active { transform: scale(0.96); }
.lang-trigger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.35);
}

.lang-trigger .flag-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

/* Menu: popover below the trigger, right-aligned */
.lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: langMenuIn 0.15s ease-out;
}

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

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    color: #334155;
    text-align: left;
    transition: background 0.12s;
}
.lang-option:hover { background: #f1f5f9; }
.lang-option:focus-visible {
    outline: none;
    background: #f1f5f9;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.35);
}

.lang-option img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.lang-option.lang-active {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}
.lang-option.lang-active::after {
    content: "✓";
    margin-left: auto;
    color: #1d4ed8;
    font-size: 0.85rem;
}

/* ── Modal ── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    animation: modalFadeIn 0.2s ease-out;
}
@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.modal-content {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}
@keyframes modalSlideUp {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.modal-close {
    position: absolute;
    top: 14px; right: 18px;
    background: none; border: none;
    font-size: 26px; line-height: 1;
    color: #94a3b8; cursor: pointer;
    padding: 4px 8px; border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.modal-close:hover {
    color: #1e293b;
    background: #f1f5f9;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    color: #1e293b;
}
.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Extracted inline styles ── */
.is-hidden { display: none; }
.modal.is-hidden { display: none; }

.btn-auto { width: auto; padding: 10px 20px; }

.login-links { text-align: center; margin-top: 14px; }
.link-accent {
    color: #667eea;
    font-size: 0.9rem;
    text-decoration: none;
}

.modal-title { margin-bottom: 6px; }
.modal-text {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 16px;
}
.modal-text--lg { margin-bottom: 20px; }

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.form-message { margin-top: 12px; }

.reset-success {
    display: none;
    text-align: center;
    margin-top: 10px;
}