/* ==========================================================================
   TenderPack - Modern Responsive CSS Design System
   Optimized for Desktop, Tablet, and Mobile (320px to 1440px+)
   ========================================================================== */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-dark: #312e81;
  
  --secondary: #0ea5e9;
  --secondary-hover: #0284c7;
  
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;

  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;

  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;

  --neutral-50: #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-200: #e2e8f0;
  --neutral-300: #cbd5e1;
  --neutral-400: #94a3b8;
  --neutral-500: #64748b;
  --neutral-600: #475569;
  --neutral-700: #334155;
  --neutral-800: #1e293b;
  --neutral-900: #0f172a;

  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.06);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-bangla: 'Noto Sans Bengali', 'Hind Siliguri', 'Kalpurush', 'SolaimanLipi', var(--font-sans);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
}

body.lang-bn {
  font-family: var(--font-bangla);
}

/* Focus and Accessibility */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ==========================================================================
   1. Responsive Header & Navigation
   ========================================================================== */
.app-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #ffffff;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Header Action Buttons */
.btn-header {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.5rem 0.85rem;
  min-height: 38px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-header:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.35);
}

/* Language Toggle Switcher */
.lang-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  min-height: 38px;
  align-items: center;
}

.lang-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 0.4rem 0.85rem;
  min-height: 34px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.lang-btn:hover {
  color: #ffffff;
}

.lang-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   2. Layout & Grid Architecture
   ========================================================================== */
.main-wrapper {
  max-width: 1400px;
  margin: 1.25rem auto;
  padding: 0 1rem;
  width: 100%;
  flex: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 100%;
  }
}

/* ==========================================================================
   3. Card Component Styling
   ========================================================================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  width: 100%;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.card-header {
  padding: 0.9rem 1.1rem;
  background: #ffffff;
  border-bottom: 1px solid var(--neutral-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.card-icon {
  color: var(--primary);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--neutral-900);
  line-height: 1.3;
}

.card-body {
  padding: 1.1rem;
}

/* ==========================================================================
   4. Tender Metadata Section
   ========================================================================== */
.tender-meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
  background: var(--neutral-50);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  word-break: break-word;
}

.meta-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--neutral-500);
  font-weight: 700;
}

.meta-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--neutral-800);
  margin-top: 2px;
  line-height: 1.35;
}

.meta-deadline {
  border-left-color: var(--warning);
}

.deadline-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--warning-text);
  font-weight: 700;
}

.empty-tender-state {
  text-align: center;
  padding: 1.25rem 0.5rem;
  color: var(--neutral-500);
  font-size: 0.85rem;
}

.empty-tender-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

/* ==========================================================================
   5. PDF Upload Area & File List
   ========================================================================== */
.drop-zone {
  border: 2px dashed var(--neutral-300);
  border-radius: var(--radius-md);
  padding: 1.25rem 0.75rem;
  text-align: center;
  background: var(--neutral-50);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  width: 100%;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.drop-zone-icon {
  width: 38px;
  height: 38px;
  margin: 0 auto 0.5rem;
  color: var(--primary);
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.drop-zone-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--neutral-800);
  margin-bottom: 0.2rem;
  line-height: 1.3;
}

.drop-zone-limits {
  font-size: 0.72rem;
  color: var(--neutral-500);
}

.upload-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--neutral-600);
  flex-wrap: wrap;
  gap: 0.35rem;
}

.progress-bar-container {
  height: 6px;
  background: var(--neutral-200);
  border-radius: var(--radius-full);
  margin-top: 0.35rem;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.progress-bar-fill.warning {
  background: var(--warning);
}

.progress-bar-fill.danger {
  background: var(--danger);
}

/* Uploaded Files List */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.85rem;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 2px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  background: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.file-item.is-duplicate {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.file-item.is-error {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.file-name {
  font-weight: 600;
  color: var(--neutral-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  color: var(--neutral-500);
  margin-top: 2px;
  flex-wrap: wrap;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.btn-icon-remove {
  background: transparent;
  border: none;
  color: var(--neutral-400);
  cursor: pointer;
  padding: 6px;
  min-height: 32px;
  min-width: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.btn-icon-remove:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* ==========================================================================
   6. Buttons & Interactive Controls
   ========================================================================== */
.btn-auto-match {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: white;
  border: none;
  padding: 0.55rem 1rem;
  min-height: 40px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.25);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-auto-match:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(79, 70, 229, 0.35);
}

.btn-reset-matches {
  background: white;
  color: var(--neutral-700);
  border: 1px solid var(--neutral-300);
  padding: 0.55rem 0.85rem;
  min-height: 40px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-reset-matches:hover {
  background: var(--neutral-100);
  color: var(--neutral-900);
}

.btn-secondary {
  background: white;
  color: var(--neutral-700);
  border: 1px solid var(--neutral-300);
  padding: 0.55rem 0.9rem;
  min-height: 38px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: var(--neutral-100);
  color: var(--neutral-900);
  border-color: var(--neutral-400);
}

.btn-generate {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 0.7rem 1.4rem;
  min-height: 44px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-generate:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-generate:disabled {
  background: var(--neutral-300);
  color: var(--neutral-500);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Checklist Toolbar */
.checklist-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ==========================================================================
   7. Requirements Checklist Table & Responsive Cards
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--neutral-200);
  background: #ffffff;
}

.checklist-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.checklist-table th {
  background: var(--neutral-100);
  color: var(--neutral-700);
  font-weight: 700;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--neutral-200);
  white-space: nowrap;
}

.checklist-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--neutral-200);
  vertical-align: middle;
}

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

.checklist-table tr:hover {
  background-color: #fafbfc;
}

/* Column Specifics */
.req-order-badge {
  display: inline-block;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  white-space: nowrap;
}

.req-name-container {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.req-title {
  font-weight: 600;
  color: var(--neutral-900);
  word-break: break-word;
  line-height: 1.3;
}

.req-id {
  font-size: 0.7rem;
  color: var(--neutral-400);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-mandatory {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-optional {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-missing {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.badge-expiry-needed {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.badge-expired {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.badge-not-provided {
  background: var(--neutral-100);
  color: var(--neutral-600);
  border: 1px solid var(--neutral-300);
}

.badge-ok {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.badge-duplicate {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 0.7rem;
}

.badge-assigned {
  background: #e0e7ff;
  color: #3730a3;
  font-size: 0.7rem;
}

/* Match Selector */
.match-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.match-select {
  width: 100%;
  min-width: 160px;
  padding: 0.45rem 0.55rem;
  min-height: 38px;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  background-color: white;
  color: var(--neutral-800);
  cursor: pointer;
}

.match-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

/* Expiry Input */
.expiry-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
}

.expiry-input {
  padding: 0.4rem 0.5rem;
  min-height: 36px;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--neutral-800);
  background: white;
  width: 100%;
}

.expiry-input:focus {
  outline: none;
  border-color: var(--primary);
}

.expiry-input.invalid {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.expiry-helper-text {
  font-size: 0.68rem;
  color: var(--neutral-500);
  white-space: nowrap;
}

/* ==========================================================================
   8. Responsive Requirement Cards on Mobile (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .table-responsive {
    border: none;
    background: transparent;
    overflow: visible;
  }

  .checklist-table,
  .checklist-table tbody,
  .checklist-table tr,
  .checklist-table td {
    display: block;
    width: 100%;
  }

  .checklist-table thead {
    display: none;
  }

  .checklist-table tr.req-row {
    background: #ffffff;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-md);
    margin-bottom: 0.85rem;
    padding: 0.85rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
  }

  .checklist-table tr.req-row:hover {
    background: #ffffff;
    border-color: var(--neutral-300);
  }

  .checklist-table td {
    padding: 0;
    border: none;
  }

  /* Header inside card: Order + Title + Type */
  .cell-order {
    display: none;
  }

  .cell-title .req-name-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .cell-title .req-title {
    font-size: 0.92rem;
    font-weight: 700;
  }

  .cell-type {
    display: inline-flex;
    margin-top: -0.2rem;
  }

  .cell-match {
    margin-top: 0.2rem;
  }

  .match-select {
    min-width: 0;
    width: 100%;
  }

  .cell-expiry {
    margin-top: 0.2rem;
  }

  .cell-status {
    margin-top: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}

/* ==========================================================================
   9. Validation Summary & Metrics
   ========================================================================== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-bottom: 1rem;
}

@media (max-width: 680px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.summary-metric {
  background: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
}

.metric-value {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.2;
}

.metric-value.success { color: var(--success); }
.metric-value.warning { color: var(--warning); }
.metric-value.danger { color: var(--danger); }
.metric-value.neutral { color: var(--neutral-500); }

.metric-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--neutral-600);
  margin-top: 0.15rem;
  line-height: 1.25;
}

/* Alerts Container */
.blocking-alert-box {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
}

.blocking-alert-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--danger-text);
  margin-bottom: 0.35rem;
}

.blocking-alert-list {
  padding-left: 1.35rem;
  font-size: 0.78rem;
  color: var(--danger-text);
  line-height: 1.4;
}

.blocking-alert-list li {
  margin-bottom: 0.2rem;
}

.ready-alert-box {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--success-text);
  font-size: 0.84rem;
  font-weight: 600;
}

/* Action Footer */
.action-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
}

@media (max-width: 640px) {
  .action-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-generate {
    width: 100%;
  }
}

/* ==========================================================================
   10. Modals & Notifications
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  padding: 0.75rem;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s ease;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-overlay.open .modal-card {
  transform: scale(1);
}

.modal-header {
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-close-btn:hover {
  color: white;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
}

.modal-stats-list {
  background: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin: 0.85rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.84rem;
}

.modal-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.modal-stat-label {
  color: var(--neutral-600);
  word-break: break-word;
}

.modal-stat-value {
  font-weight: 700;
  color: var(--neutral-900);
  white-space: nowrap;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1000;
  max-width: 400px;
  margin-left: auto;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  animation: slideIn 0.3s ease forwards;
  border-left: 4px solid var(--primary);
  pointer-events: auto;
  word-break: break-word;
}

.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.error { border-left-color: var(--danger); }

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

/* Spinner Animation */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* App Footer */
.app-footer {
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid var(--neutral-200);
  padding: 0.85rem 1.25rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--neutral-500);
  width: 100%;
}
