/* ===================================
   MODALS & OVERLAYS
   =================================== */

/* MODAL STYLES */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal__content {
  background: white;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e9ecef;
  position: sticky;
  top: 0;
  background: white;
  border-radius: 12px 12px 0 0;
}

.modal-header h3 {
  margin: 0;
  color: #2d3748;
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e9ecef;
  text-align: center;
  background: #f8f9fa;
  border-radius: 0 0 12px 12px;
}

/* AUTH MODAL STYLES */
#loginModal.auth-modal,
#verificationModal.auth-modal,
#logoutModal,
#registerModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: var(--z-modal) !important;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#loginModal.auth-modal.active,
#verificationModal.auth-modal.active {
  display: flex !important;
}

.auth-modal__content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 420px;
  position: relative;
  animation: slideUp 0.3s ease;
  overflow: hidden;
  margin: 0;
}

.auth-modal__header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 1.5rem;
  text-align: center;
  position: relative;
}

.auth-modal__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--white);
}

.auth-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.2rem;
}

.auth-modal__close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.auth-modal__body {
  padding: 2rem;
}

/* Auth Form Styles */
.auth-form .form-group {
  margin-bottom: 1.5rem;
}

.auth-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #374151;
  font-size: 0.9rem;
}

.auth-form input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 101, 114, 0.1);
}

.auth-form input:invalid:not(:focus):not(:placeholder-shown) {
  border-color: #ef4444;
}

.auth-submit-btn {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.auth-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(74, 101, 114, 0.3);
}

.auth-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
}

/* Auth Links */
.auth-links {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.auth-links a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.auth-links a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.auth-links span {
  color: #9ca3af;
  margin: 0 0.5rem;
}

/* Verification styles */
.verification-notice {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.verification-alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #856404;
}

.verification-alert i {
  color: #f39c12;
}

.verification-prompt {
  text-align: center;
  padding: 1rem;
}

.verification-prompt i {
  font-size: 3rem;
  color: #f39c12;
  margin-bottom: 1rem;
}

/* Error States */
.auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  display: none;
}

.auth-error.active {
  display: block;
  animation: shake 0.5s ease;
}

/* Success States */
.auth-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #16a34a;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  display: none;
}

.auth-success.active {
  display: block;
}

/* Loading Animation */
.auth-loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* AGE VERIFICATION MODAL */
.age-gate {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  background: var(--gradient-hero);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-age-gate) !important;
  padding: var(--space-4);
  padding-top: calc(var(--space-4) + var(--safe-area-inset-top));
  padding-bottom: calc(var(--space-4) + var(--safe-area-inset-bottom));
  min-height: -webkit-fill-available;
  min-height: fill-available;
}
.age-gate__content {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: var(--space-6) var(--space-4);
  max-width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.5s ease-out;
  margin: 0 var(--space-4);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}
/* JS / inline-script hides the gate via this class.
   !important because .age-gate itself has display: flex. */
.age-gate.is-hidden {
  display: none !important;
}

/* Scroll lock while gate is up. Replaces document.body.style.overflow
   so we don't clobber inline styles set by other modules. */
body.age-gate-active {
  overflow: hidden;
}

.age-gate__icon {
  font-size: 2rem;
  color: var(--warning);
  margin-bottom: var(--space-6);
}
.age-gate__title {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--dark);
  margin-bottom: var(--space-4);
}
.age-gate__description {
  font-size: var(--text-base);
  color: var(--gray);
  margin-bottom: var(--space-8);
  line-height: 1.7;
}

.age-gate__buttons {
    display: flex;
    flex-direction: row;
    gap: var(--space-3);
    align-content: center;
    justify-content: center;
}

/* LOGOUT MODAL STYLES */
.logout-confirmation {
  text-align: center;
  padding: var(--space-6) 0;
}

.logout-icon {
  font-size: 4rem;
  color: var(--primary);
  margin-bottom: var(--space-5);
  opacity: 0.8;
}

.logout-confirmation h3 {
  margin-bottom: var(--space-3);
  color: var(--dark);
  font-size: 1.5rem;
  font-weight: 600;
}

.logout-confirmation p {
  color: var(--gray);
  margin-bottom: 0;
  font-size: 1.1rem;
  line-height: 1.5;
}

.logout-actions {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  margin-top: var(--space-8);
  flex-wrap: wrap;
}

/* Modal backdrop and focus management */
.auth-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
}

.auth-modal:focus {
  outline: none;
}

/* USER DASHBOARD STYLES */
.user-dashboard {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: calc(var(--z-modal) + 10) !important;
  display: none;
}

.user-dashboard__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

.user-dashboard__content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.user-dashboard__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.user-dashboard__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  padding: 5px;
}

.user-dashboard__close:hover {
  color: #374151;
  background: #e5e7eb;
  border-radius: 4px;
}

.user-dashboard__welcome {
  padding: 20px;
  background: #f0f9ff;
  border-bottom: 1px solid #e5e7eb;
}

.user-dashboard__welcome h3 {
  margin: 0;
  color: #1e40af;
  font-size: 1.25rem;
}

.user-dashboard__nav {
  display: flex;
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  overflow: hidden;
}

.user-nav__item {
  padding: 15px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  color: #6b7280;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s;
}

.user-nav__item.active {
  color: #1e40af;
  border-bottom-color: #1e40af;
}

.user-nav__item:hover {
  color: #374151;
}

.user-dashboard__pages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.user-page {
  display: none;
}

.user-page.active {
  display: block;
}

/* PROFILE FORM STYLES */
.profile-form {
  max-width: 500px;
  margin-bottom: 30px;
}

.profile-form h3 {
  margin-bottom: 20px;
  color: #1f2937;
  font-size: 1.5rem;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #374151;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: #1e40af;
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.readonly-field {
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #6b7280;
}

.verification-status {
  margin-top: 5px;
  font-size: 12px;
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Stats Grid */
.profile-stats {
  margin-top: 30px;
}

.profile-stats h3 {
  margin-bottom: 20px;
  color: #1f2937;
  font-size: 1.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
}

.stat-card {
  background: #f8fafc;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid #e5e7eb;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-number {
  font-size: 2rem;
  font-weight: bold;
  color: #1e40af;
  margin-bottom: 5px;
}

.stat-label {
  color: #6b7280;
  font-size: 14px;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.empty-state i {
  font-size: 3rem;
  color: #d1d5db;
  margin-bottom: 15px;
}

.empty-state h3 {
  margin: 0 0 10px 0;
  color: #374151;
}

.empty-state p {
  margin: 0 0 20px 0;
}

/* Badges */
.badge {
  background: var(--primary);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 20px;
  font-weight: 600;
}

/* Page Headers */
.page-header {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e5e7eb;
}

.page-header h3 {
  margin: 0;
  color: #1f2937;
}

/* ===================================
   NOTIFICATIONS & FEEDBACK
   =================================== */

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  top: 100px;
  right: 20px;
  z-index: var(--z-toast) !important;
  max-width: 400px;
}

.toast {
  background: white;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-left: 4px solid #ccc;
  animation: slideInRight 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 300px;
  color:#1f2937;
}

.toast-success {
  border-left-color: #10b981;
}

.toast-error {
  border-left-color: #ef4444;
}

.toast-info {
  border-left-color: #3b82f6;
}

.toast-warning {
  border-left-color: #f59e0b;
}

.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.toast-success .toast-icon {
  color: #10b981;
}

.toast-error .toast-icon {
  color: #ef4444;
}

.toast-info .toast-icon {
  color: #3b82f6;
}

.toast-warning .toast-icon {
  color: #f59e0b;
}

.toast-message {
  flex: 1;
  font-weight: 500;
}

.toast.hiding {
  animation: slideOutRight 0.3s ease;
}