/* ===== APPLE DESIGN SYSTEM ===== */
:root {
  --apple-bg: #fbfbfd;
  --apple-sidebar: #f5f5f7;
  --apple-white: #ffffff;
  --apple-text: #1d1d1f;
  --apple-text-secondary: #86868b;
  --apple-blue: #0071e3;
  --apple-blue-hover: #0077ED;
  --apple-border: #d2d2d7;
  --apple-border-light: rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--apple-bg);
  color: var(--apple-text);
  margin: 0;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== SIDEBAR (estilo macOS Finder) ===== */
.apple-sidebar {
  width: 260px;
  background-color: var(--apple-sidebar);
  border-right: 1px solid var(--apple-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  z-index: 40;
}
.sidebar-logo {
  padding: 24px 20px 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.1em;
  letter-spacing: -0.02em;
  color: var(--apple-text);
}
.sidebar-nav {
  padding: 0 12px;
  flex: 1;
  overflow-y: auto;
}
.nav-group-title {
  font-size: 0.7em;
  font-weight: 700;
  color: var(--apple-text-secondary);
  margin: 20px 0 8px 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--apple-text);
  text-decoration: none;
  font-size: 0.92em;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.15s ease;
  cursor: pointer;
}
.nav-item i { width: 20px; text-align: center; color: var(--apple-blue); font-size: 1.1em; }
.nav-item:hover { background-color: rgba(0,0,0,0.04); }
.nav-item.active {
  background-color: var(--apple-blue);
  color: white;
}
.nav-item.active i { color: white; }
.nav-item.logout-item { color: #ff3b30; margin-top: 8px; }
.nav-item.logout-item i { color: #ff3b30; }
.nav-item.logout-item:hover { background: rgba(255,59,48,0.08); }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--apple-border);
  font-size: 0.8em;
  color: var(--apple-text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-footer .user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0071e3, #af52de);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85em;
  flex-shrink: 0;
}

/* ===== AREA PRINCIPAL ===== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--apple-bg);
}

.glass-topbar {
  height: 56px;
  background-color: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 30;
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.main-content > * { flex-shrink: 0; }
.main-content > .pg { flex: 1; flex-shrink: 1; }

#mobile-overlay { display: none; }
@media (max-width: 768px) {
  .apple-sidebar { position: fixed; height: 100%; transform: translateX(-100%); }
  .apple-sidebar.open { transform: translateX(0); }
  #mobile-overlay.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.3); backdrop-filter: blur(2px); z-index: 35; }
}

/* ===== UTILIDADES GLOBALES ===== */
.apple-card {
  background: var(--apple-white);
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  border: 1px solid var(--apple-border-light);
  padding: 24px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.apple-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
}
.apple-btn {
  border: none;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  border-radius: 980px;
  padding: 10px 24px;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.apple-btn-primary { background: #0071e3; color: white; }
.apple-btn-primary:hover { background: #0077ED; transform: scale(1.02); box-shadow: 0 4px 12px rgba(0,113,227,0.25); }
.apple-btn-dark { background: #1d1d1f; color: white; }
.apple-btn-dark:hover { background: #000; transform: scale(1.02); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.apple-btn-secondary { background: #f5f5f7; color: #1d1d1f; }
.apple-btn-secondary:hover { background: #e8e8ed; }
.apple-btn-danger { background: #ff3b30; color: white; }
.apple-btn-danger:hover { background: #d70015; transform: scale(1.02); box-shadow: 0 4px 12px rgba(255,59,48,0.25); }
.apple-btn-success { background: #34c759; color: white; }
.apple-btn-success:hover { background: #248a3d; transform: scale(1.02); box-shadow: 0 4px 12px rgba(52,199,89,0.25); }
.apple-btn-warning { background: #ff9500; color: white; }
.apple-btn-warning:hover { background: #c93400; }

.apple-input {
  font-family: 'Inter', sans-serif;
  border: 1.5px solid #d2d2d7;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 0.9em;
  background: white;
  color: #1d1d1f;
  transition: all 0.2s ease;
  width: 100%;
}
.apple-input:focus {
  outline: none;
  border-color: #0071e3;
  box-shadow: 0 0 0 4px rgba(0,113,227,0.12);
}
.apple-select {
  font-family: 'Inter', sans-serif;
  border: 1.5px solid #d2d2d7;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 0.9em;
  background: white;
  color: #1d1d1f;
  transition: all 0.2s ease;
  width: 100%;
  cursor: pointer;
}
.apple-select:focus {
  outline: none;
  border-color: #0071e3;
  box-shadow: 0 0 0 4px rgba(0,113,227,0.12);
}

.apple-badge {
  font-size: 0.75em;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 980px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.apple-badge-blue { background: #e8f4fd; color: #0071e3; }
.apple-badge-green { background: #ecfdf5; color: #248a3d; }
.apple-badge-red { background: #fff1f0; color: #d70015; }
.apple-badge-orange { background: #fff8ec; color: #c93400; }
.apple-badge-gray { background: #f5f5f7; color: #86868b; }

.apple-alert {
  border-radius: 16px;
  padding: 14px 20px;
  font-size: 0.88em;
  font-weight: 500;
  border: none;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.apple-alert-success { background: #ecfdf5; color: #065f46; }
.apple-alert-danger { background: #fff1f0; color: #9f1239; }
.apple-alert-warning { background: #fff8ec; color: #92400e; }
.apple-alert-info { background: #e8f4fd; color: #1e40af; }

.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 999px; }
.main-content::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }