/* ============================================================
   Siltums SaaS — Design System
   Glassmorphism + Neumorphism + Micro-animations
   ============================================================ */

/* ── Tenant Branding CSS Variables ── */
:root {
  --brand-primary: #e67e22;
  --brand-primary-light: #f39c12;
  --brand-primary-dark: #d35400;
  --brand-secondary: #2c3e50;
  --brand-accent: #3498db;
  --brand-success: #27ae60;
  --brand-warning: #f39c12;
  --brand-error: #e74c3c;

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-bg-light: rgba(255, 255, 255, 0.12);
  --glass-bg-medium: rgba(255, 255, 255, 0.18);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  --glass-blur: blur(20px);

  /* Neo */
  --neo-bg: #ecf0f3;
  --neo-shadow-light: #ffffff;
  --neo-shadow-dark: rgba(0, 0, 0, 0.1);
  --neo-shadow: 6px 6px 12px var(--neo-shadow-dark), -6px -6px 12px var(--neo-shadow-light);
  --neo-shadow-inset: inset 4px 4px 8px var(--neo-shadow-dark), inset -4px -4px 8px var(--neo-shadow-light);
  --neo-shadow-hover: 8px 8px 16px var(--neo-shadow-dark), -8px -8px 16px var(--neo-shadow-light);

  /* Transition */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 5px var(--brand-primary); }
  50% { box-shadow: 0 0 20px var(--brand-primary), 0 0 40px rgba(230, 126, 34, 0.3); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); max-height: 0; }
  to { opacity: 1; transform: translateY(0); max-height: 500px; }
}

/* ── Glass Panel ── */
.glass-panel {
  background: var(--glass-bg-medium);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
}

.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

/* ── Neo Cards ── */
.neo-card {
  background: var(--neo-bg);
  border-radius: 16px;
  box-shadow: var(--neo-shadow);
  transition: all var(--transition-normal);
  padding: 1.5rem;
}

.neo-card:hover {
  box-shadow: var(--neo-shadow-hover);
  transform: translateY(-2px);
}

.neo-card-inset {
  background: var(--neo-bg);
  border-radius: 12px;
  box-shadow: var(--neo-shadow-inset);
  padding: 1rem;
}

/* ── Stat Cards (Dashboard) ── */
.stat-card-animated {
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.5s ease both;
}

.stat-card-animated:nth-child(1) { animation-delay: 0.05s; }
.stat-card-animated:nth-child(2) { animation-delay: 0.1s; }
.stat-card-animated:nth-child(3) { animation-delay: 0.15s; }
.stat-card-animated:nth-child(4) { animation-delay: 0.2s; }
.stat-card-animated:nth-child(5) { animation-delay: 0.25s; }
.stat-card-animated:nth-child(6) { animation-delay: 0.3s; }

.stat-card-animated .stat-value {
  animation: countUp 0.6s ease both;
  animation-delay: 0.3s;
}

/* Gradient accent line at top of stat cards */
.stat-card-animated::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  border-radius: 12px 12px 0 0;
}

/* ── Buttons ── */
.btn-glass {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.btn-glass:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(230, 126, 34, 0.4);
}

.btn-glass:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(230, 126, 34, 0.3);
}

/* Ripple effect */
.btn-glass::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-glass:active::after {
  width: 300px;
  height: 300px;
}

.btn-outline-glass {
  background: transparent;
  color: var(--brand-primary);
  border: 2px solid var(--brand-primary);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.btn-outline-glass:hover {
  background: var(--brand-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

/* ── Tables ── */
.table-animated tbody tr {
  animation: fadeInUp 0.3s ease both;
  transition: background var(--transition-fast);
}

.table-animated tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

.table-animated tbody tr:hover {
  background: rgba(230, 126, 34, 0.06);
}

/* Staggered row animation */
.table-animated tbody tr:nth-child(1) { animation-delay: 0.02s; }
.table-animated tbody tr:nth-child(2) { animation-delay: 0.04s; }
.table-animated tbody tr:nth-child(3) { animation-delay: 0.06s; }
.table-animated tbody tr:nth-child(4) { animation-delay: 0.08s; }
.table-animated tbody tr:nth-child(5) { animation-delay: 0.1s; }
.table-animated tbody tr:nth-child(6) { animation-delay: 0.12s; }
.table-animated tbody tr:nth-child(7) { animation-delay: 0.14s; }
.table-animated tbody tr:nth-child(8) { animation-delay: 0.16s; }
.table-animated tbody tr:nth-child(9) { animation-delay: 0.18s; }
.table-animated tbody tr:nth-child(10) { animation-delay: 0.2s; }

/* ── Modals ── */
.modal-animated .modal-overlay {
  animation: fadeIn 0.2s ease;
}

.modal-animated .modal-content {
  animation: scaleIn 0.3s var(--transition-spring);
  backdrop-filter: blur(10px);
}

/* ── Sidebar ── */
.sidebar-glass {
  background: linear-gradient(180deg, rgba(44, 62, 80, 0.97) 0%, rgba(44, 62, 80, 0.99) 100%);
  backdrop-filter: blur(20px);
}

.sidebar-glass .nav-item.active {
  background: linear-gradient(90deg, var(--brand-primary), transparent);
  border-left: 3px solid var(--brand-primary);
  box-shadow: inset 0 0 20px rgba(230, 126, 34, 0.1);
}

.sidebar-glass .nav-item:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
  transition: all var(--transition-fast);
}

/* ── Toast Notifications ── */
.toast-animated {
  animation: slideInRight 0.4s var(--transition-spring);
  backdrop-filter: blur(10px);
  border-radius: 10px;
}

.toast-animated.toast-removing {
  animation: slideInRight 0.3s ease reverse;
}

/* Progress bar on toast */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 0 0 10px 10px;
  animation: toast-progress-shrink 4s linear forwards;
}

@keyframes toast-progress-shrink {
  from { width: 100%; }
  to { width: 0%; }
}

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 60%; }
.skeleton-text.full { width: 100%; }

.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-card {
  height: 120px;
  border-radius: 12px;
}

.skeleton-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 0;
}

/* ── Login Screen ── */
.login-glass {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: scaleIn 0.5s var(--transition-spring);
}

/* ── Hover Lift Effect ── */
.hover-lift {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

/* ── Section Transitions ── */
.section-enter {
  animation: fadeInUp 0.4s ease both;
}

/* ── Status Badges ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.status-active { background: rgba(39, 174, 96, 0.12); color: #27ae60; }
.status-badge.status-pending { background: rgba(243, 156, 18, 0.12); color: #f39c12; }
.status-badge.status-completed { background: rgba(52, 152, 219, 0.12); color: #3498db; }
.status-badge.status-cancelled { background: rgba(231, 76, 60, 0.12); color: #e74c3c; }
.status-badge.status-draft { background: rgba(149, 165, 166, 0.12); color: #95a5a6; }

/* ── Input Focus Effects ── */
.input-glass {
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.input-glass:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.15);
}

/* ── Chart Container ── */
.chart-glass {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* ── Kanban Cards ── */
.kanban-card-animated {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  border-radius: 10px;
}

.kanban-card-animated:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #95a5a6;
  animation: fadeIn 0.5s ease;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

/* ── Scrollbar ── */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .skeleton { animation: none; background: #f0f0f0; }
  .hover-lift:hover { transform: none; }
  .glass-card:hover { transform: none; }
  .neo-card:hover { transform: none; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .glass-panel { border-radius: 12px; }
  .neo-card { padding: 1rem; border-radius: 12px; }
  .stat-card-animated { animation-delay: 0s !important; }
}
