/* ============================================================
   styles.css - Escalia Design System
   Complete redesign with coral brand, collapsible sidebar,
   action dropdowns, skeleton loading, and accessibility.
   ============================================================ */

/* ---- CSS Custom Properties ---- */
:root {
  /* Primary (Coral) */
  --color-primary: #E76066;
  --color-primary-hover: #D04A50;
  --color-primary-light: #FEF2F2;
  --color-primary-100: #FDE8E8;
  --color-primary-shadow: rgba(231, 96, 102, 0.15);

  /* Accent (Gold) */
  --color-accent: #F59E0B;

  /* Semantic */
  --color-success: #10B981;
  --color-success-light: #D1FAE5;
  --color-success-dark: #065F46;
  --color-warning: #F59E0B;
  --color-warning-light: #FEF3C7;
  --color-warning-dark: #92400E;
  --color-error: #EF4444;
  --color-error-light: #FEE2E2;
  --color-error-dark: #991B1B;
  --color-info: #3B82F6;
  --color-info-light: #DBEAFE;
  --color-info-dark: #1E40AF;

  /* Sidebar */
  --sidebar-bg: #1A1A2E;
  --sidebar-hover: #252540;
  --sidebar-active: #2D2D4A;
  --sidebar-text: #C4C4D4;
  --sidebar-text-active: #FFFFFF;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;

  /* Page (Warm palette) */
  --page-bg: #F5F0EB;
  --card-bg: #FFFBF7;
  --card-border: #DDD5CC;

  /* Warm accent backgrounds */
  --warm-hover: #EDE7E0;
  --warm-subtle: #F0EAE3;
  --warm-alt: #EBE5DE;

  /* Text */
  --text-900: #1C1917;
  --text-700: #44403C;
  --text-500: #78716C;
  --text-400: #A8A29E;

  /* Borders (warm) */
  --border-200: #DDD5CC;
  --border-300: #C8BFB5;

  /* Radius */
  --radius-default: 8px;
  --radius-card: 12px;
  --radius-modal: 16px;

  /* Fonts */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--page-bg);
  color: var(--text-900);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---- Skip Link (Accessibility) ---- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--color-primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-default);
  z-index: 9999;
  font-size: 14px;
  font-weight: 600;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 16px;
  text-decoration: none;
}

/* ---- Focus Visible System ---- */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
select:focus:not(:focus-visible),
input:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
  outline: none;
}

/* ---- Layout ---- */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: width 0.25s ease, transform 0.25s ease;
  overflow: hidden;
}

.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}

/* ---- Sidebar Collapsed (Desktop: icon-only 72px) ---- */
.sidebar-icon-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}

.sidebar-icon-collapsed .main-area {
  margin-left: var(--sidebar-collapsed-width);
}

.sidebar-icon-collapsed .sidebar-brand-text,
.sidebar-icon-collapsed .sidebar-nav-label,
.sidebar-icon-collapsed .sidebar-user-details {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-icon-collapsed .sidebar-brand {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar-icon-collapsed .sidebar-nav-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar-icon-collapsed .sidebar-footer {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

.sidebar-icon-collapsed .sidebar-user-info {
  justify-content: center;
}

/* ---- Mobile Sidebar (fully hidden, overlay mode) ---- */
@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-width);
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  .main-area {
    margin-left: 0;
  }

  .sidebar-icon-collapsed .sidebar {
    width: var(--sidebar-width);
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  .sidebar-icon-collapsed .main-area {
    margin-left: 0;
  }

  .sidebar-mobile-open .sidebar {
    transform: translateX(0);
    width: var(--sidebar-width);
  }

  .sidebar-mobile-open .sidebar .sidebar-brand-text,
  .sidebar-mobile-open .sidebar .sidebar-nav-label,
  .sidebar-mobile-open .sidebar .sidebar-user-details {
    opacity: 1;
    width: auto;
  }

  .sidebar-mobile-open .sidebar .sidebar-brand {
    justify-content: flex-start;
    padding-left: 20px;
    padding-right: 20px;
  }

  .sidebar-mobile-open .sidebar .sidebar-nav-item {
    justify-content: flex-start;
    padding-left: 12px;
    padding-right: 12px;
  }

  .sidebar-mobile-open .sidebar .sidebar-footer {
    justify-content: flex-start;
    padding-left: 16px;
    padding-right: 16px;
  }

  .sidebar-mobile-open .sidebar .sidebar-user-info {
    justify-content: flex-start;
  }
}

/* ---- Sidebar Overlay (Mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 35;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-mobile-open .sidebar-overlay {
  display: block;
  opacity: 1;
}

/* ---- Sidebar Components ---- */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: padding 0.25s ease, justify-content 0.25s ease;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #E76066, #D04A50);
  border-radius: var(--radius-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
  color: #FFFFFF;
  transition: opacity 0.2s ease, width 0.25s ease;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-default);
  font-size: 14px;
  font-weight: 500;
  color: var(--sidebar-text);
  transition: all 0.15s ease;
  text-decoration: none;
  position: relative;
  border-left: 3px solid transparent;
}

.sidebar-nav-item:hover {
  background: var(--sidebar-hover);
  color: #E2E8F0;
  text-decoration: none;
}

.sidebar-nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  border-left-color: var(--color-primary);
}

.sidebar-nav-label {
  transition: opacity 0.2s ease, width 0.25s ease;
  white-space: nowrap;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ---- Sidebar Tooltip (collapsed mode) ---- */
.sidebar-nav-item[data-tooltip] {
  position: relative;
}

.sidebar-tooltip {
  display: none;
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-900);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 60;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-tooltip::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-right-color: var(--text-900);
  border-left: 0;
}

.sidebar-icon-collapsed .sidebar-nav-item:hover .sidebar-tooltip {
  display: block;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  transition: padding 0.25s ease, justify-content 0.25s ease;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  transition: justify-content 0.25s ease;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-details {
  overflow: hidden;
  transition: opacity 0.2s ease, width 0.25s ease;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #F1F5F9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Top Header ---- */
.top-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-200);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

.top-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: var(--text-500);
  display: flex;
  align-items: center;
}

.sidebar-toggle:hover {
  background: var(--warm-hover);
  color: var(--text-900);
}

.sidebar-toggle svg {
  width: 22px;
  height: 22px;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-900);
}

.top-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-header-user {
  font-size: 14px;
  color: var(--text-700);
  font-weight: 500;
}

/* ---- Page Content ---- */
.page-content {
  padding: 24px;
  flex: 1;
  animation: fadeUp 0.3s ease;
}

/* ---- Content Card ---- */
.content-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.content-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
}

.content-card-limited {
  max-width: 640px;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-200);
}

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.card-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-900);
}

.card-description {
  font-size: 14px;
  color: var(--text-500);
  margin-top: 4px;
}

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-grid-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border-200);
  border-radius: var(--radius-modal);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 4px 24px rgba(0, 0, 0, 0.15);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  animation: fadeUp 0.4s ease;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.login-logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #E76066, #D04A50);
  border-radius: var(--radius-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 28px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(231, 96, 102, 0.3);
}

.login-brand-name {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 900;
  color: var(--text-900);
}

.login-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-500);
  margin-bottom: 28px;
  margin-top: -12px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Password visibility toggle */
.password-wrapper {
  position: relative;
}

.password-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-400);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle-btn:hover {
  color: var(--text-700);
}

.password-toggle-btn svg {
  width: 18px;
  height: 18px;
}

/* ---- Form Components ---- */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-700);
}

.form-hint {
  font-size: 12px;
  color: var(--text-400);
  margin-top: 2px;
}

.form-input,
.form-select,
.form-textarea {
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-default);
  background: var(--card-bg);
  color: var(--text-900);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
  width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-shadow);
}

.form-input:disabled,
.form-select:disabled {
  background: var(--warm-hover);
  color: var(--text-500);
  cursor: not-allowed;
}

.form-select-sm {
  padding: 6px 10px;
  font-size: 13px;
}

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

.form-error {
  background: var(--color-error-light);
  border: 1px solid #FECACA;
  color: #DC2626;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-default);
  line-height: 1.5;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
}

.hidden {
  display: none !important;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-default);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
  position: relative;
}

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

.btn-xs {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-md {
  padding: 10px 18px;
  font-size: 14px;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 15px;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: var(--card-bg);
  border-color: var(--border-200);
  color: var(--text-700);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--warm-subtle);
  border-color: var(--border-300);
}

.btn-danger {
  background: var(--color-error);
  color: #fff;
}

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

.btn-success {
  background: var(--color-success);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-info {
  background: var(--color-info);
  color: #fff;
}

.btn-info:hover:not(:disabled) {
  background: #2563EB;
}

.btn-ghost {
  background: transparent;
  color: var(--text-500);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--warm-hover);
  color: var(--text-900);
}

.btn-icon {
  width: 16px;
  height: 16px;
}

/* ---- Button Loading State ---- */
.btn-loading {
  color: transparent;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
}

.btn-secondary.btn-loading::after {
  border-color: rgba(0, 0, 0, 0.1);
  border-top-color: var(--text-700);
}

@keyframes btnSpin {
  to { transform: rotate(360deg); }
}

/* ---- Badges with Status Dots ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 9999px;
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-success {
  background: var(--color-success-light);
  color: #059669;
}

.badge-success .badge-dot {
  background: var(--color-success);
}

.badge-warning {
  background: var(--color-warning-light);
  color: #D97706;
}

.badge-warning .badge-dot {
  background: var(--color-warning);
}

.badge-danger {
  background: var(--color-error-light);
  color: #DC2626;
}

.badge-danger .badge-dot {
  background: var(--color-error);
}

.badge-info {
  background: var(--color-info-light);
  color: #2563EB;
}

.badge-info .badge-dot {
  background: var(--color-info);
}

.badge-purple {
  background: #F5F0EB;
  color: #7C3AED;
}

.badge-purple .badge-dot {
  background: #7C3AED;
}

.badge-gray {
  background: var(--warm-hover);
  color: var(--text-500);
}

.badge-gray .badge-dot {
  background: var(--text-400);
}

/* ---- DataTable ---- */
.dt-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.dt-search {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.dt-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-400);
  pointer-events: none;
}

.dt-search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-default);
  background: var(--card-bg);
  color: var(--text-900);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

.dt-page-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-500);
}

.dt-select {
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-200);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-900);
  outline: none;
}

.dt-table-wrapper {
  overflow-x: auto;
}

.dt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dt-table thead th {
  background: var(--warm-subtle);
  color: var(--text-700);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-200);
  white-space: nowrap;
  user-select: none;
}

.dt-sortable {
  cursor: pointer;
}

.dt-sortable:hover {
  color: var(--color-primary);
}

.dt-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #F1F5F9;
  color: var(--text-700);
  vertical-align: middle;
}

.dt-row-even {
  background: var(--card-bg);
}

.dt-row-odd {
  background: rgba(249, 250, 251, 0.5);
}

.dt-row-even:hover,
.dt-row-odd:hover {
  background: var(--warm-hover);
}

.dt-empty {
  text-align: center;
  padding: 48px 16px !important;
  color: var(--text-400);
}

.dt-empty-icon {
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--text-400);
  opacity: 0.5;
}

.dt-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-700);
  margin-bottom: 4px;
}

.dt-empty-description {
  font-size: 13px;
  color: var(--text-400);
}

.dt-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-top: 1px solid var(--border-200);
  flex-wrap: wrap;
  gap: 12px;
}

.dt-pagination-info {
  font-size: 13px;
  color: var(--text-500);
}

.dt-pagination-btns {
  display: flex;
  gap: 8px;
}

/* ---- DataTable Column Widths ---- */
.dt-col-w-60 { width: 60px; }
.dt-col-w-90 { width: 90px; }
.dt-col-w-120 { width: 120px; }
.dt-col-w-150 { width: 150px; }
.dt-col-w-180 { width: 180px; }

/* ---- Action Dropdown ---- */
.action-dropdown {
  position: relative;
  display: inline-block;
}

.action-dropdown-trigger {
  background: none;
  border: 1px solid var(--border-200);
  border-radius: 6px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text-500);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.action-dropdown-trigger:hover {
  background: var(--warm-hover);
  color: var(--text-900);
  border-color: var(--border-300);
}

.action-dropdown-trigger svg {
  width: 16px;
  height: 16px;
}

.action-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--card-bg);
  border: 1px solid var(--border-200);
  border-radius: var(--radius-default);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.06);
  min-width: 160px;
  z-index: 50;
  padding: 4px;
  animation: dropdownFadeIn 0.15s ease;
}

.action-dropdown-menu.show {
  display: block;
}

.action-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-700);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s ease;
  font-family: inherit;
}

.action-dropdown-item:hover {
  background: var(--warm-hover);
}

.action-dropdown-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.action-dropdown-item-danger {
  color: var(--color-error);
}

.action-dropdown-item-danger:hover {
  background: var(--color-error-light);
}

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

/* ---- Action Buttons in Table (legacy fallback) ---- */
.action-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ---- Table Link ---- */
.table-link {
  color: var(--color-primary);
  font-size: 13px;
}

.table-link:hover {
  text-decoration: underline;
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-closing {
  animation: fadeOut 0.2s ease forwards;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-modal);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

.modal-lg {
  max-width: 700px;
}

.modal-sm {
  max-width: 380px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-200);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-900);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-400);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}

.modal-close-btn:hover {
  background: var(--warm-hover);
  color: var(--text-900);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-200);
}

/* ---- Confirm Dialog (centered icon + text) ---- */
.confirm-dialog-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 16px;
}

.confirm-dialog-icon-danger {
  background: var(--color-error-light);
  color: var(--color-error);
}

.confirm-dialog-icon-warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.confirm-dialog-icon svg {
  width: 28px;
  height: 28px;
}

.confirm-dialog-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-900);
  text-align: center;
  margin-bottom: 8px;
}

.confirm-dialog-message {
  font-size: 14px;
  color: var(--text-500);
  text-align: center;
  line-height: 1.5;
}

/* ---- Toast (bottom-right) ---- */
.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  max-width: 420px;
}

.toast {
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  animation: slideInUp 0.3s ease;
  overflow: hidden;
}

.toast-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.toast-enter {
  opacity: 0;
  transform: translateY(100%);
}

.toast-exit {
  opacity: 0;
  transform: translateY(100%);
}

.toast-success {
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  color: var(--color-success-dark);
}

.toast-error {
  background: var(--color-error-light);
  border: 1px solid #FECACA;
  color: var(--color-error-dark);
}

.toast-info {
  background: var(--color-info-light);
  border: 1px solid #BFDBFE;
  color: var(--color-info-dark);
}

.toast-body {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.5;
  padding: 0 4px;
  line-height: 1;
}

.toast-close:hover {
  opacity: 1;
}

/* Toast Progress Bar */
.toast-progress {
  height: 3px;
  background: rgba(0, 0, 0, 0.1);
  width: 100%;
}

.toast-progress-bar {
  height: 100%;
  width: 100%;
  transform-origin: left;
  animation: toastProgress 3s linear forwards;
}

.toast-success .toast-progress-bar {
  background: var(--color-success);
}

.toast-error .toast-progress-bar {
  background: var(--color-error);
}

.toast-info .toast-progress-bar {
  background: var(--color-info);
}

@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ---- Report Filters ---- */
.report-filters {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 20px 24px;
  flex-wrap: wrap;
}

.report-filter-btn {
  justify-content: flex-end;
}

.report-summary {
  padding: 24px;
}

/* ---- Summary Cards ---- */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.summary-card {
  border-radius: var(--radius-card);
  padding: 24px;
  border: 1px solid var(--border-200);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.summary-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.summary-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-default);
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-card-icon svg {
  width: 20px;
  height: 20px;
}

.summary-card-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-card-value {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 800;
}

.summary-card-success {
  background: #ECFDF5;
  border-color: #A7F3D0;
}

.summary-card-success .summary-card-label { color: #059669; }
.summary-card-success .summary-card-value { color: var(--color-success-dark); }
.summary-card-success .summary-card-icon { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }

.summary-card-danger {
  background: var(--color-error-light);
  border-color: #FECACA;
}

.summary-card-danger .summary-card-label { color: #DC2626; }
.summary-card-danger .summary-card-value { color: var(--color-error-dark); }
.summary-card-danger .summary-card-icon { background: rgba(239, 68, 68, 0.15); color: var(--color-error); }

.summary-card-warning {
  background: var(--color-warning-light);
  border-color: #FDE68A;
}

.summary-card-warning .summary-card-label { color: #D97706; }
.summary-card-warning .summary-card-value { color: var(--color-warning-dark); }
.summary-card-warning .summary-card-icon { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }

.summary-card-info {
  background: var(--color-info-light);
  border-color: #93C5FD;
}

.summary-card-info .summary-card-label { color: #2563EB; }
.summary-card-info .summary-card-value { color: var(--color-info-dark); }
.summary-card-info .summary-card-icon { background: rgba(59, 130, 246, 0.15); color: var(--color-info); }

/* ---- Skeleton Loading ---- */
.skeleton {
  background: linear-gradient(90deg, var(--border-200) 25%, var(--warm-alt) 50%, var(--border-200) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}

.skeleton-row {
  display: flex;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #F1F5F9;
}

.skeleton-cell {
  height: 16px;
  flex: 1;
}

.skeleton-cell-sm {
  height: 16px;
  width: 80px;
  flex: none;
}

.skeleton-cell-md {
  height: 16px;
  width: 120px;
  flex: none;
}

.skeleton-header {
  height: 12px;
}

.skeleton-w-sm {
  width: 60px;
}

.skeleton-w-md {
  width: 80px;
}

.skeleton-w-lg {
  width: 100px;
}

.skeleton-w-xl {
  width: 120px;
}

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

/* ---- Avatar Component ---- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.avatar-md {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

/* ---- Password Display ---- */
.password-display {
  margin-top: 16px;
}

.password-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--warm-subtle);
  border: 1px solid var(--border-200);
  border-radius: var(--radius-default);
  padding: 12px 16px;
  margin-top: 6px;
}

.password-box code {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--color-primary);
  flex: 1;
  word-break: break-all;
}

.password-display-note {
  margin-top: 12px;
}

/* ---- Utility Classes ---- */
.text-muted { color: var(--text-500); }
.text-secondary { color: var(--text-700); }
.text-success { color: #059669; }
.text-danger { color: #DC2626; }
.text-warning { color: #D97706; }
.font-semibold { font-weight: 600; }

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

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

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

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

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .report-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .card-header-row {
    flex-direction: column;
  }

  .top-header-user {
    display: none;
  }
}

@media (max-width: 480px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }

  .page-content {
    padding: 16px;
  }
}
