/**
 * Auth Styles New - Main stylesheet for updated authentication layouts
 * Based on Figma design export for login page
 * 
 * @package App
 */

/* CSS Reset and Base Styles */
* {
  box-sizing: border-box;
}

/* CSS Custom Properties - Design System */
/* Все переменные теперь определены в style.css */

/* Authentication Page Container */
.auth-container {
  position: relative;
  background: var(--color-white-100);
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* Background Pattern */
.auth-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../../images/auth/auth-background-pattern.svg');
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  z-index: 1;
}

/* Main Content Wrapper */
.auth-main-wrapper {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 20px 243px;
  width: 100%;
  min-height: 100vh;
}

/* Content Wrapper for Registration Page */
.auth-content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  row-gap: 8px;
}

@media (max-width: 768px) {
  .auth-content-wrapper {
    margin: 24px auto 0;
    padding: 0 10px;
  }
}

/* Authentication Header */
.auth-header-new {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--border-radius-xxl);
  background: var(--color-white-100);
  padding: 8px 24px;
  width: 100%;
  max-width: 1420px;
  margin: 0 auto;
  margin-bottom: 172px;
}

.auth-header-logo {
  flex-shrink: 0;
  width: 152px;
  height: 46px;
}

.auth-header-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-header-phone {
  display: inline-flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: flex-end;
}

.auth-header-phone-label {
  flex-shrink: 0;
  line-height: 20px;
  letter-spacing: 0;
  color: var(--color-black-50);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  margin: 0;
}

.auth-header-phone-number {
  flex-shrink: 0;
  line-height: 24px;
  letter-spacing: 0;
  color: var(--color-black-100);
  font-family: var(--font-primary);
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  margin: 0;
}

/* Authentication Content */
.auth-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0 auto;
  border-radius: var(--border-radius-xxl);
  background: var(--color-white-100);
  padding: var(--spacing-xxxl);
  overflow: hidden;
  width: 100%;
  max-width: 400px;
}

/* Authentication Card */
.auth-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  row-gap: var(--spacing-xl);
}

.auth-card-title {
  flex-shrink: 0;
  align-self: stretch;
  line-height: 29px;
  letter-spacing: 0;
  color: var(--color-black-100);
  font-family: var(--font-primary);
  font-size: var(--text-2xl);
  font-weight: 700;
  text-transform: uppercase;
  margin: 0;
}

/* Authentication Form */
.auth-form-new {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: flex-start;
  align-self: stretch;
  row-gap: var(--spacing-lg);
}

/* Field Groups */
.auth-field-group {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: flex-start;
  align-self: stretch;
  row-gap: var(--spacing-xs);
}

.auth-label {
  display: -webkit-box;
  flex-shrink: 0;
  align-self: stretch;
  overflow: hidden;
  line-height: 20px;
  letter-spacing: 0;
  color: var(--color-black-100);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  margin: 0;
}

/* Input Wrappers */
.auth-input-wrapper {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  align-self: stretch;
  justify-content: center;
  border: 1px solid var(--color-off-white-2);
  border-radius: var(--border-radius-xl);
  background: var(--color-white-100);
  padding: 15px 15px 15px 23px;
}

.auth-password-wrapper {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  align-self: stretch;
  column-gap: var(--spacing-sm);
  border: 1px solid var(--color-off-white-2);
  border-radius: var(--border-radius-xl);
  background: var(--color-white-100);
  padding: 15px 15px 15px 23px;
}

/* Input Fields */
.auth-input {
  display: -webkit-box;
  flex-grow: 1;
  overflow: hidden;
  line-height: 24px;
  letter-spacing: 0;
  color: var(--color-black-50);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
}

.auth-input:focus {
  color: var(--color-black-100);
}

.auth-input::placeholder {
  color: var(--color-black-50);
}

/* Password Toggle Button */
.auth-password-toggle {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  overflow: hidden;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-black-50);
}

.auth-password-toggle:hover {
  color: var(--color-black-100);
}

/* Authentication Options */
.auth-options {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  align-self: stretch;
  justify-content: space-between;
}

/* Checkbox */
.auth-checkbox {
  display: inline-flex;
  flex-shrink: 0;
  align-items: flex-start;
  column-gap: var(--spacing-sm);
  /* overflow: hidden; */
  cursor: pointer;
}

.auth-checkbox input[type="checkbox"] {
  display: none;
}

.auth-checkbox-mark {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  column-gap: var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  box-shadow: 0px 1px 1px 0px #1135550a;
  background: var(--color-off-white-2);
  width: 20px;
  height: 20px;
  position: relative;
}

.auth-checkbox input[type="checkbox"]:checked + .auth-checkbox-mark {
  background: var(--color-accent-100);
}

.auth-checkbox input[type="checkbox"]:checked + .auth-checkbox-mark::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 10px;
  border: 2px solid white;
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg);
  top: 2px;
  left: 6px;
}

.auth-checkbox-label {
  flex-shrink: 0;
  line-height: 18px;
  letter-spacing: 0;
  color: var(--color-black-100);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  width: fit-content;
}

/* Forgot Password Link */
.auth-forgot-link {
  display: inline-flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: flex-end;
  justify-content: center;
  height: 20px;
  row-gap: var(--spacing-xs);
  text-decoration: none;
  color: var(--color-black-100);
}

.auth-forgot-link:hover {
  color: var(--color-accent-100);
}

.auth-forgot-text {
  flex-shrink: 0;
  line-height: 14px;
  letter-spacing: 0;
  color: inherit;
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  margin: 0;
}

.auth-forgot-underline {
  flex-shrink: 0;
  align-self: stretch;
  background: var(--color-accent-100);
  height: 1px;
}

/* Authentication Buttons */
.auth-buttons {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: flex-start;
  align-self: stretch;
  row-gap: var(--spacing-lg);
}

.auth-btn {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  align-self: stretch;
  justify-content: center;
  column-gap: var(--spacing-sm);
  border-radius: var(--border-radius-full);
  padding: 12px 16px;
  overflow: hidden;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 24px;
  letter-spacing: 0;
  transition: all 0.3s ease;
}

/* Primary Auth Button (Login) */
.auth-btn-primary {
  background: var(--color-accent-100);
  color: var(--color-white-100);
}

.auth-btn-primary:hover {
  background: #9a4b05;
  transform: translateY(-1px);
}

/* Legacy support for old button classes */
.auth-btn-user,
.auth-btn-manager {
  background: var(--color-accent-100);
  color: var(--color-white-100);
}

.auth-btn-user:hover,
.auth-btn-manager:hover {
  background: #9a4b05;
  transform: translateY(-1px);
}

/* Secondary Auth Button (Register) */
.auth-btn-register {
  background: var(--color-off-white-2);
  color: var(--color-black-100);
}

.auth-btn-register:hover {
  background: #d4d7f5;
  transform: translateY(-1px);
}

/* Button Loading States */
.auth-button__text {
  display: block;
}

.auth-button__loading {
  display: none;
  align-items: center;
  column-gap: var(--spacing-sm);
}

.auth-btn.loading .auth-button__text {
  display: none;
}

.auth-btn.loading .auth-button__loading {
  display: flex;
}

.auth-spinner {
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

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

/* Back Button */
.auth-back-button {
  margin-bottom: var(--spacing-xl);
  align-self: flex-start;
  max-width: 200px;
}

.auth-back-button img {
  width: 20px;
  height: 20px;
  margin-right: var(--spacing-sm);
}

/* Authentication Footer */
.auth-footer-new {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
  width: 100%;
  height: 108px;
  z-index: 2;
}

.auth-footer-copyright {
  flex-shrink: 0;
  width: 442px;
  text-align: center;
  line-height: 20px;
  letter-spacing: 0;
  color: var(--color-white-100);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  margin: 0;
}

/* Message Styles */
.auth-messages {
  width: 100%;
  margin-bottom: var(--spacing-lg);
  position: relative;
}

/* Message Container States */
.auth-messages--error {
  animation: shake 0.3s ease-in-out;
}

.auth-messages--success {
  animation: slideIn 0.3s ease-out;
}

.auth-messages--warning {
  animation: pulse 0.3s ease-in-out;
}

.auth-messages--info {
  animation: fadeIn 0.3s ease-out;
}

/* Individual Message Styling */
.auth-message {
  display: flex;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--border-radius-sm);
  margin-bottom: var(--spacing-sm);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  line-height: 1.5;
  position: relative;
  border: 1px solid transparent;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.auth-message:last-child {
  margin-bottom: 0;
}

/* Message Icon */
.auth-message::before {
  content: '';
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-right: 10px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  margin-top: 1px;
}

/* Error Message */
.auth-message--error {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.auth-message--error::before {
  content: '✗';
  background: none;
  color: #dc2626;
  font-weight: bold;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Success Message */
.auth-message--success {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #bbf7d0;
}

.auth-message--success::before {
  content: '✓';
  background: none;
  color: #16a34a;
  font-weight: bold;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Warning Message */
.auth-message--warning {
  background: #fffbeb;
  color: #d97706;
  border-color: #fed7aa;
}

.auth-message--warning::before {
  content: '⚠';
  background: none;
  color: #d97706;
  font-weight: bold;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Info Message */
.auth-message--info {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

.auth-message--info::before {
  content: 'ℹ';
  background: none;
  color: #2563eb;
  font-weight: bold;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Message Text Content */
.auth-message-content {
  flex: 1;
  margin: 0;
}

/* Message Close Button */
.auth-message-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  font-size: 16px;
  line-height: 1;
}

.auth-message-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.auth-message-close::after {
  content: '×';
  font-weight: bold;
}

/* Message with Action Button */
.auth-message--action {
  padding-right: 100px;
}

.auth-message-action {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  border-radius: var(--border-radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-message-action:hover {
  background: currentColor;
  color: white;
}

/* Animations */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

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

/* Message Stack (Multiple Messages) */
.auth-messages:has(.auth-message + .auth-message) .auth-message {
  margin-bottom: var(--spacing-xs);
  border-radius: var(--border-radius-sm);
}

.auth-messages:has(.auth-message + .auth-message) .auth-message:first-child {
  border-bottom-left-radius: 2px;
  border-bottom-right-radius: 2px;
}

.auth-messages:has(.auth-message + .auth-message) .auth-message:last-child {
  border-top-left-radius: 2px;
  border-top-right-radius: 2px;
  margin-bottom: 0;
}

.auth-messages:has(.auth-message + .auth-message) .auth-message:not(:first-child):not(:last-child) {
  border-radius: 2px;
}

/* Legacy Support for Existing Message Types */
.auth-message.error {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.auth-message.success {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #bbf7d0;
}

.auth-message.info {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

/* Field Feedback */
.auth-field-feedback {
  min-height: 18px;
  font-family: var(--font-primary);
  font-size: 12px;
  color: #c62828;
  margin-top: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .auth-main-wrapper {
    padding: 10px 16px 120px;
  }
  
  .auth-header-new {
    margin-bottom: 60px;
    padding: 6px 16px;
  }
  
  .auth-header-logo {
    width: 120px;
    height: 36px;
  }
  
  .auth-header-phone-number {
    font-size: 18px;
  }
  
  .auth-content {
    padding: var(--spacing-xl);
    max-width: 100%;
  }
  
  .auth-footer-copyright {
    width: auto;
    max-width: 90%;
    font-size: 12px;
  }
  
  /* Mobile Message Adjustments */
  .auth-message {
    padding: 12px 14px;
    font-size: 13px;
  }
  
  .auth-message::before {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    font-size: 12px;
  }
  
  .auth-message--action {
    padding-right: 90px;
  }
  
  .auth-message-action {
    right: 10px;
    padding: 3px 6px;
    font-size: 11px;
  }
  
  .auth-message-close {
    width: 18px;
    height: 18px;
    top: 6px;
    right: 6px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .auth-header-new {
    flex-direction: column;
    align-items: center;
    row-gap: var(--spacing-sm);
    text-align: center;
  }
  
  .auth-header-phone {
    align-items: center;
  }
  
  .auth-content {
    padding: var(--spacing-lg);
  }
  
  .auth-options {
    flex-direction: column;
    align-items: flex-start;
    row-gap: var(--spacing-lg);
  }
  
  /* Very Small Screen Message Adjustments */
  .auth-message {
    padding: 10px 12px;
    font-size: 12px;
  }
  
  .auth-message::before {
    width: 14px;
    height: 14px;
    margin-right: 6px;
    font-size: 11px;
  }
  
  .auth-message--action {
    padding-right: 80px;
  }
  
  .auth-message-action {
    right: 8px;
    padding: 2px 4px;
    font-size: 10px;
  }
}