/**
 * Autentifikācijas UI Stili
 * Ēkufonds.lv
 */

/* ============================================================================
   AUTH BUTTONS (Nav bar)
   ============================================================================ */

.auth-buttons {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-brand, linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%));
  color: white;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary, #fff);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Light theme adjustments */
[data-theme="light"] .btn-secondary,
.theme-light .btn-secondary {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-primary, #1a1a1a);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .btn-secondary:hover,
.theme-light .btn-secondary:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.15);
}

/* ============================================================================
   USER MENU
   ============================================================================ */

.user-menu {
  position: relative;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary, #fff);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.user-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.user-btn svg:last-child {
  transition: transform 0.3s ease;
}

.user-btn:hover svg:last-child {
  transform: rotate(180deg);
}

[data-theme="light"] .user-btn,
.theme-light .user-btn {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-primary, #1a1a1a);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .user-btn:hover,
.theme-light .user-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.15);
}

/* ============================================================================
   USER DROPDOWN
   ============================================================================ */

.user-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 240px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  position: relative;
  overflow: hidden;
}

.user-dropdown::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.5;
  z-index: 1;
}

.user-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Light theme dropdown */
.theme-light .user-dropdown,
[data-theme="light"] .user-dropdown {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
}

.theme-dark .user-dropdown {
  background: rgba(28, 28, 30, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.theme-dark .user-dropdown::before {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
}

/* User info in dropdown */
.user-info {
  padding: 0.75rem;
  margin-bottom: 0.25rem;
}

.user-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary, #fff);
  margin-bottom: 0.25rem;
}

.user-email {
  font-size: 0.8125rem;
  color: var(--text-secondary, rgba(255, 255, 255, 0.6));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="light"] .user-name,
.theme-light .user-name {
  color: var(--text-primary, #1a1a1a);
}

[data-theme="light"] .user-email,
.theme-light .user-email {
  color: var(--text-secondary, rgba(0, 0, 0, 0.5));
}

/* Dropdown items */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  color: var(--text-primary, #fff);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  transition: all 0.2s ease;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: rgba(139, 92, 246, 0.1);
  color: var(--brand-primary, #8b5cf6);
}

.dropdown-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.logout-btn {
  color: #ef4444;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

[data-theme="light"] .dropdown-item,
.theme-light .dropdown-item {
  color: var(--text-primary, #1a1a1a);
}

/* Dropdown divider */
.dropdown-divider {
  height: 1px;
  background: var(--border-color, rgba(255, 255, 255, 0.1));
  margin: 0.5rem 0;
}

[data-theme="light"] .dropdown-divider,
.theme-light .dropdown-divider {
  background: rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   AUTH PROMPT OVERLAY
   ============================================================================ */

.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

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

.auth-prompt {
  position: relative;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
  animation: slideUp 0.3s ease;
  box-shadow: 0 20px 60px rgba(31, 38, 135, 0.3);
  overflow: hidden;
}

.auth-prompt::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.5;
  z-index: 1;
}

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

[data-theme="light"] .auth-prompt {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.6);
}

.theme-dark .auth-prompt {
  background: rgba(28, 28, 30, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.theme-dark .auth-prompt::before {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
}

.auth-prompt-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.auth-prompt h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary, #fff);
}

.auth-prompt p {
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
}

[data-theme="light"] .auth-prompt h3 {
  color: var(--text-primary, #1a1a1a);
}

[data-theme="light"] .auth-prompt p {
  color: var(--text-secondary, rgba(0, 0, 0, 0.6));
}

.auth-prompt-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.auth-prompt-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-secondary, rgba(255, 255, 255, 0.6));
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.auth-prompt-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #fff);
}

[data-theme="light"] .auth-prompt-close {
  color: var(--text-secondary, rgba(0, 0, 0, 0.5));
}

[data-theme="light"] .auth-prompt-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary, #1a1a1a);
}

/* ============================================================================
   NOTIFICATIONS
   ============================================================================ */

.notification {
  position: fixed;
  top: 2rem;
  right: 2rem;
  background: rgba(20, 20, 20, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  z-index: 10001;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary, #ffffff);
}

[data-theme="light"] .notification-content {
  color: var(--text-primary, #1a1a1a);
}

.notification-success {
  border-left: 3px solid #22c55e;
  color: #22c55e;
}

.notification-error {
  border-left: 3px solid #ef4444;
  color: #ef4444;
}

.notification-info {
  border-left: 3px solid #3b82f6;
  color: #3b82f6;
}

[data-theme="light"] .notification {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
  .auth-buttons {
    gap: 0.5rem;
  }
  
  .btn-primary,
  .btn-secondary {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
  
  .btn-primary svg,
  .btn-secondary svg {
    width: 14px;
    height: 14px;
  }
  
  .user-dropdown {
    right: auto;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
  }
  
  .user-dropdown.active {
    transform: translateX(-50%) translateY(0);
  }
  
  .notification {
    top: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: calc(100% - 2rem);
  }
}

@media (max-width: 480px) {
  .auth-buttons span {
    display: none;
  }
  
  .btn-primary,
  .btn-secondary {
    padding: 0.5rem;
  }
  
  .user-btn span {
    display: none;
  }
}

/* ============================================================================
   AUTH PAGES (Login/Register)
   ============================================================================ */

/* Auth page container */
body.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-page .auth-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  background: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.05) 0%, transparent 70%);
  margin-top: 72px; /* Account for fixed header */
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  padding: var(--space-8);
  box-shadow: 0 20px 60px rgba(31, 38, 135, 0.3);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.5;
  z-index: 1;
}

.theme-dark .auth-card {
  background: rgba(28, 28, 30, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.theme-dark .auth-card::before {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
}

.auth-card.register {
  max-width: 480px;
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: var(--gradient-brand);
  border-radius: var(--space-3);
  font-size: 32px;
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-lg);
}

.auth-title {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.auth-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
}

.remember-me {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.remember-me input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.forgot-password {
  font-size: var(--text-sm);
  color: var(--brand-primary);
  text-decoration: none;
}

.forgot-password:hover {
  text-decoration: underline;
}

.submit-btn {
  width: 100%;
  padding: var(--space-4);
  background: var(--gradient-brand);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--space-2);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.submit-btn.loading {
  position: relative;
  color: transparent;
}

.submit-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--text-inverse);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 500;
}

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

@media (max-width: 640px) {
  .auth-page .auth-container {
    margin-top: 0;
    padding: var(--space-4);
  }
}
