/* ══════════════════════════════════════════
   IPTPI Admin Panel — Premium Styles v3.0
   ══════════════════════════════════════════ */

/* ── CSS Variables ──────────────────── */
:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --primary-glow: rgba(79, 70, 229, 0.15);
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --bg-base: #f1f5f9;
  --bg-card: #ffffff;
  --bg-elevated: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px var(--primary-glow);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

.dark {
  --bg-base: #0f172a;
  --bg-card: #1e293b;
  --bg-elevated: #1a2332;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --border-light: #1e293b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.2);
  --primary-glow: rgba(99, 102, 241, 0.25);
}

/* ── Base ───────────────────────────── */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

::selection {
  background: var(--primary-light);
  color: #ffffff;
}

.dark ::selection {
  background: var(--primary);
  color: #ffffff;
}

/* ── Scrollbar ──────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }
.dark ::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* ── Typography ─────────────────────── */
h1 { font-weight: 800; letter-spacing: -0.025em; }
h2 { font-weight: 700; letter-spacing: -0.015em; }
h3 { font-weight: 600; }

/* ── Background Pattern ─────────────── */
.bg-pattern {
  background-image:
    radial-gradient(circle at 20% 50%, var(--primary-glow) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(245, 158, 11, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 10% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
}

/* ── Cards ──────────────────────────── */
.card-premium {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.card-premium::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.card-premium:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
  border-color: #cbd5e1;
}

.card-premium:hover::before { opacity: 1; }

.dark .card-premium {
  box-shadow: var(--shadow);
}
.dark .card-premium:hover {
  border-color: #475569;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* ── Stat Cards ─────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-slow);
  cursor: pointer;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.stat-card:hover::after { opacity: 1; }
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.stat-card:hover .stat-icon {
  transform: scale(1.1);
  box-shadow: 0 0 20px var(--primary-glow);
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card .stat-label {
  font-size: 0.813rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Tables ─────────────────────────── */
.table-premium {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-premium thead th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.688rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.table-premium tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: background var(--transition);
}

.table-premium tbody tr {
  transition: all var(--transition);
}

.table-premium tbody tr:hover {
  background: var(--primary-glow);
}

.table-premium tbody tr:hover td {
  color: var(--text-primary);
}

.table-premium tbody tr:last-child td {
  border-bottom: none;
}

/* ── Buttons ────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.813rem;
  letter-spacing: 0.01em;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-primary:hover { box-shadow: 0 4px 16px var(--primary-glow); }

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}
.btn-success:hover { box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3); }

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}
.btn-danger:hover { box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-color);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
}

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.75rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 0.938rem; border-radius: var(--radius); }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ── Form Inputs ────────────────────── */
.input-premium {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  transition: all var(--transition);
  outline: none;
}

.input-premium:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-premium::placeholder {
  color: var(--text-muted);
}

.input-premium:hover {
  border-color: #94a3b8;
}

select.input-premium {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.5rem;
}

textarea.input-premium {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

/* ── Search Bar ─────────────────────── */
.search-box {
  position: relative;
}

.search-box input {
  padding-left: 2.75rem;
}

.search-box::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%2394a3b8' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
  background-size: contain;
  pointer-events: none;
}

/* ── Badges ─────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  font-size: 0.688rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 99px;
  line-height: 1.4;
}

.badge-primary { background: rgba(79, 70, 229, 0.1); color: var(--primary); }
.badge-success { background: rgba(16, 185, 129, 0.1); color: #059669; }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.badge-danger  { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.badge-info    { background: rgba(59, 130, 246, 0.1); color: #2563eb; }

.dark .badge-primary { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
.dark .badge-success { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.dark .badge-warning { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.dark .badge-danger  { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.dark .badge-info    { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }

/* ── Pagination ─────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  font-size: 0.813rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  color: var(--text-secondary);
  text-decoration: none;
}

.pagination a:hover {
  background: var(--bg-elevated);
  color: var(--primary);
}

.pagination .active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* ── Toast Notifications ────────────── */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 400px;
}

.toast::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 0 0 var(--radius) var(--radius);
  animation: toastTimer 3s linear forwards;
}

.toast-success::before { background: var(--success); }
.toast-error::before { background: var(--danger); }
.toast-info::before { background: var(--info); }

@keyframes toastTimer {
  from { width: 100%; }
  to { width: 0%; }
}

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

/* ── Dropdowns ──────────────────────── */
.dropdown-enter {
  animation: dropdownEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownEnter {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Loading Skeleton ──────────────── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--border-color) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* ── Animations ─────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.fade-in-up-1 { animation-delay: 0.05s; }
.fade-in-up-2 { animation-delay: 0.1s; }
.fade-in-up-3 { animation-delay: 0.15s; }
.fade-in-up-4 { animation-delay: 0.2s; }
.fade-in-up-5 { animation-delay: 0.25s; }

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.animate-pulse-soft {
  animation: pulse-soft 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* ── Glass Morphism ─────────────────── */
.glass {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.dark .glass {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── Gradient Text ──────────────────── */
.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gradient-text-blue {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Dividers ────────────────────────── */
hr.premium {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

/* ── Empty State ────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state svg {
  margin: 0 auto 1rem;
  opacity: 0.3;
}
.empty-state p {
  font-size: 0.875rem;
}

/* ── Checkbox & Radio ───────────────── */
.custom-checkbox {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  flex-shrink: 0;
}
.custom-checkbox:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.custom-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.custom-checkbox:hover {
  border-color: var(--primary-light);
}

/* ── Tabs ───────────────────────────── */
.tab {
  padding: 0.5rem 1.25rem;
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
}
.tab:hover { color: var(--text-secondary); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Tooltips ───────────────────────── */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.25rem 0.625rem;
  font-size: 0.688rem;
  font-weight: 600;
  color: #fff;
  background: #1e293b;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── Progress Bar ───────────────────── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-light);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Avatar Group ───────────────────── */
.avatar-stack {
  display: flex;
}
.avatar-stack > * {
  margin-left: -0.5rem;
  transition: transform var(--transition);
}
.avatar-stack > *:first-child { margin-left: 0; }
.avatar-stack:hover > * { margin-left: 0; }

/* ── Ripple Effect ──────────────────── */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple::after {
  content: '';
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 10%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10);
  opacity: 0;
  transition: transform 0.5s, opacity 1s;
}
.ripple:active::after {
  transform: scale(0);
  opacity: 0.3;
  transition: 0s;
}

/* ── Mobile Menu ────────────────────── */
@keyframes slideDown {
  from { max-height: 0; opacity: 0; }
  to { max-height: 1000px; opacity: 1; }
}
.mobile-menu-enter {
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Focus ring (global override) ───── */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Card pattern decoration ────────── */
.card-accent-top {
  border-top: 3px solid var(--primary);
}
.card-accent-left {
  border-left: 3px solid var(--primary);
}
.card-accent-green { border-color: var(--success); }
.card-accent-amber { border-color: var(--accent); }
.card-accent-red   { border-color: var(--danger); }

/* ── File upload zone ────────────────── */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
  background: var(--bg-elevated);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-glow);
}
.upload-zone svg {
  margin: 0 auto 0.75rem;
  color: var(--text-muted);
  transition: color var(--transition);
}
.upload-zone:hover svg {
  color: var(--primary);
}

/* ── Print styles ───────────────────── */
@media print {
  body { background: #fff !important; color: #000 !important; }
  nav, footer, .no-print { display: none !important; }
  .card-premium { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
