/* ============================================
   REGISTRO DE INCIDENCIAS - Shared CSS
   ============================================ */

:root {
  --primary-dark: #1e3a8a;
  --primary-mid: #3b82f6;
  --primary-light: #dbeafe;
  --primary-lighter: #eff6ff;
  --bg-color: #f3f6fc;
  --card-bg: #ffffff;
  --text-main: #1f2937;
  --text-light: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-focus: #3b82f6;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --sidebar-w: 240px;
  --header-h: 60px;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.10), 0 4px 10px rgba(0,0,0,0.06);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-color);
  color: var(--text-main);
  font-size: 0.875rem;
  line-height: 1.5;
  min-height: 100vh;
}

/* ---- APP LAYOUT ---- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

/* ---- LOGO UPLOADER ---- */
.brand-logo-upload {
  width: 60px;
  height: 60px;
  background: rgba(255,255,255,0.12);
  border: 1.5px dashed rgba(255,255,255,0.35);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.25s;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.brand-logo-upload:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.7);
}

.brand-logo-upload:hover .logo-placeholder-text {
  opacity: 1;
}

.logo-placeholder-text {
  text-align: center;
  color: rgba(255,255,255,0.75);
  font-size: 0.55rem;
  font-weight: 600;
  line-height: 1.4;
  pointer-events: none;
  transition: opacity 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.logo-placeholder-text span {
  display: block;
  font-size: 0.48rem;
  opacity: 0.8;
}

/* ---- WELCOME LOGO UPLOADER ---- */
.welcome-logo-upload {
  width: 70px;
  height: 70px;
  background: rgba(255,255,255,0.15);
  border: 2px dashed rgba(255,255,255,0.45);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.welcome-logo-upload:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.8);
}

.welcome-logo-placeholder {
  text-align: center;
  color: rgba(255,255,255,0.8);
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.4;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.sidebar-brand h2 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: white;
  line-height: 1.3;
}

.sidebar-brand p {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.6);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
}

.nav-section-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  padding: 10px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 6px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255,255,255,0.12);
  color: white;
}

.nav-item.active {
  background: rgba(255,255,255,0.18);
  color: white;
  font-weight: 600;
}

.nav-item .nav-icon {
  font-size: 0.95rem;
  width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  text-align: center;
}

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

/* ---- TOP BAR ---- */
.topbar {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0; z-index: 50;
  box-shadow: var(--shadow);
}

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.topbar-title span {
  font-weight: 400;
  color: var(--text-light);
  font-size: 0.8rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- PAGE CONTENT ---- */
.page-content {
  padding: 24px;
  flex: 1;
}

/* ---- CARDS ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

/* ---- STAT CARDS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-light); }
.stat-icon.green { background: var(--success-light); }
.stat-icon.yellow { background: var(--warning-light); }
.stat-icon.red { background: var(--danger-light); }

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-light);
  font-weight: 500;
  margin-top: 2px;
}

/* ---- BUTTONS ---- */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-mid);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { background: #059669; box-shadow: var(--shadow-md); }

.btn-secondary {
  background: white;
  color: var(--primary-mid);
  border: 1.5px solid var(--primary-mid);
}
.btn-secondary:hover { background: var(--primary-lighter); }

.btn-danger {
  background: white;
  color: var(--danger);
  border: 1.5px solid var(--danger);
}
.btn-danger:hover { background: var(--danger-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-light);
}
.btn-ghost:hover { background: var(--bg-color); color: var(--text-main); }

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

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: 6px;
  justify-content: center;
}

/* ---- FORMS ---- */
.form-group {
  margin-bottom: 14px;
}

.form-group:last-child { margin-bottom: 0; }

label.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-main);
  margin-bottom: 5px;
}

label.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  background: #f9fafb;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  transition: all 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  background: white;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

.form-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

/* ---- BADGE ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 600;
}
.badge-blue { background: var(--primary-light); color: var(--primary-dark); }
.badge-green { background: var(--success-light); color: #065f46; }
.badge-yellow { background: var(--warning-light); color: #92400e; }
.badge-red { background: var(--danger-light); color: #991b1b; }
.badge-gray { background: #f3f4f6; color: #4b5563; }

/* ---- TABLE ---- */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  background: #f9fafb;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f3f4f6;
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--primary-lighter);
}

.data-table .no-data {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-style: italic;
}

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.25s;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-xl { max-width: 900px; }

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
  border-radius: 12px 12px 0 0;
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: #f3f4f6;
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light);
  transition: all 0.2s;
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body {
  padding: 22px;
}

.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #fafafa;
  border-radius: 0 0 12px 12px;
}

/* ---- ALERTS ---- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #93c5fd; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }

/* ---- SEARCH / FILTERS ---- */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-box .search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-box input {
  padding-left: 32px;
}

/* ---- LOADING ---- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary-mid);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  gap: 10px;
  color: var(--text-light);
  font-size: 0.8rem;
}

/* ---- SECTION DIVIDER ---- */
.section-divider {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 0;
  border-bottom: 1.5px solid var(--primary-light);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---- TOAST ---- */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  border-left: 4px solid var(--primary-mid);
  animation: slideIn 0.3s ease;
}

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

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

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.8rem;
}

/* ---- PAGINATION ---- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
  justify-content: center;
}

.page-btn {
  width: 30px; height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  color: var(--text-main);
}

.page-btn:hover { background: var(--primary-light); border-color: var(--primary-mid); }
.page-btn.active { background: var(--primary-mid); color: white; border-color: var(--primary-mid); }
.page-btn:disabled { opacity: 0.4; cursor: default; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
}
