:root {
  --uauth-primary: #667eea;
  --uauth-primary-dark: #5568d3;
  --uauth-primary-light: rgba(102, 126, 234, 0.1);
  --uauth-success: #48bb78;
  --uauth-error: #f56565;
  --uauth-text: #2d3748;
  --uauth-text-light: #718096;
  --uauth-border: #e2e8f0;
  --uauth-bg: #ffffff;
  --uauth-bg-light: #f7fafc;
  --uauth-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  --uauth-shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.15);
}

* { box-sizing: border-box; }

.uauth-container {
  max-width: 480px;
  margin: 40px auto;
  padding: 20px;
}

.uauth-card {
  background: var(--uauth-bg);
  border-radius: 20px;
  box-shadow: var(--uauth-shadow);
  overflow: hidden;
  animation: uauthFadeIn 0.5s ease;
}

@keyframes uauthFadeIn {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tabs */
.uauth-tabs {
  display: flex;
  background: var(--uauth-bg-light);
  padding: 8px;
  gap: 8px;
}

.uauth-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  min-height: 44px;
  background: transparent;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--uauth-text-light);
  cursor: pointer;
  transition: all 0.3s ease;
}

.uauth-tab svg { transition: transform 0.3s ease; }
.uauth-tab:hover { color: white; }

.uauth-tab.active {
  background: var(--uauth-bg);
  color: var(--uauth-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.uauth-tab.active svg { transform: scale(1.1); }

/* Tab Content */
.uauth-tab-content {
  display: none;
  animation: uauthSlideIn 0.4s ease;
}
.uauth-tab-content.active { display: block; }

@keyframes uauthSlideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.uauth-header {
  padding: 30px 30px 20px;
  text-align: center;
}

.uauth-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--uauth-text);
  margin: 0 0 8px 0;
}

.uauth-subtitle {
  font-size: 14px;
  color: var(--uauth-text-light);
  margin: 0;
}

.uauth-form { padding: 0 30px 30px; }

.uauth-form-group { margin-bottom: 20px; }

.uauth-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  align-items: start;
}
.uauth-form-row .uauth-form-group { margin-bottom: 0; }

.uauth-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--uauth-text);
  margin-bottom: 8px;
}

.uauth-required { color: var(--uauth-error); }

.uauth-input-wrapper { position: relative; }

.uauth-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--uauth-text-light);
  pointer-events: none;
  z-index: 1;
}

.uauth-input {
  width: 100%;
  padding: 12px 16px;
  padding-left: 44px;
  font-size: 15px;
  color: var(--uauth-text);
  background: var(--uauth-bg);
  border: 2px solid var(--uauth-border);
  border-radius: 10px;
  transition: all 0.3s ease;
  font-family: inherit;
}

.uauth-input::placeholder { color: #a0aec0; }

.uauth-input:focus {
  outline: none;
  border-color: var(--uauth-primary);
  box-shadow: 0 0 0 4px var(--uauth-primary-light);
}

.uauth-input.error {
  border-color: var(--uauth-error);
  animation: uauthShake 0.4s ease;
}

@keyframes uauthShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.uauth-textarea {
  min-height: 70px;
  resize: vertical;
  padding: 12px 16px;
}

.uauth-toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  color: var(--uauth-text-light);
  cursor: pointer;
  padding: 0;
  display: flex;
  transition: all 0.3s ease;
  z-index: 1;
}

.uauth-toggle-password:hover {
  color: var(--uauth-primary);
  transform: translateY(-50%) scale(1.1);
}

.uauth-checkbox {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--uauth-text);
}

.uauth-checkbox input {
  margin-right: 8px;
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.uauth-link {
  color: var(--uauth-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.uauth-link:hover {
  color: var(--uauth-primary-dark);
  text-decoration: underline;
}

/* File Upload */
.uauth-file-upload { position: relative; }

.uauth-file-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.uauth-file-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--uauth-bg-light);
  border: 2px dashed var(--uauth-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.uauth-file-label:hover {
  border-color: var(--uauth-primary);
  background: var(--uauth-primary-light);
}

.uauth-file-label svg {
  color: var(--uauth-primary);
  flex-shrink: 0;
}

.uauth-file-label span {
  font-size: 14px;
  color: var(--uauth-text-light);
}

.uauth-file-preview {
  position: relative;
  margin-top: 12px;
  display: inline-block;
}

.uauth-file-preview img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--uauth-border);
}

.uauth-remove-file {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 40px;
  height: 40px;
  background: var(--uauth-error);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.uauth-remove-file:hover { transform: scale(1.15) rotate(90deg); }

/* Button */
.uauth-btn {
  padding: 14px 24px;
  min-height: 44px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  font-family: inherit;
}

.uauth-btn-primary {
  background: linear-gradient(135deg, var(--uauth-primary) 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.uauth-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}
.uauth-btn-primary:active:not(:disabled) { transform: translateY(0); }

.uauth-btn-outline {
  background: transparent;
  color: var(--uauth-primary);
  border: 2px solid var(--uauth-primary);
}
.uauth-btn-outline:hover { background: var(--uauth-primary); color: white; }

.uauth-btn-block { width: 100%; display: block; }

.uauth-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
}

.uauth-btn-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.uauth-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: uauthSpin 0.6s linear infinite;
}
@keyframes uauthSpin { to { transform: rotate(360deg); } }

/* Messages */
.uauth-message {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  animation: uauthSlideDown 0.3s ease;
  line-height: 1.5;
}

@keyframes uauthSlideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.uauth-message.success {
  background: rgba(72, 187, 120, 0.1);
  color: #2f855a;
  border: 1px solid var(--uauth-success);
}
.uauth-message.success strong { color: var(--uauth-success); }

.uauth-message.error {
  background: rgba(245, 101, 101, 0.1);
  color: #c53030;
  border: 1px solid var(--uauth-error);
}
.uauth-message.error strong { color: var(--uauth-error); }

.uauth-error {
  display: block;
  color: var(--uauth-error);
  font-size: 13px;
  margin-top: 6px;
  min-height: 18px;
  font-weight: 500;
}

.uauth-hint {
  display: block;
  font-size: 12px;
  color: var(--uauth-text-light);
  margin-top: 6px;
}

/* Modal */
.uauth-modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 9999;
  animation: uauthFadeIn 0.3s ease;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.uauth-modal.active { display: flex; }

.uauth-modal-content {
  background: var(--uauth-bg);
  border-radius: 20px;
  max-width: 450px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: uauthScaleIn 0.3s ease;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

@keyframes uauthScaleIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.uauth-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: var(--uauth-bg-light);
  border: none;
  border-radius: 50%;
  font-size: 24px;
  color: var(--uauth-text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1;
  line-height: 1;
}

.uauth-modal-close:hover {
  background: var(--uauth-error);
  color: white;
  transform: rotate(90deg);
}

.uauth-modal-header {
  padding: 40px 30px 20px;
  text-align: center;
}

.uauth-modal-header svg {
  color: var(--uauth-primary);
  margin-bottom: 16px;
}

.uauth-modal-header h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--uauth-text);
  margin: 0 0 8px 0;
}

.uauth-modal-header p {
  font-size: 14px;
  color: var(--uauth-text-light);
  margin: 0;
}

/* Welcome Screen */
.uauth-welcome-header {
  padding: 50px 30px;
  text-align: center;
  background: linear-gradient(135deg, var(--uauth-primary) 0%, #764ba2 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

.uauth-welcome-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: uauthPulse 15s ease-in-out infinite;
}

@keyframes uauthPulse {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-10%, -10%) scale(1.1); }
}

.uauth-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid white;
  object-fit: cover;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
  animation: uauthBounceIn 0.6s ease;
}

@keyframes uauthBounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { opacity: 1; transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.uauth-welcome-header h2 {
  font-size: 26px;
  margin: 0 0 8px 0;
  position: relative;
  z-index: 1;
}

.uauth-user-name {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
  opacity: 0.95;
  position: relative;
  z-index: 1;
}

.uauth-user-email {
  font-size: 14px;
  margin: 0;
  opacity: 0.8;
  position: relative;
  z-index: 1;
}

.uauth-welcome-actions {
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Scrollbar Styling */
.uauth-modal-content::-webkit-scrollbar { width: 8px; }
.uauth-modal-content::-webkit-scrollbar-track {
  background: var(--uauth-bg-light);
  border-radius: 10px;
}
.uauth-modal-content::-webkit-scrollbar-thumb {
  background: var(--uauth-border);
  border-radius: 10px;
}
.uauth-modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--uauth-text-light);
}

/* Responsive */
@media (max-width: 576px) {
  .uauth-container { margin: 20px auto; padding: 15px; }
  .uauth-card { border-radius: 16px; }
  .uauth-tabs { padding: 6px; gap: 6px; }
  .uauth-tab { padding: 10px 16px; font-size: 14px; gap: 6px; }
  .uauth-tab svg { width: 16px; height: 16px; }
  .uauth-header { padding: 25px 20px 15px; }
  .uauth-title { font-size: 22px; }
  .uauth-subtitle { font-size: 13px; }
  .uauth-form { padding: 0 20px 25px; }
  .uauth-form-row { grid-template-columns: 1fr; gap: 0; }
  .uauth-form-row .uauth-form-group { margin-bottom: 20px; }
  .uauth-form-row .uauth-form-group:last-child { margin-bottom: 0; }
  .uauth-input { padding: 11px 14px; padding-left: 42px; font-size: 14px; }
  .uauth-input-icon { left: 12px; }
  .uauth-toggle-password { right: 12px; }
  .uauth-file-preview img { width: 80px; height: 80px; }
  .uauth-btn { padding: 12px 20px; font-size: 15px; }
  .uauth-modal { padding: 15px; }
  .uauth-modal-content { border-radius: 16px; }
  .uauth-modal-close {
    top: 15px; right: 15px;
    width: 40px; height: 40px;
    font-size: 20px;
  }
  .uauth-modal-header { padding: 35px 25px 15px; }
  .uauth-modal-header h3 { font-size: 20px; }
  .uauth-welcome-header { padding: 40px 25px; }
  .uauth-avatar { width: 80px; height: 80px; }
  .uauth-welcome-header h2 { font-size: 24px; }
  .uauth-user-name { font-size: 16px; }
  .uauth-welcome-actions { padding: 25px; }
}

@media (max-width: 400px) {
  .uauth-container { padding: 10px; margin: 10px auto; }
  .uauth-header { padding: 20px 15px 10px; }
  .uauth-form { padding: 0 15px 20px; }
  .uauth-input { font-size: 14px; }
  .uauth-welcome-actions { padding: 20px; }
}

/* Loading State */
@keyframes uauthPulseButton {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.uauth-btn:disabled { animation: uauthPulseButton 2s ease-in-out infinite; }

/* Focus Visible */
.uauth-btn:focus-visible,
.uauth-input:focus-visible,
.uauth-tab:focus-visible {
  outline: 3px solid var(--uauth-primary);
  outline-offset: 2px;
}

.uauth-toggle-password:focus-visible,
.uauth-remove-file:focus-visible,
.uauth-modal-close:focus-visible,
.uauth-link:focus-visible,
.uauth-checkbox input:focus-visible {
  outline: 3px solid var(--uauth-primary);
  outline-offset: 2px;
}

/* Print */
@media print {
  .uauth-modal { display: none !important; }
}
