* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Plexus / AI-style фон */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-bg-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 35%, #152a47 70%, #0d1b2a 100%);
}

.auth-bg-plexus {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.auth-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    width: 100%;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: white;
}

.auth-header h1 {
    font-size: 1.75rem;
    color: #1f2937;
    margin-bottom: 8px;
}

.auth-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-form h2 {
    font-size: 1.25rem;
    color: #374151;
    margin-bottom: 24px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group-inline {
    margin-bottom: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #4b5563;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* Иконка слева (только прямой потомок, не внутри кнопки) */
.input-wrapper > svg {
    position: absolute;
    left: 14px;
    color: #9ca3af;
    pointer-events: none;
    z-index: 1;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 46px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s;
    background: #f9fafb;
}

/* Поля с кнопкой показа пароля */
.input-wrapper.has-toggle input {
    padding-right: 50px;
}

.input-wrapper input:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.input-wrapper input::placeholder {
    color: #9ca3af;
}

/* Кнопка показа/скрытия пароля */
.toggle-password {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    z-index: 2;
}

.toggle-password svg {
    width: 18px;
    height: 18px;
}

.toggle-password:hover {
    color: #6b7280;
}

.hint {
    display: block;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 6px;
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    margin-top: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.auth-footer p {
    color: #6b7280;
    font-size: 0.875rem;
}

.auth-footer a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-license {
    margin-top: 16px;
    font-size: 0.75rem;
    color: #9ca3af;
}

.auth-message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    display: none;
}

.auth-message.error {
    display: block;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.auth-message.success {
    display: block;
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.auth-info {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px 24px;
    color: white;
    width: 100%;
}

.auth-info h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
    margin-bottom: 12px;
}

.auth-info p {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 12px;
}

.demo-credentials {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.credential {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 14px;
    border-radius: 8px;
}

.credential .role {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

.credential .role.admin {
    background: #f59e0b;
    color: #1f2937;
}

.credential .role.user {
    background: #22c55e;
    color: white;
}

.credential code {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 10px;
    border-radius: 6px;
}

/* Адаптивность */
@media (max-width: 480px) {
    .auth-card {
        padding: 32px 24px;
    }
    
    .auth-header h1 {
        font-size: 1.5rem;
    }
    
    .auth-logo {
        width: 64px;
        height: 64px;
    }
    
    .auth-logo svg {
        width: 36px;
        height: 36px;
    }
}

/* ==================== Темы авторизации ==================== */
[data-theme="light"] .auth-bg-gradient {
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 38%, #f8fafc 72%, #eef2ff 100%);
}

[data-theme="dark"] .auth-bg-gradient {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 35%, #152a47 70%, #0d1b2a 100%);
}

[data-theme="dark"] .auth-card {
    background: rgba(10, 18, 34, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 24px 70px rgba(2, 6, 23, 0.75);
}

[data-theme="dark"] .auth-header h1,
[data-theme="dark"] .auth-form h2,
[data-theme="dark"] .form-group label {
    color: #f1f5f9;
}

[data-theme="dark"] .auth-subtitle,
[data-theme="dark"] .checkbox-label,
[data-theme="dark"] .hint,
[data-theme="dark"] .auth-footer p,
[data-theme="dark"] .auth-footer a {
    color: #94a3b8;
}

[data-theme="dark"] .auth-footer {
    border-top-color: #334155;
}

[data-theme="dark"] .input-wrapper > svg,
[data-theme="dark"] .toggle-password {
    color: #64748b;
}

[data-theme="dark"] .input-wrapper input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .input-wrapper input::placeholder {
    color: #64748b;
}

[data-theme="dark"] .input-wrapper input:focus {
    background: #111b31;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.22);
}

[data-theme="dark"] .auth-message.error {
    color: #fecaca;
    background: rgba(127, 29, 29, 0.3);
    border-color: rgba(248, 113, 113, 0.35);
}

[data-theme="dark"] .auth-message.success {
    color: #bbf7d0;
    background: rgba(20, 83, 45, 0.32);
    border-color: rgba(74, 222, 128, 0.35);
}
