/* ===================================
   CraftyCrib - Auth Pages Styles
   Modern, Animated, Beautiful
   =================================== */

/* Variables */
:root {
  --auth-primary: #10b981;
  --auth-primary-dark: #059669;
  --auth-bg-dark: #0a0f1a;
  --auth-bg-card: #ffffff;
  --auth-text: #1e293b;
  --auth-text-muted: #64748b;
  --auth-border: #e2e8f0;
  --auth-radius: 16px;
}

[data-theme="dark"] {
  --auth-bg-card: var(--bg-card);
  --auth-text: var(--text-primary);
  --auth-text-muted: var(--text-muted);
  --auth-border: var(--border-color);
}

/* Base */
.auth-page {
  height: 100vh;
  overflow: hidden;
  background: #f8fafc;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] .auth-page {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.auth-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100vh;
  overflow: hidden;
}

/* Language Selector */
.auth-language-selector {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
}

/* ==================== */
/* LEFT SIDE - SHOWCASE */
/* ==================== */
.auth-showcase {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--auth-bg-dark);
  overflow: hidden;
  padding: 1.5rem;
  height: 100vh;
  max-height: 100vh;
}

/* Animated Background Blobs */
.showcase-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.gradient-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.6;
  animation: blob-float 20s ease-in-out infinite;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  top: -200px;
  right: -100px;
  animation-delay: 0s;
}

.blob-2 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  bottom: -150px;
  left: -100px;
  animation-delay: -5s;
}

.blob-3 {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -10s;
}

@keyframes blob-float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(30px, -30px) scale(1.05);
  }
  50% {
    transform: translate(-20px, 20px) scale(0.95);
  }
  75% {
    transform: translate(-30px, -20px) scale(1.02);
  }
}

/* Logo */
.showcase-logo {
  position: relative;
  z-index: 10;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.showcase-logo img {
  height: 32px;
  filter: brightness(0) invert(1);
}

/* Gallery */
.showcase-gallery {
  flex: 1;
  position: relative;
  z-index: 5;
  overflow: hidden;
  margin: 0 -1.5rem;
  padding: 0 1.5rem;
  max-height: calc(100vh - 220px);
  mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 95%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 95%, transparent 100%);
}

.gallery-track {
  display: flex;
  gap: 0.75rem;
  height: 100%;
}

.gallery-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.gallery-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4/5;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
  min-height: 140px;
  max-height: 200px;
}

.gallery-item:hover {
  transform: scale(1.02);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
}

/* Column Animations */
.scroll-up {
  animation: scroll-up 40s linear infinite;
}

.scroll-down {
  animation: scroll-down 35s linear infinite;
}

.scroll-up-slow {
  animation: scroll-up 50s linear infinite;
}

@keyframes scroll-up {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-50%);
  }
}

@keyframes scroll-down {
  0% {
    transform: translateY(-50%);
  }
  100% {
    transform: translateY(0);
  }
}

/* Bottom Content */
.showcase-content {
  position: relative;
  z-index: 10;
  padding: 1.5rem;
  margin: 0 -1.5rem -1.5rem -1.5rem;
  background: linear-gradient(to top, var(--auth-bg-dark) 70%, transparent);
  flex-shrink: 0;
}

.showcase-content h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.showcase-content .gradient-text {
  background: linear-gradient(135deg, #10b981, #0ea5e9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.showcase-content p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Stats */
.showcase-stats {
  display: flex;
  gap: 1.5rem;
}

.showcase-stats .stat {
  display: flex;
  flex-direction: column;
}

.showcase-stats .stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
}

.showcase-stats .stat-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
}

/* ==================== */
/* RIGHT SIDE - FORM */
/* ==================== */
.auth-form-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: #f8fafc;
  overflow-y: auto;
  height: 100vh;
  max-height: 100vh;
}

[data-theme="dark"] .auth-form-container {
  background: var(--bg-primary);
}

.auth-form-wrapper {
  width: 100%;
  max-width: 440px;
}

.mobile-auth-logo {
  display: none;
  margin-bottom: 2rem;
}

.mobile-auth-logo img {
  height: 36px;
}

/* Auth Form */
.auth-form {
  background: white;
  border-radius: var(--auth-radius);
  padding: 2.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--auth-border);
}

[data-theme="dark"] .auth-form {
  background: var(--bg-card);
  border-color: var(--border-color);
  box-shadow: var(--shadow-lg);
}

.auth-form-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-form-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--auth-text);
  margin-bottom: 0.5rem;
}

.auth-form-header p {
  color: var(--auth-text-muted);
  font-size: 0.95rem;
}

.auth-form-header p a {
  color: var(--auth-primary);
  font-weight: 600;
  transition: color 0.2s;
}

.auth-form-header p a:hover {
  color: var(--auth-primary-dark);
  text-decoration: underline;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--auth-text);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 0.95rem;
  color: var(--auth-text);
  background: #f8fafc;
  border: 2px solid var(--auth-border);
  border-radius: 10px;
  transition: all 0.2s;
  font-family: inherit;
}

[data-theme="dark"] .form-input {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.form-input:hover {
  border-color: #cbd5e1;
}

.form-input:focus {
  outline: none;
  border-color: var(--auth-primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

[data-theme="dark"] .form-input:focus {
  background: var(--bg-secondary);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
}

.form-input::placeholder {
  color: #94a3b8;
}

[data-theme="dark"] .form-input::placeholder {
  color: var(--text-muted);
}

/* Input with Icon */
.input-icon-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  transition: color 0.2s;
}

[data-theme="dark"] .input-icon {
  color: var(--text-muted);
}

.input-icon i {
  width: 18px;
  height: 18px;
}

.input-icon-wrapper .form-input {
  padding-left: 2.75rem;
}

.input-icon-wrapper .form-input:focus + .input-icon,
.input-icon-wrapper:focus-within .input-icon {
  color: var(--auth-primary);
}

/* Password Toggle */
.password-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

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

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

/* Form Row */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Role Selector */
.role-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.role-option {
  position: relative;
}

.role-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.role-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  background: #f8fafc;
  border: 2px solid var(--auth-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.role-option label:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.role-option input:checked + label {
  border-color: var(--auth-primary);
  background: rgba(16, 185, 129, 0.05);
}

.role-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 12px;
  color: #64748b;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.role-icon i {
  width: 24px;
  height: 24px;
}

.role-option input:checked + label .role-icon {
  background: var(--auth-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.role-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--auth-text);
}

.role-desc {
  font-size: 0.75rem;
  color: var(--auth-text-muted);
  line-height: 1.3;
}

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--auth-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-group label {
  font-size: 0.875rem;
  color: var(--auth-text-muted);
  line-height: 1.5;
  cursor: pointer;
}

.checkbox-group label a {
  color: var(--auth-primary);
  font-weight: 500;
}

.checkbox-group label a:hover {
  text-decoration: underline;
}

/* Form Actions */
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.forgot-link {
  font-size: 0.875rem;
  color: var(--auth-primary);
  font-weight: 500;
  transition: color 0.2s;
}

.forgot-link:hover {
  color: var(--auth-primary-dark);
  text-decoration: underline;
}

/* Submit Button */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-dark) 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

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

.btn-primary i {
  width: 20px;
  height: 20px;
}

.btn-primary.loading {
  opacity: 0.8;
  cursor: not-allowed;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

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

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--auth-text-muted);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--auth-border);
}

/* Social Login */
.social-login {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: white;
  border: 2px solid var(--auth-border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--auth-text);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-social:hover:not(:disabled) {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.btn-social:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Error List */
.error-list {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.error-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.error-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #dc2626;
  font-size: 0.875rem;
  padding: 0.25rem 0;
}

.error-list li::before {
  content: '•';
  color: #dc2626;
}

/* Alerts */
.alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.alert i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.alert-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

/* Auth Error Banner */
.auth-error-banner {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 2px solid #ef4444;
  background: #fee2e2;
  color: #b91c1c;
}

[data-theme="dark"] .auth-error-banner {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.auth-error-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-weight: 600;
}

.auth-error-header i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-error-list {
  margin: 0;
  padding-left: 26px;
  list-style: disc;
}

.auth-error-list li {
  padding: 2px 0;
  line-height: 1.5;
  word-break: break-word;
}

/* Input Error State */
.form-input.input-error {
  border: 2px solid #ef4444;
  background: #fef2f2;
}

.form-input.input-error:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] .form-input.input-error {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.1);
  color: var(--text-primary);
}

[data-theme="dark"] .form-input.input-error:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
  background: var(--bg-secondary);
}

/* Footer */
.auth-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--auth-border);
}

.auth-footer p {
  font-size: 0.8rem;
  color: var(--auth-text-muted);
}

/* ==================== */
/* DARK THEME OVERRIDES */
/* ==================== */
[data-theme="dark"] .auth-form-header p,
[data-theme="dark"] .checkbox-group label,
[data-theme="dark"] .auth-footer p {
  color: var(--text-secondary);
}

[data-theme="dark"] .auth-divider {
  color: var(--text-secondary);
}

[data-theme="dark"] .auth-divider::before,
[data-theme="dark"] .auth-divider::after {
  background: var(--border-color);
}

[data-theme="dark"] .btn-social {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .btn-social:hover:not(:disabled) {
  background: var(--bg-tertiary);
  border-color: var(--border-color-hover);
}

[data-theme="dark"] .auth-footer {
  border-top-color: var(--border-color);
}

[data-theme="dark"] .role-option label {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}

[data-theme="dark"] .role-option label:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-secondary);
}

[data-theme="dark"] .role-option input:checked + label {
  border-color: var(--auth-primary);
  background: rgba(16, 185, 129, 0.08);
}

[data-theme="dark"] .role-icon {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

[data-theme="dark"] .role-option input:checked + label .role-icon {
  background: var(--auth-primary);
  color: white;
}

[data-theme="dark"] .alert-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

[data-theme="dark"] .alert-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

[data-theme="dark"] .form-input:hover {
  border-color: var(--border-color-hover);
}

[data-theme="dark"] .password-toggle {
  color: var(--text-muted);
}

[data-theme="dark"] .password-toggle:hover {
  color: var(--text-primary);
}

/* ==================== */
/* RESPONSIVE */
/* ==================== */
@media (max-width: 1024px) {
  .auth-container {
    grid-template-columns: 1fr;
  }
  
  .auth-showcase {
    display: none;
  }
  
  .auth-form-container {
    padding: 1.5rem;
    min-height: 100vh;
  }
  
  .mobile-auth-logo {
    display: block;
    text-align: center;
  }
  
  .auth-language-selector {
    top: 10px;
    right: 10px;
  }
}

@media (max-width: 480px) {
  .auth-form {
    padding: 1.5rem;
    border-radius: 12px;
  }
  
  .auth-form-header h2 {
    font-size: 1.5rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .role-selector {
    grid-template-columns: 1fr;
  }
  
  .form-actions {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .checkbox-group {
    order: -1;
  }
  
  .forgot-link {
    text-align: center;
  }
}

/* Dark mode support for form container */
@media (prefers-color-scheme: dark) {
  .auth-page {
    /* Keep light mode for auth pages for better readability */
  }
}
