/* ============================================
   UI STATES SYSTEM v1.0
   Skeleton Screens, Loaders, Empty States, Toasts
   PropertyParking.com
   ============================================ */

/* ========================================
   1. SKELETON SCREENS (Shimmer Effect)
   ======================================== */

/* Base skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--oz-gray-200, #e2e8f0) 0%,
    var(--oz-gray-100, #f1f5f9) 50%,
    var(--oz-gray-200, #e2e8f0) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--oz-radius-md, 8px);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Skeleton variants */
.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
  border-radius: 4px;
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: 1em;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-image {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--oz-radius-lg, 12px);
}

.skeleton-button {
  height: 44px;
  width: 120px;
  border-radius: var(--oz-radius-full, 9999px);
}

/* ========================================
   SKELETON CARD (Space Card Placeholder)
   ======================================== */

.skeleton-card {
  background: white;
  border-radius: var(--oz-radius-xl, 16px);
  border: 1px solid var(--oz-gray-200, #e2e8f0);
  overflow: hidden;
}

.skeleton-card-image {
  height: 200px;
  background: linear-gradient(
    90deg,
    var(--oz-gray-200, #e2e8f0) 0%,
    var(--oz-gray-100, #f1f5f9) 50%,
    var(--oz-gray-200, #e2e8f0) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-card-content {
  padding: 1.25rem;
}

.skeleton-card-title {
  height: 24px;
  width: 75%;
  margin-bottom: 12px;
  background: linear-gradient(
    90deg,
    var(--oz-gray-200, #e2e8f0) 0%,
    var(--oz-gray-100, #f1f5f9) 50%,
    var(--oz-gray-200, #e2e8f0) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-card-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.skeleton-card-meta-item {
  height: 16px;
  width: 80px;
  background: linear-gradient(
    90deg,
    var(--oz-gray-200, #e2e8f0) 0%,
    var(--oz-gray-100, #f1f5f9) 50%,
    var(--oz-gray-200, #e2e8f0) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--oz-gray-100, #f1f5f9);
}

.skeleton-card-price {
  height: 28px;
  width: 100px;
  background: linear-gradient(
    90deg,
    var(--oz-gray-200, #e2e8f0) 0%,
    var(--oz-gray-100, #f1f5f9) 50%,
    var(--oz-gray-200, #e2e8f0) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-card-button {
  height: 36px;
  width: 90px;
  background: linear-gradient(
    90deg,
    var(--oz-gray-200, #e2e8f0) 0%,
    var(--oz-gray-100, #f1f5f9) 50%,
    var(--oz-gray-200, #e2e8f0) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 9999px;
}

/* Staggered animation for multiple skeletons */
.skeleton-card:nth-child(1) { animation-delay: 0s; }
.skeleton-card:nth-child(2) { animation-delay: 0.1s; }
.skeleton-card:nth-child(3) { animation-delay: 0.2s; }
.skeleton-card:nth-child(4) { animation-delay: 0.3s; }
.skeleton-card:nth-child(5) { animation-delay: 0.4s; }
.skeleton-card:nth-child(6) { animation-delay: 0.5s; }

/* ========================================
   2. ENHANCED LOADING STATES
   ======================================== */

/* Contextual loader */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  grid-column: 1 / -1;
}

/* Animated dots loader */
.loader-dots {
  display: flex;
  gap: 6px;
  margin-bottom: 1rem;
}

.loader-dots span {
  width: 10px;
  height: 10px;
  background: var(--oz-primary-500, #3b82f6);
  border-radius: 50%;
  animation: loader-bounce 1.4s ease-in-out infinite both;
}

.loader-dots span:nth-child(1) { animation-delay: -0.32s; }
.loader-dots span:nth-child(2) { animation-delay: -0.16s; }
.loader-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes loader-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Pulse ring loader */
.loader-pulse {
  position: relative;
  width: 56px;
  height: 56px;
  margin-bottom: 1rem;
}

.loader-pulse::before,
.loader-pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--oz-primary-500, #3b82f6);
  animation: loader-pulse-ring 1.5s ease-out infinite;
}

.loader-pulse::after {
  animation-delay: 0.5s;
}

@keyframes loader-pulse-ring {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

.loader-pulse-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  background: var(--oz-primary-500, #3b82f6);
  border-radius: 50%;
}

/* Loading text with typing effect */
.loader-text {
  font-size: 0.9375rem;
  color: var(--oz-gray-600, #475569);
  font-weight: 500;
}

.loader-subtext {
  font-size: 0.8125rem;
  color: var(--oz-gray-400, #94a3b8);
  margin-top: 0.5rem;
}

/* Progress bar loader */
.loader-progress {
  width: 200px;
  height: 4px;
  background: var(--oz-gray-200, #e2e8f0);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.loader-progress-bar {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--oz-primary-500, #3b82f6),
    var(--oz-primary-400, #60a5fa)
  );
  border-radius: 2px;
  animation: loader-progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes loader-progress-indeterminate {
  0% {
    width: 0%;
    margin-left: 0%;
  }
  50% {
    width: 60%;
    margin-left: 20%;
  }
  100% {
    width: 0%;
    margin-left: 100%;
  }
}

/* ========================================
   3. EMPTY STATES (Illustrated)
   ======================================== */

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  background: white;
  border-radius: var(--oz-radius-xl, 16px);
  border: 2px dashed var(--oz-gray-200, #e2e8f0);
}

.empty-state-illustration {
  width: 180px;
  height: 180px;
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--oz-gray-100, #f1f5f9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon svg {
  width: 40px;
  height: 40px;
  color: var(--oz-gray-400, #94a3b8);
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--oz-gray-900, #0f172a);
  margin-bottom: 0.5rem;
}

.empty-state-description {
  font-size: 0.9375rem;
  color: var(--oz-gray-500, #64748b);
  max-width: 360px;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.empty-state-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--oz-primary-500, #3b82f6);
  color: white;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.empty-state-action:hover {
  background: var(--oz-primary-600, #2563eb);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.empty-state-action svg {
  width: 18px;
  height: 18px;
}

/* Empty state variants */
.empty-state--search {
  border-style: solid;
  background: var(--oz-gray-50, #f8fafc);
}

.empty-state--error {
  border-color: var(--oz-error-light, #fee2e2);
  background: #fffbfb;
}

.empty-state--error .empty-state-icon {
  background: var(--oz-error-light, #fee2e2);
}

.empty-state--error .empty-state-icon svg {
  color: var(--oz-error, #ef4444);
}

/* ========================================
   4. INLINE SVG ILLUSTRATIONS
   ======================================== */

/* No spaces illustration */
.illustration-no-spaces {
  --ill-primary: var(--oz-primary-500, #3b82f6);
  --ill-secondary: var(--oz-primary-200, #bfdbfe);
  --ill-bg: var(--oz-gray-100, #f1f5f9);
}

/* Search no results */
.illustration-no-results {
  --ill-primary: var(--oz-warning, #f59e0b);
  --ill-secondary: var(--oz-warning-light, #fef3c7);
}

/* Error illustration */
.illustration-error {
  --ill-primary: var(--oz-error, #ef4444);
  --ill-secondary: var(--oz-error-light, #fee2e2);
}

/* ========================================
   5. TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: white;
  border-radius: 12px;
  box-shadow: 
    0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border-left: 4px solid var(--oz-primary-500, #3b82f6);
  pointer-events: auto;
  animation: toast-slide-in 0.3s ease-out;
  max-width: 380px;
}

@keyframes toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.toast-exit {
  animation: toast-slide-out 0.2s ease-in forwards;
}

@keyframes toast-slide-out {
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--oz-gray-900, #0f172a);
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.8125rem;
  color: var(--oz-gray-600, #475569);
  line-height: 1.4;
}

.toast-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--oz-gray-400, #94a3b8);
  transition: all 0.15s ease;
  margin: -4px -6px -4px 0;
}

.toast-close:hover {
  background: var(--oz-gray-100, #f1f5f9);
  color: var(--oz-gray-600, #475569);
}

.toast-close svg {
  width: 16px;
  height: 16px;
}

/* Toast variants */
.toast--success {
  border-left-color: var(--oz-success, #10b981);
}

.toast--success .toast-icon {
  color: var(--oz-success, #10b981);
}

.toast--error {
  border-left-color: var(--oz-error, #ef4444);
}

.toast--error .toast-icon {
  color: var(--oz-error, #ef4444);
}

.toast--warning {
  border-left-color: var(--oz-warning, #f59e0b);
}

.toast--warning .toast-icon {
  color: var(--oz-warning, #f59e0b);
}

.toast--info {
  border-left-color: var(--oz-primary-500, #3b82f6);
}

.toast--info .toast-icon {
  color: var(--oz-primary-500, #3b82f6);
}

/* ========================================
   6. TRANSITION UTILITIES
   ======================================== */

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

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

.fade-in-up {
  animation: fadeInUp 0.4s ease-out;
}

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

.fade-in-scale {
  animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Stagger children */
.stagger-children > * {
  animation: fadeInUp 0.4s ease-out backwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.45s; }

/* ========================================
   7. RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
  
  .toast {
    max-width: none;
  }
  
  .empty-state {
    padding: 3rem 1.5rem;
  }
  
  .empty-state-illustration {
    width: 140px;
    height: 140px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .skeleton-card-image,
  .skeleton-card-title,
  .skeleton-card-meta-item,
  .skeleton-card-price,
  .skeleton-card-button {
    animation: none;
    background: var(--oz-gray-200, #e2e8f0);
  }
  
  .loader-dots span,
  .loader-pulse::before,
  .loader-pulse::after,
  .loader-progress-bar {
    animation: none;
  }
  
  .toast {
    animation: none;
  }
  
  .fade-in,
  .fade-in-up,
  .fade-in-scale,
  .stagger-children > * {
    animation: none;
  }
}

/* ========================================
   DARK MODE SUPPORT (Admin Panel)
   Add .dark-mode class to body or container
   ======================================== */

.dark-mode {
  --ui-bg-skeleton: #2a2a35;
  --ui-bg-skeleton-highlight: #35354a;
  --ui-bg-card: #1f1f28;
  --ui-bg-empty: #1a1a21;
  --ui-border: rgba(255, 255, 255, 0.08);
  --ui-text-primary: #ffffff;
  --ui-text-secondary: #a1a1aa;
  --ui-text-muted: #71717a;
  --ui-accent: #6366f1;
}

/* Dark mode: Skeleton screens */
.dark-mode .skeleton,
.dark-mode .skeleton-card-image,
.dark-mode .skeleton-card-title,
.dark-mode .skeleton-card-meta-item,
.dark-mode .skeleton-card-price,
.dark-mode .skeleton-card-button,
.dark-mode [class*="skeleton-"] {
  background: linear-gradient(
    90deg,
    var(--ui-bg-skeleton, #2a2a35) 0%,
    var(--ui-bg-skeleton-highlight, #35354a) 50%,
    var(--ui-bg-skeleton, #2a2a35) 100%
  );
  background-size: 200% 100%;
}

.dark-mode .skeleton-card {
  background: var(--ui-bg-card, #1f1f28);
  border-color: var(--ui-border, rgba(255, 255, 255, 0.08));
}

/* Dark mode: Empty states */
.dark-mode .empty-state {
  background: var(--ui-bg-card, #1f1f28);
  border-color: var(--ui-border, rgba(255, 255, 255, 0.08));
}

.dark-mode .empty-state-icon {
  background: rgba(99, 102, 241, 0.15);
}

.dark-mode .empty-state-title {
  color: var(--ui-text-primary, #ffffff);
}

.dark-mode .empty-state-description {
  color: var(--ui-text-secondary, #a1a1aa);
}

.dark-mode .empty-state-action {
  background: var(--ui-accent, #6366f1);
}

.dark-mode .empty-state-action:hover {
  background: #818cf8;
}

/* Dark mode: Loaders */
.dark-mode .loader-dots span {
  background: var(--ui-accent, #6366f1);
}

.dark-mode .loader-pulse::before,
.dark-mode .loader-pulse::after {
  border-color: var(--ui-accent, #6366f1);
}

.dark-mode .loader-pulse-center {
  background: var(--ui-accent, #6366f1);
}

.dark-mode .loader-text {
  color: var(--ui-text-primary, #ffffff);
}

.dark-mode .loader-subtext {
  color: var(--ui-text-muted, #71717a);
}

.dark-mode .loader-progress {
  background: var(--ui-bg-skeleton, #2a2a35);
}

.dark-mode .loader-progress-bar {
  background: linear-gradient(90deg, var(--ui-accent, #6366f1), #818cf8);
}

/* Dark mode: Toasts */
.dark-mode .toast {
  background: var(--ui-bg-card, #1f1f28);
  border-color: var(--ui-border, rgba(255, 255, 255, 0.08));
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.dark-mode .toast-title {
  color: var(--ui-text-primary, #ffffff);
}

.dark-mode .toast-message {
  color: var(--ui-text-secondary, #a1a1aa);
}

.dark-mode .toast-close {
  color: var(--ui-text-muted, #71717a);
}

.dark-mode .toast-close:hover {
  color: var(--ui-text-primary, #ffffff);
  background: rgba(255, 255, 255, 0.1);
}

/* Dark mode: Admin-specific skeleton cards */
.dark-mode .admin-skeleton-card {
  background: var(--ui-bg-card, #1f1f28);
  border: 1px solid var(--ui-border, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 1rem;
}

.dark-mode .admin-skeleton-stat {
  background: var(--ui-bg-card, #1f1f28);
  border: 1px solid var(--ui-border, rgba(255, 255, 255, 0.08));
  border-radius: 16px;
  padding: 1.25rem;
}

.dark-mode .admin-skeleton-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--ui-border, rgba(255, 255, 255, 0.08));
}

.dark-mode .admin-skeleton-row:last-child {
  border-bottom: none;
}

/* ============================================
   8. PP-TOAST STYLES (config.js showToast için)
   CSP Strict Mode - Inline style yerine
   ============================================ */

/* PP Toast - config.js showToast() function için */
.pp-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  z-index: 10000;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: pp-toast-slideIn 0.3s ease;
}

.pp-toast-exit {
  animation: pp-toast-slideOut 0.3s ease forwards;
}

/* Toast type colors */
.pp-toast-success { background-color: #22c55e; }
.pp-toast-error { background-color: #ef4444; }
.pp-toast-warning { background-color: #f59e0b; }
.pp-toast-info { background-color: #3b82f6; }

/* PP Toast Animations */
@keyframes pp-toast-slideIn {
  from { 
    transform: translateX(100%); 
    opacity: 0; 
  }
  to { 
    transform: translateX(0); 
    opacity: 1; 
  }
}

@keyframes pp-toast-slideOut {
  from { 
    transform: translateX(0); 
    opacity: 1; 
  }
  to { 
    transform: translateX(100%); 
    opacity: 0; 
  }
}

/* ============================================
   9. SKELETON LIST STYLES (ui-states.js için)
   CSP Strict Mode - Inline style yerine
   ============================================ */

.skeleton-list-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--oz-gray-100, #f1f5f9);
}

.skeleton-list-item:last-child {
  border-bottom: none;
}

.skeleton-list-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-text-60 {
  width: 60%;
}

.skeleton-text-40 {
  width: 40%;
}

/* ============================================
   10. PP-TOAST RESPONSIVE & REDUCED MOTION
   ============================================ */

@media (max-width: 768px) {
  .pp-toast {
    left: 16px;
    right: 16px;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pp-toast,
  .pp-toast-exit {
    animation: none;
  }
  
  .pp-toast-exit {
    opacity: 0;
  }
}