/* ============================================================
   Bridge351 Asset Management — Styles
   ============================================================ */

:root {
  --bridge-50:  #eef3fb;
  --bridge-100: #d6e4f0;
  --bridge-200: #adc9e1;
  --bridge-300: #7aaece;
  --bridge-400: #4d93ba;
  --bridge-500: #2e75b6;
  --bridge-600: #1b5a96;
  --bridge-700: #1b3a6b;
  --bridge-800: #162e54;
  --bridge-900: #0f1e38;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --green-100: #d1fae5; --green-800: #065f46; --green-500: #10b981;
  --blue-100:  #dbeafe; --blue-800:  #1e40af; --blue-500: #3b82f6;
  --yellow-100:#fef3c7; --yellow-800:#92400e; --yellow-500:#f59e0b;
  --red-100:   #fee2e2; --red-800:   #991b1b; --red-500: #ef4444; --red-600: #dc2626;

  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 0.15);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

a { color: inherit; text-decoration: none; }

/* ============== LOGIN ============== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bridge-700);
  padding: 1rem;
}
.login-card {
  background: #fff;
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 26rem;
  padding: 2.5rem 2rem;
}
.login-brand { text-align: center; margin-bottom: 2rem; }
.login-logo-img { height: 3.25rem; width: auto; display: inline-block; }
.login-sub { color: var(--gray-500); font-size: 0.875rem; margin-top: 0.5rem; }

/* ============== FORM ELEMENTS ============== */
.field { margin-bottom: 1rem; }
.label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.25rem;
}
.input, select.input, textarea.input {
  width: 100%;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--gray-900);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none;
  border-color: var(--bridge-500);
  box-shadow: 0 0 0 3px var(--bridge-100);
}
.input:disabled { background: var(--gray-100); color: var(--gray-500); }
textarea.input { resize: vertical; min-height: 5rem; font-family: inherit; }
.required { color: var(--red-500); }

input[type="file"].input {
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--gray-600);
}
input[type="file"].input::-webkit-file-upload-button {
  background: var(--bridge-50);
  color: var(--bridge-700);
  border: 1px solid var(--bridge-200);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-right: 0.5rem;
  cursor: pointer;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.col-span-2 { grid-column: 1 / -1; }

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1rem 0 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-100);
}

/* ============== BUTTONS ============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { font-size: 0.8125rem; padding: 0.375rem 0.75rem; }

.btn-primary { background: var(--bridge-700); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--bridge-800); }

.btn-secondary { background: #fff; color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-50); }

.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-icon {
  width: 2rem; height: 2rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: none; background: transparent;
  cursor: pointer; color: var(--gray-400);
  transition: background-color 0.15s, color 0.15s;
  font-size: 1rem;
}
.btn-icon:hover { background: var(--gray-100); }
.btn-icon.icon-blue:hover  { background: var(--blue-100); color: var(--blue-800); }
.btn-icon.icon-green:hover { background: var(--green-100); color: var(--green-800); }
.btn-icon.icon-red:hover   { background: var(--red-100); color: var(--red-600); }
.btn-icon.icon-auto { width: auto; padding: 0 0.5rem; font-size: 0.75rem; gap: 0.25rem; }

/* ============== APP SHELL / SIDEBAR ============== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 15rem;
  background: var(--bridge-700);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
}
.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--bridge-600);
}
.sidebar-logo-img { height: 2.25rem; width: auto; display: block; }
.sidebar-sub { color: var(--bridge-300); font-size: 0.75rem; margin-top: 0.5rem; }

.sidebar-nav { flex: 1; padding: 1rem 0.75rem; display: flex; flex-direction: column; gap: 0.25rem; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500;
  color: var(--bridge-200);
  transition: background-color 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--bridge-600); color: #fff; }
.nav-link.active { background: var(--bridge-800); color: #fff; }
.nav-icon { width: 1.25rem; text-align: center; font-size: 1rem; }

.sidebar-user { padding: 1rem 1.25rem; border-top: 1px solid var(--bridge-600); }
.sidebar-user-name { color: #fff; font-size: 0.875rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { color: var(--bridge-300); font-size: 0.75rem; margin-top: 0.125rem; }
.sidebar-logout {
  background: none; border: none; color: var(--bridge-300);
  font-size: 0.75rem; cursor: pointer; padding: 0; margin-top: 0.75rem;
  transition: color 0.15s;
}
.sidebar-logout:hover { color: #fff; }

.main-content {
  margin-left: 15rem;
  flex: 1;
  padding: 2rem;
  min-height: 100vh;
}

/* ============== PAGE HEADER ============== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin: 0; }
.page-subtitle { color: var(--gray-500); font-size: 0.875rem; margin-top: 0.25rem; }

/* ============== CARDS / TABLES ============== */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 1.25rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead tr { background: var(--gray-50); border-bottom: 1px solid var(--gray-100); }
th { text-align: left; padding: 0.75rem 1rem; font-weight: 500; color: var(--gray-600); white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--gray-50); transition: background-color 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
td { padding: 0.75rem 1rem; vertical-align: middle; }
.table-wrap { overflow-x: auto; border-radius: 0.75rem; }

.mono { font-family: 'SF Mono', Consolas, monospace; }
.text-bridge { color: var(--bridge-700); font-weight: 600; }
.text-muted { color: var(--gray-400); }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.8125rem; }
.font-medium { font-weight: 500; }

/* ============== BADGES ============== */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem; font-weight: 500;
  white-space: nowrap;
}
.badge-green  { background: var(--green-100);  color: var(--green-800); }
.badge-blue   { background: var(--blue-100);   color: var(--blue-800); }
.badge-yellow { background: var(--yellow-100); color: var(--yellow-800); }
.badge-red    { background: var(--red-100);    color: var(--red-800); }
.badge-gray   { background: var(--gray-100);   color: var(--gray-700); }

/* ============== FILTER BAR ============== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.5rem; }
.search-wrap { position: relative; flex: 1; min-width: 12rem; max-width: 24rem; }
.search-wrap .input { padding-left: 2.25rem; }
.search-icon {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); font-size: 0.875rem; pointer-events: none;
}
.filter-select { width: 11rem; }

/* ============== STAT CARDS ============== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
@media (max-width: 1024px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow 0.15s;
}
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { box-shadow: var(--shadow-md); }
.stat-icon {
  width: 2.75rem; height: 2.75rem;
  border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; color: #fff; flex-shrink: 0;
}
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-label { color: var(--gray-500); font-size: 0.8125rem; }
.stat-sub { color: var(--gray-400); font-size: 0.75rem; margin-top: 0.125rem; }

/* ============== PROGRESS BARS (dashboard breakdown) ============== */
.progress-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.progress-label { font-size: 0.8125rem; color: var(--gray-600); width: 6rem; flex-shrink: 0; }
.progress-track { flex: 1; background: var(--gray-100); border-radius: 999px; height: 0.5rem; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; transition: width 0.3s; }
.progress-value { font-size: 0.8125rem; font-weight: 500; color: var(--gray-700); width: 1.5rem; text-align: right; flex-shrink: 0; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.card-title { font-weight: 600; color: var(--gray-900); margin: 0 0 1rem; display: flex; align-items: center; gap: 0.5rem; font-size: 0.9375rem; }

/* ============== EMPTY STATE ============== */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 4rem 1rem; text-align: center;
}
.empty-icon { font-size: 2.5rem; color: var(--gray-300); margin-bottom: 1rem; }
.empty-title { font-size: 1.0625rem; font-weight: 500; color: var(--gray-900); margin-bottom: 0.25rem; }
.empty-desc { color: var(--gray-500); font-size: 0.875rem; }

/* ============== SPINNER ============== */
.spinner-wrap { display: flex; align-items: center; justify-content: center; padding: 4rem 0; }
.spinner {
  width: 2rem; height: 2rem;
  border: 3px solid var(--bridge-100);
  border-top-color: var(--bridge-600);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============== MODAL ============== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
}
.modal-box {
  position: relative;
  background: #fff;
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-box.modal-lg { max-width: 48rem; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
}
.modal-title { font-size: 1.0625rem; font-weight: 600; color: var(--gray-900); margin: 0; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); font-size: 1.25rem; line-height: 1;
  padding: 0.25rem;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--gray-600); }
.modal-body { padding: 1.25rem 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-100);
}

/* ============== ALERT BOX ============== */
.alert {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 1rem; border-radius: var(--radius-sm);
  margin-bottom: 1.25rem; font-size: 0.875rem;
}
.alert-danger { background: var(--red-100); border: 1px solid #fecaca; }
.alert-icon { font-size: 1.125rem; flex-shrink: 0; margin-top: 0.0625rem; }
.alert-title { font-weight: 600; color: var(--red-800); margin: 0 0 0.125rem; }
.alert-text { color: #b91c1c; margin: 0; }

.error-msg {
  background: var(--red-100); color: var(--red-800);
  padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
  font-size: 0.8125rem; margin-bottom: 1rem;
}

/* ============== TOAST ============== */
.toast-root {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 100;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  background: var(--gray-900); color: #fff;
  padding: 0.75rem 1.25rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s ease-out;
}
.toast.toast-success { background: #065f46; }
.toast.toast-error { background: var(--red-600); }
@keyframes toast-in { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: translateY(0); } }

/* ============== RESULT SCREEN (success after action) ============== */
.result-box { text-align: center; padding: 1rem 0; }
.result-icon {
  width: 3.5rem; height: 3.5rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
}
.result-icon.success { background: var(--green-100); color: var(--green-800); }
.result-icon.info { background: var(--blue-100); color: var(--blue-800); }
.result-title { color: var(--gray-700); margin-bottom: 0.25rem; }
.result-sub { color: var(--gray-500); font-size: 0.875rem; margin-bottom: 1.5rem; }
.result-actions { display: flex; flex-direction: column; gap: 0.75rem; }

/* ============== HISTORY DETAIL ROWS ============== */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1rem; font-size: 0.875rem; margin-bottom: 1.25rem; }
.detail-label { color: var(--gray-400); font-size: 0.75rem; }
.detail-value { font-weight: 500; color: var(--gray-900); margin-top: 0.0625rem; }

.history-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--gray-50); border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem; font-size: 0.75rem; margin-bottom: 0.5rem;
}

/* ============== RESPONSIVE SIDEBAR (mobile) ============== */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
  }
  .sidebar-brand { padding: 0.5rem 0; border: none; }
  .sidebar-logo-img { height: 1.75rem; }
  .sidebar-sub { display: none; }
  .sidebar-nav { flex-direction: row; padding: 0; overflow-x: auto; flex-wrap: nowrap; }
  .nav-link span:last-child { display: none; }
  .sidebar-user { display: none; }
  .app-shell { flex-direction: column; }
  .main-content { margin-left: 0; padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
