/**
 * Modern Auth Form - Login Modal
 */

/* Form Container */
.auth-form-modern {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

/* Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Form Field */
.form-field {
  display: flex;
  flex-direction: column;
  /* gap: 0.5rem; */
}

/* Form Label */
.form-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}

.form-label svg {
  color: var(--muted-foreground);
  flex-shrink: 0;
}

/* Form Input */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--input-bg, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  color: var(--foreground);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
}

.form-input::placeholder {
  color: var(--muted-foreground);
  opacity: 0.7;
}

.form-input:hover {
  border-color: var(--primary);
}

.form-input:focus {
  border-color: var(--primary);
  background: rgba(226, 1, 205, 0.05);
  box-shadow: 0 0 0 3px rgba(226, 1, 205, 0.1);
}

.form-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Password Field */
.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field .form-input {
  padding-right: 3rem;
}

.password-toggle {
  position: absolute;
  right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: none;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 0.5rem;
}

.password-toggle:hover {
  color: var(--foreground);
  background: rgba(255, 255, 255, 0.05);
}

.password-toggle:active {
  transform: scale(0.95);
}

.password-toggle.active {
  color: var(--primary);
}

/* Form Options */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.875rem;
  flex-wrap: wrap;
}

/* Checkbox */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  padding-left: 0.5em;
  font-size: 0.95rem;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox-label {
  color: var(--muted-foreground);
}

.checkbox-wrapper:hover .checkbox-label {
  color: var(--foreground);
}

/* Links */
.link-secondary {
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

.link-secondary:hover {
  color: var(--primary);
}

.link-primary {
  color: var(--secondary);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.link-primary:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Social Divider */
.social-divider {
  position: relative;
  text-align: center;
  margin: 0.5rem 0;
}

.social-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.social-divider span {
  position: relative;
  display: inline-block;
  padding: 0 1rem;
  background: var(--modal-bg, var(--background));
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

/* Social Buttons */
.social-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.social-btn span {
  flex: 1;
  text-align: left;
}

.social-btn svg {
  flex-shrink: 0;
}

.social-vk {
  background: #0077FF;
  color: white;
}

.social-vk:hover {
  background: #0066DD;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 119, 255, 0.3);
}

.social-google {
  background: white;
  color: #333;
  border-color: #ddd;
}

.social-google:hover {
  background: #f8f8f8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.social-yandex {
  background: #FC3F1D;
  color: white;
}

.social-yandex:hover {
  background: #E6391A;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(252, 63, 29, 0.3);
}

/* Submit Button */
.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, #B801CD 100%);
  color: white;
  border: none;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(226, 1, 205, 0.3);
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(226, 1, 205, 0.4);
}

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

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-submit svg {
  flex-shrink: 0;
}

/* Form Footer */
.form-footer {
  text-align: center;
  padding-top: 0.5rem;
  font-size: 0.875rem;
}

.text-muted {
  color: var(--muted-foreground);
  margin-right: 0.5rem;
}

/* Alerts */
.auth-form-modern .infomessage,
.auth-form-modern .errormessage {
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.auth-form-modern .infomessage {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #3B82F6;
}

.auth-form-modern .errormessage {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #EF4444;
}

/* Dark Mode Adjustments */
[data-theme="dark"] .social-google {
  background: #2d2d2d;
  color: white;
  border-color: #444;
}

[data-theme="dark"] .social-google:hover {
  background: #3d3d3d;
}

/* Responsive */
@media (max-width: 480px) {
  .auth-form {
    gap: 1rem;
  }

  .form-options {
    flex-direction: column;
    align-items: flex-start;
  }

  .social-buttons {
    grid-template-columns: 1fr;
  }
}

/* Focus Styles */
.form-input:focus-visible,
.social-btn:focus-visible,
.btn-submit:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}



/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0;
    flex: 1;
}

.auth-tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    position: relative;
}

.auth-tab-btn svg {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.auth-tab-btn:hover {
    color: var(--foreground);
}

.auth-tab-btn:hover svg {
    opacity: 1;
}

.auth-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-tab-btn.active svg {
    opacity: 1;
}

/* Tab Content */
.auth-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.auth-tab-content.active {
    display: block;
}

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

/* Modal Header with Tabs */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 0 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

/* Registration specific styles */
#result-registration {
    font-size: 0.8125rem;
    margin-top: 0.375rem;
}

#result-registration.success {
    color: #10b981;
}

#result-registration.error {
    color: #ef4444;
}

/* reCAPTCHA container */
#recaptcha-container {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0;
}

#login-recaptcha-container {
    display: none;
    justify-content: center;
    margin: 0.5rem 0;
}


#recaptcha-container > div {
    transform: scale(0.95);
    transform-origin: center;
}

/* Password strength indicator (optional) */
/* .password-strength {
    height: 3px;
    margin-top: 0.375rem;
    border-radius: 1.5px;
    background: var(--border);
    overflow: hidden;
} */

/* .password-strength-bar {
    height: 100%;
    transition: all 0.3s ease;
}

.password-strength-bar.weak {
    width: 33%;
    background: #ef4444;
}

.password-strength-bar.medium {
    width: 66%;
    background: #f59e0b;
}

.password-strength-bar.strong {
    width: 100%;
    background: #10b981;
} */

/* Responsive adjustments */
@media (max-width: 480px) {
    .auth-tabs {
        width: 100%;
    }
    
    .auth-tab-btn {
        flex: 1;
        justify-content: center;
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .auth-tab-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .modal-content {
        max-width: 100% !important;
        margin: 0;
        border-radius: 0 !important;
    }
}

/* Tab Switcher (как в fm-nexus) */
.auth-tab-switcher {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 1.5rem;
}

.auth-tab-switch {
    flex: 1;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    color: var(--muted-foreground);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-tab-switch:hover {
    color: var(--foreground);
}

.auth-tab-switch.active {
    background: var(--background);
    color: var(--foreground);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Header Icon Animation */
#auth-icon {
    transition: all 0.3s ease;
}

#auth-title,
#auth-subtitle {
    transition: all 0.3s ease;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.reg-message {
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.reg-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.reg-message.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.reg-message ul {
    margin: 0;
    padding-left: 1.25rem;
    list-style: disc;
}

.reg-message li {
    margin: 0.25rem 0;
}


/* ========== МИНИМАЛИСТИЧНАЯ ВАЛИДАЦИЯ ПАРОЛЕЙ ========== */

/* Валидное поле (зеленая обводка) */
input.password-valid {
    border-color: rgba(34, 197, 94, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1) !important;
}

/* Невалидное поле (красная обводка) */
input.password-invalid {
    border-color: rgba(239, 68, 68, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* Плавный переход обводки */
input[type="password"] {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ========== ЗАБЛОКИРОВАННАЯ КНОПКА ========== */
button.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #6b7280 !important;
}

/* Анимация "брыкания" */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

button.btn-shake {
    animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* ========== ИНДИКАТОР СИЛЫ ПАРОЛЯ ========== */
.password-strength {
    display: none; /* По умолчанию скрыт */
    gap: 4px;
    margin-top: 0px;
    /* margin-bottom: 3px; */
    height: 3px;
    width: 100%;
}

.password-strength.show {
    display: flex; /* Показываем при вводе */
}

.password-strength div {
    flex: 1;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    transition: background 0.3s ease;
}

/* Градации силы */
.password-strength.strength-1 div:nth-child(1) { 
    background: #ef4444; 
}

.password-strength.strength-2 div:nth-child(1),
.password-strength.strength-2 div:nth-child(2) { 
    background: #f59e0b; 
}

.password-strength.strength-3 div:nth-child(1),
.password-strength.strength-3 div:nth-child(2),
.password-strength.strength-3 div:nth-child(3) { 
    background: #eab308; 
}

.password-strength.strength-4 div:nth-child(1),
.password-strength.strength-4 div:nth-child(2),
.password-strength.strength-4 div:nth-child(3),
.password-strength.strength-4 div:nth-child(4) { 
    background: #84cc16; 
}

.password-strength.strength-5 div:nth-child(1),
.password-strength.strength-5 div:nth-child(2),
.password-strength.strength-5 div:nth-child(3),
.password-strength.strength-5 div:nth-child(4),
.password-strength.strength-5 div:nth-child(5) { 
    background: #22c55e; 
}

/* ========== TOOLTIP (только для требований) ========== */
.password-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.95);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: tooltipFadeIn 0.2s ease-out;
    pointer-events: none;
}

.password-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(239, 68, 68, 0.95);
}

.password-tooltip strong {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ========== ВАЛИДНЫЕ/НЕВАЛИДНЫЕ ПОЛЯ ========== */
input.password-valid {
    border-color: rgba(34, 197, 94, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1) !important;
}

input.password-invalid {
    border-color: rgba(239, 68, 68, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

input[type="password"] {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ========== ЗАБЛОКИРОВАННАЯ КНОПКА ========== */
button.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #6b7280 !important;
}

/* Анимация "брыкания" */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

button.btn-shake {
    animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* ========== ИНДИКАТОР ТРЕБОВАНИЙ К ПАРОЛЮ ========== */
.password-requirements-indicator {
    display: none;
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    /* margin-top: 8px; */
    margin-bottom: 8px;
    animation: slideDown 0.2s ease-out;
}

.password-requirements-indicator.show {
    display: block;
}

.password-requirements-indicator.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.password-requirements-indicator.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

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



/* ========== ОПТИМИЗАЦИЯ ДЛЯ FHD И НИЖЕ ========== */

/* Для мониторов 1920x1080 и ниже */
@media (max-height: 1080px) {
    /* Уменьшаем верхний отступ модалки */
    #login-modal .modal-content {
        margin-top: 2rem;
        margin-bottom: 2rem;
    }
    
    /* Компактный header */
    .modal-body > div:first-child {
        margin: 2rem 0 !important;
    }
    
    /* Иконка меньше */
    .modal-body > div:first-child > div:first-child {
        width: 48px !important;
        height: 48px !important;
        margin-bottom: 0.5rem !important;
    }
    
    .modal-body > div:first-child > div:first-child svg {
        width: 24px !important;
        height: 24px !important;
    }
    
    /* Заголовок меньше */
    #auth-title {
        font-size: 1.25rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    #auth-subtitle {
        font-size: 0.875rem !important;
    }
    
    /* Уменьшаем gap между полями */
    .auth-form {
        gap: 0.75rem;
    }
    
    /* Компактные лейблы */
    .form-label {
        font-size: 0.8125rem;
        margin-bottom: 0.5rem;
    }
    
    .form-label svg {
        width: 16px;
        height: 16px;
    }
    
    /* Компактные инпуты */
    .form-input {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }
    
    /* Индикатор силы компактнее */
    .password-strength {
        height: 3px;
        margin-top: 0;
        margin-bottom: 0;
    }
    
    /* Индикатор требований компактнее */
    .password-requirements-indicator {
        font-size: 0.6875rem;
        padding: 0.375rem 0.625rem;
        margin-bottom: 0.5rem;
        line-height: 1.3;
    }
    
    /* reCAPTCHA меньше */
    #recaptcha-container {
        margin: 0.5rem 0;
        transform: scale(0.9);
        transform-origin: center;
    }
    
    /* Checkbox компактнее */
    .checkbox-wrapper {
        font-size: 0.8125rem;
        gap: 0.375rem;
    }
    
    .checkbox-wrapper input[type="checkbox"] {
        width: 1rem;
        height: 1rem;
    }
    
    /* Кнопка компактнее */
    .btn-submit {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .btn-submit svg {
        width: 18px;
        height: 18px;
    }
    
    /* Tab switcher компактнее */
    .auth-tab-switcher {
        margin-bottom: 1.25rem;
    }
    
    .auth-tab-switch {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Для ноутбуков и меньше (900px высота) */
@media (max-height: 900px) {
    /* Еще компактнее header */
    .modal-body > div:first-child {
        margin: 1.25rem 0 !important;
    }
    
    /* Скрываем иконку */
    .modal-body > div:first-child > div:first-child {
        display: none;
    }
    
    #auth-title {
        font-size: 1.125rem !important;
    }
    
    #auth-subtitle {
        display: none;
    }
    
    /* Минимальные gap */
    .auth-form {
        gap: 0.75rem;
    }
    
    /* Индикатор требований однострочный */
    .password-requirements-indicator {
        font-size: 0.625rem;
        padding: 0.25rem 0.5rem;
        margin-bottom: 0.375rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* reCAPTCHA еще меньше */
    #recaptcha-container {
        margin: 0.25rem 0;
        transform: scale(0.85);
    }
}

/* Для планшетов в портретной ориентации */
@media (max-height: 768px) {
    /* Максимально компактно */
    #login-modal .modal-content {
        margin-top: 1rem;
        margin-bottom: 1rem;
        padding: 1rem;
    }
    
    .modal-body {
        padding-top: 0 !important;
    }
    
    .auth-form {
        gap: 0.375rem;
    }
    
    .form-input {
        padding: 0.5rem 0.75rem;
    }
    
    .btn-submit {
        padding: 0.625rem 1rem;
    }
    
    /* Скрываем индикатор силы на маленьких экранах */
    .password-strength {
        display: none !important;
    }
}
