/* DPMS - Custom Styles */
/* NOTE: Using plain CSS because Tailwind CDN does not support @apply */

:root {
  --color-primary: #8B1A1A;
  --color-primary-hover: #A52A2A;
  --color-primary-light: #F5E6E6;
  --color-primary-dark: #6B1414;
  --color-sidebar: #1A1A2E;
  --color-sidebar-hover: #25254a;
  --color-sidebar-active: #8B1A1A;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #94A3B8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748B; }

/* Form inputs */
.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #D1D5DB;
  background-color: #fff;
  color: #111827;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.15s;
}
.form-input:focus {
  border-color: transparent;
  box-shadow: 0 0 0 2px #8B1A1A;
}
.dark .form-input {
  background-color: #374151;
  border-color: #4B5563;
  color: #fff;
}

.form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #D1D5DB;
  background-color: #fff;
  color: #111827;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.15s;
}
.form-select:focus {
  border-color: transparent;
  box-shadow: 0 0 0 2px #8B1A1A;
}
.dark .form-select {
  background-color: #374151;
  border-color: #4B5563;
  color: #fff;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}
.dark .form-label {
  color: #D1D5DB;
}

/* Buttons — base styles shared by all variants */
.btn,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-success,
.btn-warning,
.btn-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1.125rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  outline: none;
  transition: background-color 0.15s, box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
  -webkit-user-select: none;
  user-select: none;
}

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled,
.btn-success:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Focus ring for keyboard accessibility */
.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.btn-success:focus-visible {
  box-shadow: 0 0 0 3px rgba(139,26,26,0.3);
}

/* Primary */
.btn-primary {
  background-color: #8B1A1A;
  color: #fff;
  border-color: #7a1717;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.08);
}
.btn-primary:hover:not(:disabled) {
  background-color: #7a1717;
  border-color: #6b1414;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.08);
}
.btn-primary:active:not(:disabled) {
  background-color: #6b1414;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2) inset;
}

/* Secondary */
.btn-secondary {
  background-color: #fff;
  color: #374151;
  border-color: #D1D5DB;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.btn-secondary:hover:not(:disabled) {
  background-color: #F9FAFB;
  border-color: #9CA3AF;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.btn-secondary:active:not(:disabled) {
  background-color: #F3F4F6;
}
.dark .btn-secondary {
  background-color: #374151;
  color: #E5E7EB;
  border-color: #4B5563;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.dark .btn-secondary:hover:not(:disabled) {
  background-color: #4B5563;
  border-color: #6B7280;
}

/* Danger */
.btn-danger {
  background-color: #DC2626;
  color: #fff;
  border-color: #B91C1C;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.06);
}
.btn-danger:hover:not(:disabled) {
  background-color: #B91C1C;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.btn-danger:active:not(:disabled) { background-color: #991B1B; }

/* Success */
.btn-success {
  background-color: #059669;
  color: #fff;
  border-color: #047857;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.06);
}
.btn-success:hover:not(:disabled) {
  background-color: #047857;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.btn-success:active:not(:disabled) { background-color: #065F46; }

/* Warning */
.btn-warning {
  background-color: #D97706;
  color: #fff;
  border-color: #B45309;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.btn-warning:hover:not(:disabled) { background-color: #B45309; }

/* Info */
.btn-info {
  background-color: #2563EB;
  color: #fff;
  border-color: #1D4ED8;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.btn-info:hover:not(:disabled) { background-color: #1D4ED8; }

/* Ghost / Icon-only */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
  color: #6B7280;
}
.btn-ghost:hover { background-color: #F3F4F6; color: #374151; }
.dark .btn-ghost { color: #9CA3AF; }
.dark .btn-ghost:hover { background-color: #374151; color: #E5E7EB; }

/* Size modifiers */
.btn-sm,
.btn-primary.btn-sm,
.btn-secondary.btn-sm,
.btn-danger.btn-sm,
.btn-success.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1rem;
  border-radius: 0.375rem;
}

.btn-lg,
.btn-primary.btn-lg,
.btn-secondary.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border-radius: 0.625rem;
}

/* Cards */
.card {
  background-color: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  border: 1px solid #E5E7EB;
  transition: all 0.2s;
}
.card:hover { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); }
.dark .card {
  background-color: #1E293B;
  border-color: #334155;
}

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #E5E7EB;
}
.dark .card-header { border-bottom-color: #334155; }

.card-body { padding: 1rem 1.5rem; }

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: 0.75rem;
  border: 1px solid #E5E7EB;
}
.dark .table-container { border-color: #334155; }

.data-table { min-width: 100%; border-collapse: collapse; }

.data-table thead { background-color: #F9FAFB; }
.dark .data-table thead { background-color: #1E293B; }

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dark .data-table th { color: #9CA3AF; }

.data-table td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #374151;
  white-space: nowrap;
}
.dark .data-table td { color: #D1D5DB; }

.data-table tbody tr {
  background-color: #fff;
  border-bottom: 1px solid #F3F4F6;
  transition: background-color 0.15s;
}
.data-table tbody tr:hover { background-color: #F9FAFB; }
.dark .data-table tbody tr {
  background-color: #1E293B;
  border-bottom-color: #334155;
}
.dark .data-table tbody tr:hover { background-color: #263548; }

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-draft       { background: #F3F4F6; color: #374151; }
.badge-submitted   { background: #DBEAFE; color: #1D4ED8; }
.badge-approved    { background: #D1FAE5; color: #065F46; }
.badge-procurement { background: #FEF3C7; color: #92400E; }
.badge-shipped     { background: #E0E7FF; color: #3730A3; }
.badge-arrived     { background: #EDE9FE; color: #5B21B6; }
.badge-delivered   { background: #CFFAFE; color: #0E7490; }
.badge-installed   { background: #CCFBF1; color: #0F766E; }
.badge-completed   { background: #D1FAE5; color: #065F46; }
.badge-active      { background: #D1FAE5; color: #065F46; }
.badge-open        { background: #FEE2E2; color: #991B1B; }
.badge-assigned    { background: #DBEAFE; color: #1D4ED8; }
.badge-in-progress { background: #FEF3C7; color: #92400E; }
.badge-waiting     { background: #FFEDD5; color: #9A3412; }
.badge-closed      { background: #F3F4F6; color: #374151; }
.badge-critical    { background: #FEE2E2; color: #991B1B; }
.badge-high        { background: #FFEDD5; color: #9A3412; }
.badge-medium      { background: #FEF3C7; color: #92400E; }
.badge-low         { background: #D1FAE5; color: #065F46; }
.badge-success     { background: #D1FAE5; color: #065F46; }
.badge-secondary   { background: #F3F4F6; color: #374151; }
.badge-danger      { background: #FEE2E2; color: #991B1B; }
.badge-info        { background: #DBEAFE; color: #1D4ED8; }
.badge-warning     { background: #FEF3C7; color: #92400E; }
.badge-sent        { background: #E0E7FF; color: #3730A3; }
.badge-reviewed    { background: #EDE9FE; color: #5B21B6; }
.badge-indent      { background: #FFEDD5; color: #9A3412; }
.badge-backorder   { background: #FEE2E2; color: #991B1B; }

.dark .badge-draft       { background: #374151; color: #D1D5DB; }
.dark .badge-submitted   { background: #1E3A5F; color: #93C5FD; }
.dark .badge-approved    { background: #064E3B; color: #6EE7B7; }
.dark .badge-procurement { background: #78350F; color: #FCD34D; }
.dark .badge-shipped     { background: #312E81; color: #A5B4FC; }
.dark .badge-arrived     { background: #4C1D95; color: #C4B5FD; }
.dark .badge-delivered   { background: #164E63; color: #67E8F9; }
.dark .badge-installed   { background: #134E4A; color: #5EEAD4; }
.dark .badge-completed   { background: #064E3B; color: #6EE7B7; }
.dark .badge-active      { background: #064E3B; color: #6EE7B7; }
.dark .badge-open        { background: #7F1D1D; color: #FCA5A5; }
.dark .badge-assigned    { background: #1E3A5F; color: #93C5FD; }
.dark .badge-in-progress { background: #78350F; color: #FCD34D; }
.dark .badge-waiting     { background: #7C2D12; color: #FDBA74; }
.dark .badge-closed      { background: #374151; color: #D1D5DB; }
.dark .badge-critical    { background: #7F1D1D; color: #FCA5A5; }
.dark .badge-high        { background: #7C2D12; color: #FDBA74; }
.dark .badge-medium      { background: #78350F; color: #FCD34D; }
.dark .badge-low         { background: #064E3B; color: #6EE7B7; }
.dark .badge-success     { background: #064E3B; color: #6EE7B7; }
.dark .badge-secondary   { background: #374151; color: #D1D5DB; }
.dark .badge-danger      { background: #7F1D1D; color: #FCA5A5; }
.dark .badge-info        { background: #1E3A5F; color: #93C5FD; }
.dark .badge-warning     { background: #78350F; color: #FCD34D; }
.dark .badge-sent        { background: #312E81; color: #A5B4FC; }
.dark .badge-reviewed    { background: #4C1D95; color: #C4B5FD; }
.dark .badge-indent      { background: #7C2D12; color: #FDBA74; }
.dark .badge-backorder   { background: #7F1D1D; color: #FCA5A5; }

/* Sidebar */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #9CA3AF;
  text-decoration: none;
  transition: all 0.2s;
  margin: 0.125rem 0.75rem;
}
.sidebar-link:hover {
  background-color: rgba(255,255,255,0.1);
  color: #fff;
}
.sidebar-link.active {
  background-color: rgba(139,26,26,0.8);
  color: #fff;
  font-weight: 500;
}
.sidebar-link svg {
  flex-shrink: 0;
}

.sidebar-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 1.5rem;
  margin: 1.5rem 0 0.5rem 0;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.5);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.dark .modal-content {
  background-color: #1E293B;
}

/* KPI Cards */
.kpi-card {
  background-color: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  border: 1px solid #E5E7EB;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}
.kpi-card:hover { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); }
.dark .kpi-card {
  background-color: #1E293B;
  border-color: #334155;
}

/* Page header */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 640px) {
  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
}
.dark .page-title { color: #fff; }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 0;
  text-align: center;
}

/* HTMX loading */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-flex; }

/* Sidebar scrollbar */
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
