/* ==========================================================================
   AgendaJAC - Estilos de la Aplicación y Dashboard PWA
   ========================================================================== */

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --sidebar-width: 74px;
  --sidebar-bg: #0f172a;
  --ai-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --ai-shadow: 0 4px 15px rgba(168, 85, 247, 0.35);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1e293b;
  background-color: #f8fafc;
  -webkit-font-smoothing: antialiased;
}

#wrapper {
  overflow-x: hidden;
}

#sidebar-wrapper {
  min-height: 100vh;
  width: var(--sidebar-width);
  margin-left: 0;
  transition: margin 0.25s ease-in-out, width 0.25s ease-in-out;
  background-color: var(--sidebar-bg) !important;
  display: flex;
  flex-direction: column;
  z-index: 1030;
  flex-shrink: 0;
}

/* Ocultar el menú lateral en cualquier resolución cuando tenga .sidebar-hidden */
#wrapper.sidebar-hidden #sidebar-wrapper {
  margin-left: calc(-1 * var(--sidebar-width)) !important;
}

@media (max-width: 991.98px) {
  #sidebar-wrapper {
    margin-left: calc(-1 * var(--sidebar-width));
    position: fixed;
    top: 0;
    bottom: 0;
  }
  #wrapper.toggled #sidebar-wrapper {
    margin-left: 0 !important;
  }
}

.nav-items-group .list-group-item {
  border: none;
  border-left: 3px solid transparent;
  padding: 0.85rem 0;
  transition: all 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.nav-items-group .list-group-item:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

.nav-items-group .list-group-item.active-nav-link {
  background-color: rgba(37, 99, 235, 0.2) !important;
  color: #60a5fa !important;
  border-left-color: #60a5fa;
}

/* Botón IA Especial con Gradiente */
.btn-gradient-ai {
  background: var(--ai-gradient);
  border: none;
  transition: all 0.25s ease;
  box-shadow: var(--ai-shadow);
}

.btn-gradient-ai:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
  color: white;
}

.btn-icon-ai {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.2);
  transition: all 0.2s ease;
}

.btn-icon-ai:hover {
  background: var(--ai-gradient);
  color: white;
  border-color: transparent;
  transform: scale(1.08);
}

/* Acordeón de Proyectos */
.custom-accordion .accordion-button {
  box-shadow: none;
  background-color: #f1f5f9;
  border-radius: 8px !important;
}

.custom-accordion .accordion-button:not(.collapsed) {
  background-color: #e2e8f0;
  color: #0f172a;
}

/* Stylus Canvas Board */
.stylus-board {
  touch-action: none; /* Previene scroll durante trazos con stylus en tablets/touch */
  cursor: crosshair;
  background-color: #ffffff;
  display: block;
  user-select: none;
}

/* Cards y Hover */
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

/* Badges de Prioridad */
.badge-priority-alta {
  background-color: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.badge-priority-media {
  background-color: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
}

.badge-priority-baja {
  background-color: #dcfce7;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* Markdown Renderer Formatting */
.markdown-body {
  font-size: 0.95rem;
}
.markdown-body ul, .markdown-body ol {
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   Modo Noche (Dark Mode) y Adaptaciones
   ========================================================================== */
[data-bs-theme="dark"] body {
  background-color: #0b0f19;
  color: #f1f5f9;
}

[data-bs-theme="dark"] #page-content-wrapper {
  background-color: #0b0f19 !important;
}

[data-bs-theme="dark"] .bg-white {
  background-color: #111827 !important;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .bg-light {
  background-color: #0b0f19 !important;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .card {
  background-color: #111827 !important;
  border-color: #1f2937 !important;
  color: #f1f5f9;
}

[data-bs-theme="dark"] .card-header {
  background-color: #111827 !important;
  border-bottom-color: #1f2937 !important;
}

[data-bs-theme="dark"] .navbar {
  background-color: #111827 !important;
  border-bottom-color: #1f2937 !important;
}

[data-bs-theme="dark"] .text-dark {
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .text-secondary {
  color: #94a3b8 !important;
}

[data-bs-theme="dark"] .text-muted {
  color: #94a3b8 !important;
}

[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-top {
  border-color: #1f2937 !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background-color: #1f2937 !important;
  border-color: #374151 !important;
  color: #f9fafb !important;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  background-color: #1f2937 !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
}

[data-bs-theme="dark"] .input-group-text {
  background-color: #1f2937 !important;
  border-color: #374151 !important;
  color: #94a3b8 !important;
}

[data-bs-theme="dark"] .table {
  color: #f1f5f9 !important;
  border-color: #1f2937 !important;
}

[data-bs-theme="dark"] .table-light {
  background-color: #1f2937 !important;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .table-light th {
  background-color: #1f2937 !important;
  color: #94a3b8 !important;
  border-bottom-color: #374151 !important;
}

[data-bs-theme="dark"] .table > :not(caption) > * > * {
  background-color: transparent;
  border-bottom-color: #1f2937;
}

[data-bs-theme="dark"] .custom-accordion .accordion-button {
  background-color: #1f2937 !important;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .custom-accordion .accordion-button:not(.collapsed) {
  background-color: #374151 !important;
  color: #60a5fa !important;
}

[data-bs-theme="dark"] .custom-accordion .accordion-body {
  background-color: #111827 !important;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .modal-content {
  background-color: #111827 !important;
  color: #f1f5f9 !important;
  border-color: #1f2937 !important;
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
  border-color: #1f2937 !important;
  background-color: #111827 !important;
}

[data-bs-theme="dark"] .modal-body {
  background-color: #0b0f19 !important;
}

[data-bs-theme="dark"] .dropdown-menu {
  background-color: #1f2937 !important;
  border-color: #374151 !important;
}

[data-bs-theme="dark"] .dropdown-item {
  color: #e5e7eb !important;
}

[data-bs-theme="dark"] .dropdown-item:hover {
  background-color: #374151 !important;
}

[data-bs-theme="dark"] .dropdown-divider {
  border-color: #374151 !important;
}

[data-bs-theme="dark"] .list-group-item {
  background-color: #111827 !important;
  color: #f1f5f9 !important;
  border-color: #1f2937 !important;
}

[data-bs-theme="dark"] .stylus-board {
  background-color: #1e293b !important;
  border-color: #374151 !important;
}

/* Transiciones suaves */
body, #sidebar-wrapper, #page-content-wrapper, .card, .navbar {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
