/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid #10B981;
  outline-offset: 2px;
}

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

.btn-primary {
  background: linear-gradient(135deg, #059669, #10B981);
  color: white;
  border-radius: 999px;
  padding: 12px 24px;
  box-shadow: 0 4px 16px rgba(5,150,105,0.25);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(5,150,105,0.3);
}

.btn-secondary {
  background: rgba(255,255,255,0.6);
  color: #1E293B;
  border: 1.5px solid #E2E8F0;
  border-radius: 999px;
  padding: 12px 24px;
  backdrop-filter: blur(8px);
}

.btn-secondary:hover:not(:disabled) {
  border-color: #94A3B8;
  background: #F8FAFC;
}

.btn-ghost {
  background: transparent;
  color: #64748B;
  border-radius: 999px;
  padding: 10px 20px;
}

.btn-ghost:hover:not(:disabled) {
  background: #F1F5F9;
}

.btn-danger {
  background: #EF4444;
  color: white;
  border-radius: 999px;
  padding: 12px 24px;
}

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
}

.btn-sm {
  height: 32px;
  padding: 6px 16px;
  font-size: var(--text-body-sm);
}

.btn-lg {
  padding: 16px 32px;
  font-size: var(--text-body);
}

.btn-full {
  width: 100%;
}

/* ---- Cards ---- */
.card {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(226,232,240,0.5);
  border-radius: 20px;
  padding: 24px;
  transition: all 0.25s;
}

.card:hover {
  box-shadow: 0 8px 32px rgba(15,23,42,0.06);
  background: rgba(255,255,255,0.9);
}

.card-elevated {
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(15,23,42,0.08);
  padding: 24px;
  transition: all 0.25s;
}

.card-elevated:hover {
  box-shadow: 0 32px 80px rgba(15,23,42,0.1);
  transform: translateY(-2px);
}

.card-metric {
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226,232,240,0.4);
  border-radius: 20px;
  padding: 20px;
}

.card-metric .metric-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #F0FDF4;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #059669;
}

.card-metric .metric-value {
  font-size: var(--text-h2);
  font-weight: 700;
  color: #0F172A;
  font-family: var(--font-heading);
  margin-top: 12px;
}

.card-metric .metric-label {
  font-size: var(--text-body-sm);
  color: #94A3B8;
  margin-top: 2px;
}

/* ---- Activity Card ---- */
.activity-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226,232,240,0.5);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.activity-card:hover {
  border-color: #D1FAE5;
  box-shadow: 0 4px 16px rgba(15,23,42,0.06);
  background: rgba(255,255,255,0.9);
}

.activity-card .activity-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #F0FDF4;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #059669;
}

.activity-card .activity-title {
  font-size: var(--text-body);
  font-weight: 600;
  color: #0F172A;
}

.activity-card .activity-meta {
  font-size: var(--text-caption);
  color: #94A3B8;
  margin-top: 2px;
}

.activity-card .activity-arrow {
  color: #94A3B8;
  flex-shrink: 0;
}

/* ---- Progress Card ---- */
.progress-card {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226,232,240,0.5);
  border-radius: 20px;
  padding: 24px;
}

.progress-card .progress-title {
  font-size: var(--text-h4);
  color: #0F172A;
  font-family: var(--font-heading);
}

.progress-card .progress-value {
  font-size: var(--text-h3);
  color: #059669;
  font-family: var(--font-heading);
}

.progress-card .progress-bar {
  height: 8px;
  background: #F1F5F9;
  border-radius: 999px;
  overflow: hidden;
}

.progress-card .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10B981, #34D399);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-card .progress-label {
  font-size: var(--text-caption);
  color: #94A3B8;
  margin-top: 8px;
}

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: var(--text-body-sm);
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  height: 40px;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  color: #0F172A;
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  transition: all 0.2s;
}

.form-input::placeholder,
.form-textarea::placeholder { color: #94A3B8; }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background: #F8FAFC;
  color: #94A3B8;
  cursor: not-allowed;
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: #EF4444;
}

.form-textarea {
  height: auto;
  min-height: 100px;
  resize: vertical;
}

.form-hint { font-size: var(--text-caption); color: #94A3B8; margin-top: 4px; }
.form-error { font-size: var(--text-caption); color: #EF4444; margin-top: 4px; }

/* ---- Alerts ---- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid;
  font-size: var(--text-body-sm);
}

.alert-success { background: #F0FDF4; border-color: #A7F3D0; color: #065F46; }
.alert-warning { background: #FEF3C7; border-color: #FDE68A; color: #92400E; }
.alert-error { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.alert-info { background: #EEF2FF; border-color: #C7D2FE; color: #3730A3; }

.alert-icon { flex-shrink: 0; font-size: 1.25rem; }

/* ---- Toast ---- */
.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}

.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 12px;
  box-shadow: 0 16px 48px rgba(15,23,42,0.1);
  pointer-events: auto;
  animation: slideUp 300ms ease forwards;
}

.toast-success { background: #059669; color: white; }
.toast-error { background: #DC2626; color: white; }
.toast-info { background: #1E293B; color: white; }

.toast-close {
  margin-left: auto; background: none; border: none; color: inherit;
  opacity: 0.7; cursor: pointer; padding: 4px; border-radius: 4px;
}
.toast-close:hover { opacity: 1; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.3);
  backdrop-filter: blur(4px); z-index: 40;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}

.modal-panel {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 24px;
  box-shadow: 0 32px 80px rgba(15,23,42,0.12);
  width: 100%; max-width: 512px; max-height: 85vh; overflow-y: auto;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between; padding: 24px 24px 0;
}

.modal-title { font-size: var(--text-h3); color: #0F172A; font-family: var(--font-heading); }

.modal-close {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; background: none; border: none; color: #94A3B8; cursor: pointer;
}
.modal-close:hover { background: #F1F5F9; }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 16px 24px; border-top: 1px solid #F1F5F9;
  background: rgba(255,255,255,0.5);
  border-radius: 0 0 24px 24px;
}

/* ---- Chat Bubbles ---- */
.chat-bubble-user {
  max-width: 80%;
  background: #059669;
  color: white;
  border-radius: 20px 20px 4px 20px;
  padding: 10px 16px;
  align-self: flex-end;
}

.chat-bubble-other {
  max-width: 80%;
  background: #F1F5F9;
  color: #0F172A;
  border-radius: 20px 20px 20px 4px;
  padding: 10px 16px;
  align-self: flex-start;
}

/* ---- Avatar ---- */
.avatar { width: 40px; height: 40px; border-radius: 999px; object-fit: cover; background: #F0FDF4; }
.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 80px; height: 80px; }

/* ---- Badge ---- */
.badge {
  display: inline-flex; align-items: center; padding: 2px 10px;
  font-size: var(--text-caption); font-weight: 600; border-radius: 999px; white-space: nowrap;
}

.badge-primary { background: #D1FAE5; color: #065F46; }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-error { background: #FEE2E2; color: #991B1B; }
.badge-neutral { background: #F1F5F9; color: #64748B; }

/* ---- Stats / KPI Card ---- */
.stat { display: flex; align-items: center; gap: 12px; }

.stat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.stat-icon.primary { background: #F0FDF4; color: #059669; }
.stat-icon.accent { background: #FEF3C7; color: #D97706; }
.stat-icon.info { background: #DBEAFE; color: #2563EB; }

.stat-value {
  font-size: var(--text-h2); font-weight: 700; color: #0F172A;
  font-family: var(--font-heading); line-height: 1;
}

.stat-label { font-size: var(--text-body-sm); color: #94A3B8; margin-top: 2px; }

.stat-change { font-size: var(--text-caption); font-weight: 600; margin-top: 2px; }
.stat-change.positive { color: #10B981; }
.stat-change.negative { color: #EF4444; }

/* ---- Header ---- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; height: 64px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(226,232,240,0.5);
  z-index: 50;
  display: flex; align-items: center; padding: 0 24px;
}

.site-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; max-width: 1280px; margin: 0 auto;
}

.site-logo { font-family: var(--font-heading); font-size: 22px; color: #059669; text-decoration: none; }

.site-nav { display: flex; align-items: center; gap: 24px; }

.site-nav a {
  font-size: var(--text-body-sm); font-weight: 600;
  color: #64748B; text-decoration: none; transition: color 0.2s;
}
.site-nav a:hover { color: #0F172A; }
.site-nav a.active { color: #059669; }

/* ---- Footer ---- */
.site-footer { background: #0F172A; padding: 48px 24px; }

.site-footer-inner {
  max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px;
}

.site-footer-logo { font-family: var(--font-heading); font-size: 20px; color: white; margin-bottom: 8px; }
.site-footer-tagline { font-size: var(--text-body-sm); color: rgba(255,255,255,0.3); max-width: 280px; }

.site-footer-heading { font-size: var(--text-body-sm); font-weight: 700; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; display: block; }

.site-footer-links { display: flex; flex-direction: column; gap: 8px; }
.site-footer-links a { font-size: var(--text-body-sm); color: rgba(255,255,255,0.3); text-decoration: none; transition: color 0.2s; }
.site-footer-links a:hover { color: white; }

.site-footer-bottom {
  max-width: 1280px; margin: 32px auto 0; padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.04);
  font-size: var(--text-caption); color: rgba(255,255,255,0.2); text-align: center;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed; left: 0; top: 0; width: 240px; height: 100vh;
  background: white; border-right: 1px solid #F1F5F9;
  display: flex; flex-direction: column; padding: 32px 0; z-index: 40;
}

.sidebar-logo { padding: 0 24px; margin-bottom: 40px; }
.sidebar-logo a { font-family: var(--font-heading); font-size: 20px; color: #059669; text-decoration: none; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 0 16px; }

.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; font-size: var(--text-body-sm);
  font-weight: 500; color: #64748B; text-decoration: none;
  border-radius: 10px; transition: all 0.2s;
}
.sidebar-link:hover { background: #F8FAFC; color: #0F172A; }
.sidebar-link.active { background: #F0FDF4; color: #059669; font-weight: 600; }

.sidebar-link .icon { font-size: 1.25rem; width: 24px; text-align: center; }

.sidebar-footer { padding: 16px 24px 0; border-top: 1px solid #F1F5F9; margin-top: auto; }
.sidebar-user { display: flex; align-items: center; gap: 12px; text-decoration: none; }

.sidebar-user-name { font-size: var(--text-body-sm); font-weight: 600; color: #0F172A; }
.sidebar-user-role { font-size: var(--text-caption); color: #94A3B8; }

/* ---- Grid Helpers ---- */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

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

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

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

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

.animate-fade-in { animation: fadeIn 200ms ease forwards; }
.animate-slide-up { animation: slideUp 200ms ease forwards; }
.animate-scale-in { animation: scaleIn 200ms ease forwards; }
