/* ============================================
   PROCONECT - Estilos Globales
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

/* Variables - Modo Claro */
:root {
  --primary: #009EE2;
  --primary-dark: #1D4ED8;
  --primary-light: #DBEAFE;
  --secondary: #0EA5E9;
  --accent: #F59E0B;
  --accent-dark: #D97706;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #06B6D4;

  --bg: #F8FAFF;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --bg-input: #F1F5F9;
  --bg-hover: #F8FAFF;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-on-primary: #FFFFFF;

  --border: #E2E8F0;
  --border-focus: #009EE2;
  --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.10);
  --shadow-primary: 0 4px 20px rgba(37,99,235,0.25);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --header-h: 64px;
  --sidebar-w: 260px;
  --transition: all 0.2s ease;

  --font-main: 'DM Sans', sans-serif;
  --font-display: 'Sora', sans-serif;
}

/* Variables - Modo Oscuro */
[data-theme="dark"] {
  --bg: #0B0F1A;
  --bg-card: #131929;
  --bg-sidebar: #0F1729;
  --bg-input: #1E2A42;
  --bg-hover: #1A2540;

  --text-primary: #F0F6FF;
  --text-secondary: #94A3B8;
  --text-muted: #475569;

  --border: #1E2D4A;
  --border-focus: #3B82F6;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
  --shadow-primary: 0 4px 20px rgba(37,99,235,0.4);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
}

/* ============================================
   LAYOUT PANELS
   ============================================ */
.panel-wrapper {
  display: flex;
  min-height: 100vh;
  padding-top: var(--header-h);
}

.panel-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.panel-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 24px;
  max-width: 1200px;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 200;
  backdrop-filter: blur(10px);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  color: var(--primary);
}

.header-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 18px;
}

.header-spacer { flex: 1; }

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

.btn-icon {
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
  font-size: 18px;
}

.btn-icon:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  width: 16px; height: 16px;
  background: var(--danger);
  border-radius: 50%;
  font-size: 10px;
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ============================================
   SIDEBAR NAV
   ============================================ */
.sidebar-user {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
  overflow: hidden;
  margin-bottom: 10px;
}

.sidebar-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.sidebar-user-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.sidebar-user-role {
  font-size: 12px;
  color: var(--text-muted);
}

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

.nav-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

[data-theme="dark"] .nav-item.active {
  background: rgba(37,99,235,0.15);
}

.nav-item .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-bottom {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.stat-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.blue   { background: rgba(37,99,235,0.12); color: var(--primary); }
.stat-icon.green  { background: rgba(16,185,129,0.12); color: var(--success); }
.stat-icon.amber  { background: rgba(245,158,11,0.12); color: var(--accent); }
.stat-icon.red    { background: rgba(239,68,68,0.12); color: var(--danger); }
.stat-icon.cyan   { background: rgba(6,182,212,0.12); color: var(--info); }

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
}

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

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

.form-label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394A3B8' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-on-primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: var(--shadow-primary);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #059669; box-shadow: 0 4px 15px rgba(16,185,129,0.3); transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #DC2626; }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-rounded { border-radius: var(--radius-full); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ============================================
   BADGES & ESTADOS
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: rgba(16,185,129,0.12); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.12); color: var(--accent-dark); }
.badge-danger  { background: rgba(239,68,68,0.12); color: var(--danger); }
.badge-info    { background: rgba(6,182,212,0.12); color: var(--info); }
.badge-gray    { background: var(--bg-input); color: var(--text-muted); }

/* ============================================
   TABLES
   ============================================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  background: var(--bg-input);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.table tr:last-child td { border-bottom: none; }

.table tbody tr:hover { background: var(--bg-hover); }

/* ============================================
   SOLICITUDES CARDS
   ============================================ */
.solicitud-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
  cursor: pointer;
}

.solicitud-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.solicitud-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.solicitud-cat-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.solicitud-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.solicitud-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.solicitud-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.solicitud-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============================================
   PROFESIONAL CARD
   ============================================ */
.prof-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: var(--transition);
}

.prof-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.prof-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 24px;
  margin: 0 auto 12px;
  overflow: hidden;
}

.prof-avatar img { width: 100%; height: 100%; object-fit: cover; }

.prof-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.prof-cats { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }

.prof-rating {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

.stars { color: var(--accent); font-size: 14px; letter-spacing: 1px; }
.star-empty { color: var(--border); }

/* ============================================
   PRESUPUESTO CARD
   ============================================ */
.presup-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  transition: var(--transition);
}

.presup-card.destacado {
  border-color: var(--success);
  background: rgba(16,185,129,0.04);
}

.presup-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.presup-amount {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--primary);
}

/* ============================================
   NOTIFICACIONES DROPDOWN
   ============================================ */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  display: none;
}

.notif-dropdown.open { display: block; }

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

.notif-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  gap: 12px;
}

.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: rgba(37,99,235,0.04); }

.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 5px;
}

.notif-text {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
}

.notif-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

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

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s;
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* ============================================
   STARS RATING
   ============================================ */
.star-rating { display: flex; gap: 6px; }

.star-rating input { display: none; }

.star-rating label {
  font-size: 32px;
  color: var(--border);
  cursor: pointer;
  transition: color 0.1s;
}

.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
  color: var(--accent);
}

.star-rating { flex-direction: row-reverse; justify-content: flex-end; }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  min-width: 280px;
  max-width: 360px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  border-left: 4px solid var(--primary);
}

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

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

/* ============================================
   INSTALL BUTTON
   ============================================ */
.btn-install {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-install.visible { display: flex; }
.btn-install:hover { opacity: 0.9; transform: translateY(-1px); }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

/* ============================================
   PAGE TITLE
   ============================================ */
.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-subtitle { color: var(--text-muted); font-size: 14px; }

/* ============================================
   SEARCH / FILTERS
   ============================================ */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

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

.search-input-wrap input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.search-input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

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

/* ============================================
   MOBILE SIDEBAR TOGGLE
   ============================================ */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .panel-sidebar {
    transform: translateX(-100%);
  }

  .panel-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .sidebar-toggle { display: flex; }

  .panel-content {
    margin-left: 0;
    padding: 16px;
  }

  .form-row { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .notif-dropdown { width: 300px; right: -60px; }

  .modal { padding: 24px; }

  .page-title { font-size: 22px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .header { padding: 0 12px; }
  .btn-lg { padding: 11px 20px; font-size: 15px; }
  .toast-container { bottom: 16px; right: 16px; left: 16px; }
}

/* ============================================
   SCROLLBAR CUSTOM
   ============================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   UTILITIES
   ============================================ */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--accent) !important; }
.text-muted   { color: var(--text-muted) !important; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.fs-sm { font-size: 13px; }
.fs-xs { font-size: 12px; }
.w-100 { width: 100%; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.loading { opacity: 0.6; pointer-events: none; }

/* Foto upload */
.avatar-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.avatar-preview {
  width: 90px; height: 90px;
  border-radius: 50%;
  border: 3px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  color: var(--text-muted);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-input);
}

.avatar-preview:hover { border-color: var(--primary); color: var(--primary); }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================
   PWA INSTALL BANNER (mobile)
   ============================================ */
.pwa-banner {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #1e40af, #2563EB);
  color: white;
  padding: 14px 16px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.2);
  animation: slideUp 0.35s ease;
}
.pwa-banner.show { display: flex; }
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.pwa-banner-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  margin-right: 12px;
}
.pwa-banner-text { flex: 1; min-width: 0; }
.pwa-banner-title { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.pwa-banner-sub   { font-size: 12px; opacity: 0.85; }
.pwa-banner-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; margin-left: 10px; }
.pwa-banner-install {
  background: white; color: #1e40af;
  border: none; border-radius: 20px;
  padding: 8px 16px; font-weight: 700; font-size: 13px;
  cursor: pointer; white-space: nowrap;
}
.pwa-banner-close {
  background: rgba(255,255,255,0.2); color: white;
  border: none; border-radius: 50%;
  width: 28px; height: 28px;
  cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}

/* ============================================
   NOTIF ACTIVATE BANNER (after PWA install)
   ============================================ */
.notif-activate-banner {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9998;
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  padding: 14px 16px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.2);
  animation: slideUp 0.35s ease;
}
.notif-activate-banner.show { display: flex; align-items: center; gap: 12px; }
.notif-activate-banner-icon { font-size: 28px; flex-shrink: 0; }
.notif-activate-banner-text { flex: 1; }
.notif-activate-banner-title { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.notif-activate-banner-sub   { font-size: 12px; opacity: 0.85; }
.notif-activate-btn {
  background: white; color: #059669;
  border: none; border-radius: 20px;
  padding: 8px 14px; font-weight: 700; font-size: 13px;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.notif-activate-close {
  background: rgba(255,255,255,0.2); color: white;
  border: none; border-radius: 50%;
  width: 28px; height: 28px;
  cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ============================================
   SIDEBAR: botón activar notificaciones
   ============================================ */
.nav-item-notif {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item-notif:hover {
  background: rgba(245,158,11,0.1);
  color: #d97706;
}
.nav-item-notif.active-notif {
  background: rgba(16,185,129,0.1);
  color: var(--success);
}
.nav-item-notif .nav-icon { width: 20px; text-align: center; font-size: 16px; }
.nav-notif-status {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  background: rgba(245,158,11,0.2);
  color: #d97706;
}
.nav-notif-status.on {
  background: rgba(16,185,129,0.2);
  color: var(--success);
}

/* ============================================
   RESPONSIVE IMPROVEMENTS
   ============================================ */
@media (max-width: 900px) {
  .header-actions .btn-install { display: none !important; }

  /* Ocultar botón notif en header en móvil, se usa el del sidebar */
  #notif-enable-btn { display: none !important; }
}

@media (max-width: 640px) {
  /* Header: solo lo esencial */
  .header { padding: 0 10px; gap: 6px; }
  .header-logo { font-size: 15px; }
  .header-logo .logo-icon { width: 28px; height: 28px; font-size: 14px; }

  /* Dropdown notificaciones: full width */
  .notif-dropdown {
    width: calc(100vw - 20px) !important;
    right: -10px !important;
    left: auto !important;
  }

  /* Stats en 2 columnas */
  .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }

  /* Tablas scrolleables */
  .table-responsive, [style*="overflow-x:auto"] { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 500px; }

  /* Cards con menos padding */
  .card { padding: 16px; }
  .page-header { margin-bottom: 16px; }
  .page-title { font-size: 20px; }

  /* Modales full width */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: 16px 16px 0 0 !important;
    max-height: 92vh;
    overflow-y: auto;
    width: 100%;
    max-width: 100% !important;
    padding: 20px 16px;
  }

  /* Form rows en 1 columna */
  .form-row { grid-template-columns: 1fr !important; }

  /* Botones más compactos */
  .btn-lg { padding: 10px 18px; font-size: 14px; }

  /* Grilla de categorías */
  .cats-grid { grid-template-columns: repeat(3, 1fr) !important; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .cats-grid  { grid-template-columns: repeat(2, 1fr) !important; }
  .header-actions { gap: 4px; }
  .btn-icon { width: 34px; height: 34px; font-size: 16px; }
}

