/* =======================================
   Panel de Administración
   ======================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a3a5c;
  --primary-light: #2d6a9f;
  --sidebar-width: 220px;
  --bg: #f4f6f8;
  --white: #fff;
  --border: #dde4ed;
  --text: #222;
  --text-muted: #888;
  --success: #27ae60;
  --danger: #e74c3c;
  --info: #2980b9;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
}

.sidebar-brand img {
  height: 32px;
  filter: brightness(0) invert(1);
}

.sidebar-menu {
  list-style: none;
  flex: 1;
  padding: 12px 0;
}

.sidebar-menu li a {
  display: block;
  padding: 12px 20px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-left-color: #7eb8f7;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-logout {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
}

.page-header h1 {
  font-size: 22px;
  color: var(--primary);
}

.page-body {
  padding: 28px 32px;
  flex: 1;
}

/* ---- CARDS ---- */
.card {
  background: var(--white);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.card-title {
  font-size: 16px;
  color: var(--primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

/* ---- STATS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--white);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border-top: 4px solid var(--primary);
}

.stat-number {
  font-size: 40px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- TABLES ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 24px;
}

.data-table thead th {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fbff; }
.data-table tbody tr.row-disabled { opacity: 0.5; }

.data-table td {
  padding: 12px 16px;
  font-size: 14px;
  vertical-align: middle;
}

.data-table-sm td { padding: 8px 12px; font-size: 13px; }
.data-table-sm thead th { padding: 8px 12px; }

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 32px !important;
  font-style: italic;
}

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

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.98); }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-secondary { background: #e0e6ee; color: #333; }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-info      { background: var(--info); color: #fff; }
.btn-outline   { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-block     { width: 100%; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---- FORMS ---- */
.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 160px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-light);
}

.form-group-btn {
  flex: 0 0 auto;
  flex-direction: row;
  gap: 8px;
}

.filter-form { margin-bottom: 20px; }
.inline-form { }

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error { background: #fde8e8; color: #c0392b; border: 1px solid #f5c6c6; }

/* ---- INFO TABLE ---- */
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.info-table th {
  text-align: left;
  width: 140px;
  color: #666;
  padding: 8px 12px 8px 0;
  font-weight: 600;
  vertical-align: top;
}

.info-table td { padding: 8px 0; border-bottom: 1px solid var(--border); }
.info-table tr:last-child td { border-bottom: none; }

/* ---- ORDER CARDS ---- */
.order-card {
  margin-bottom: 20px;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 16px;
}

.order-address {
  margin-bottom: 12px;
  font-size: 13px;
}

.order-comments {
  margin-top: 12px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 4px;
  font-size: 13px;
}

.order-uuid {
  margin-top: 10px;
  font-size: 11px;
  font-family: monospace;
}

/* ---- MISC ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  margin-left: 8px;
}

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

.text-muted { color: var(--text-muted); }

.section-title {
  font-size: 16px;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}

.results-count {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.empty-state {
  background: var(--white);
  border-radius: 8px;
  padding: 48px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

code {
  background: #f0f4f8;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  color: #333;
}

/* ---- LOGIN ---- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  background-image: linear-gradient(135deg, #1a3a5c, #2d6a9f);
  min-height: 100vh;
}

.login-container {
  background: var(--white);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand img { height: 60px; margin-bottom: 12px; }
.login-brand h1 { color: var(--primary); font-size: 24px; }
.login-brand p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.login-form .form-group { margin-bottom: 16px; }

/* ---- MODAL ---- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-content {
  background: var(--white);
  border-radius: 10px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.modal-content h3 {
  margin-bottom: 20px;
  color: var(--primary);
  font-size: 18px;
}

.modal-content .form-group { margin-bottom: 14px; }

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-brand span,
  .sidebar-menu li a { font-size: 0; }
  .sidebar-footer span { display: none; }
  .main-content { margin-left: 60px; }
  .page-body { padding: 16px; }
}
