/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #1e293b;
}
::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Layout */
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #0f172a;
  color: #e2e8f0;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 240px;
  background-color: #1e293b;
  border-right: 1px solid #334155;
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid #334155;
}

.sidebar-logo h1 {
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-logo p {
  font-size: 11px;
  color: #64748b;
  margin: 2px 0 0 0;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
}

.sidebar-nav a:hover {
  background-color: #334155;
  color: #f1f5f9;
}

.sidebar-nav a.active {
  background-color: #1d4ed8;
  color: #fff;
}

.sidebar-nav a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid #334155;
}

/* Main content */
.main-content {
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  background-color: #1e293b;
  border-bottom: 1px solid #334155;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: #f8fafc;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #94a3b8;
}

.topbar-user span {
  color: #cbd5e1;
  font-weight: 500;
}

/* Page content */
.page-content {
  padding: 24px;
  flex: 1;
}

/* Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 20px;
}

.stat-card-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1;
}

.stat-card-sub {
  font-size: 12px;
  color: #475569;
  margin-top: 4px;
}

/* Section */
.section {
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
}

.section-header {
  padding: 14px 20px;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: #f1f5f9;
}

.section-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.section-filters {
  padding: 12px 20px;
  border-bottom: 1px solid #334155;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Table */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: #162032;
  border-bottom: 1px solid #334155;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid #1e293b;
  transition: background 0.1s;
}

tbody tr:hover {
  background-color: #1a2840;
}

tbody td {
  padding: 10px 16px;
  color: #cbd5e1;
  white-space: nowrap;
}

tbody td.wrap {
  white-space: normal;
}

.empty-row td {
  text-align: center;
  color: #475569;
  padding: 32px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, background 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: #1d4ed8;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background-color: #1e40af;
}

.btn-success {
  background-color: #15803d;
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background-color: #166534;
}

.btn-danger {
  background-color: #b91c1c;
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background-color: #991b1b;
}

.btn-warning {
  background-color: #b45309;
  color: #fff;
}

.btn-warning:hover:not(:disabled) {
  background-color: #92400e;
}

.btn-ghost {
  background-color: #334155;
  color: #94a3b8;
}

.btn-ghost:hover:not(:disabled) {
  background-color: #475569;
  color: #e2e8f0;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-yellow  { background-color: #854d0e22; color: #fbbf24; border: 1px solid #854d0e55; }
.badge-green   { background-color: #14532d22; color: #4ade80; border: 1px solid #14532d55; }
.badge-blue    { background-color: #1e3a5f22; color: #60a5fa; border: 1px solid #1e3a5f55; }
.badge-orange  { background-color: #7c2d1222; color: #fb923c; border: 1px solid #7c2d1255; }
.badge-gray    { background-color: #1e293b;   color: #64748b; border: 1px solid #334155; }
.badge-red     { background-color: #450a0a22; color: #f87171; border: 1px solid #450a0a55; }
.badge-sky     { background-color: #0c4a6e22; color: #38bdf8; border: 1px solid #0c4a6e55; }

/* Form inputs */
.input {
  background-color: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  color: #e2e8f0;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus {
  border-color: #1d4ed8;
}

.input::placeholder {
  color: #475569;
}

select.input {
  cursor: pointer;
}

/* Toast notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  max-width: 360px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  animation: slideIn 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.toast-success { background-color: #14532d; color: #86efac; border: 1px solid #166534; }
.toast-error   { background-color: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; }
.toast-info    { background-color: #1e3a5f; color: #93c5fd; border: 1px solid #1e40af; }
.toast-warn    { background-color: #451a03; color: #fdba74; border: 1px solid #7c2d12; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(20px); }
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: #f1f5f9;
}

.modal-close {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

.modal-close:hover {
  color: #e2e8f0;
  background-color: #334155;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #334155;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Form group */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Detail grid */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-item label {
  display: block;
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.detail-item span {
  font-size: 13px;
  color: #e2e8f0;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0f172a;
  padding: 20px;
}

.login-card {
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo h1 {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0 0 4px 0;
}

.login-logo p {
  font-size: 12px;
  color: #64748b;
  margin: 0;
}

.login-error {
  background-color: #450a0a;
  border: 1px solid #7f1d1d;
  color: #fca5a5;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* Quick actions */
.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

/* Loading state */
.loading-text {
  color: #475569;
  font-size: 13px;
  padding: 16px 20px;
}

/* Divider */
.divider {
  height: 1px;
  background-color: #334155;
  margin: 20px 0;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid #334155;
  font-size: 13px;
  color: #64748b;
  flex-wrap: wrap;
  gap: 10px;
}

.pagination-info { font-size: 12px; }

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-controls button {
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-width: 32px;
}

.pagination-controls button:hover:not(:disabled) {
  background: #334155;
  color: #f1f5f9;
}

.pagination-controls button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-controls button.active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}
