/* ================================================================
   NOTAS Y ALARMAS 📝⏰ - Dark Mode FixHub + Compacto
   ================================================================ */

#panel-notas {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
  overflow: hidden;
}

/* ── MURO / GRID ── */
#muro-notas {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 80px;
  background: transparent;
}

.grid-notas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  align-items: start;
}

/* ── STICKY NOTE (colapsada) ── */
.sticky-note {
  position: relative;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  min-height: 110px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sticky-note:hover {
  transform: translateY(-4px) rotate(0deg) scale(1.02) !important;
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
  z-index: 10;
}

/* EXPANDIDA — solo más ancha, no más alta */
.sticky-note.expandida {
  grid-column: span 2;
  grid-row: span 1;
  min-height: auto;
  z-index: 30;
  transform: rotate(0deg) scale(1) !important;
  box-shadow: 0 0 0 2px rgba(206,147,216,0.25), 0 10px 28px rgba(0,0,0,0.5);
  cursor: default;
}

@media (max-width: 700px) {
  .sticky-note.expandida {
    grid-column: span 1;
  }
}

.sticky-note.realizada {
  opacity: 0.35;
}

.sticky-note.realizada .sticky-note-texto {
  text-decoration: line-through;
}

/* Colores por tipo — Dark FixHub */
.sticky-nota { 
  background: #1a1a2e; 
  color: #e0e0e0; 
  border: 1px solid #2a2a4a;
  border-left: 3px solid #ce93d8;
}
.sticky-alarma { 
  background: #1a1a2e; 
  color: #e0e0e0; 
  border: 1px solid #2a2a4a;
  border-left: 3px solid #ef4444;
}

/* Cinta adhesiva sutil */
.sticky-tape {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 48px;
  height: 16px;
  background: rgba(206, 147, 216, 0.1);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 2px;
  pointer-events: none;
}
.sticky-alarma .sticky-tape {
  background: rgba(239, 68, 68, 0.1);
}

.sticky-note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  opacity: 0.55;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 4px;
}

.sticky-note-tipo {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sticky-note-texto {
  flex: 1;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: break-word;
  margin-bottom: 6px;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  overflow: hidden;
  color: rgba(255,255,255,0.85);
}

.sticky-note.expandida .sticky-note-texto {
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
  font-size: 14px;
  line-height: 1.5;
}

.sticky-note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  opacity: 0.4;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sticky-note-badges {
  display: flex;
  gap: 3px;
}

.badge-icon {
  font-size: 12px;
}

/* ── CONTENIDO EXPANDIDO (compacto, una línea) ── */
.sticky-expand-content {
  display: none;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.08);
  animation: fadeInUp 0.25s ease;
}

.sticky-note.expandida .sticky-expand-content {
  display: flex;
  flex-direction: row;
  gap: 12px;
  flex-wrap: wrap;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.sticky-info-line {
  font-size: 10px;
  opacity: 0.5;
  display: flex;
  align-items: center;
  gap: 4px;
  color: rgba(255,255,255,0.55);
}

.sticky-meta-line {
  font-size: 10px;
  opacity: 0.5;
  color: rgba(255,255,255,0.55);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.alarma-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.alarma-input-row input[type="time"] {
  flex: 1;
}
.alarma-input-row .sticky-btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 5px 10px;
  font-size: 12px;
}

/* Alarma UI dentro de tarjeta */
.sticky-timer-box {
  background: rgba(0,0,0,0.25);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.05);
}

.sticky-timer-display {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.9);
}

.sticky-timer-label {
  font-size: 9px;
  opacity: 0.5;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Botones — estilo Inventario */
.sticky-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.sticky-btn {
  padding: 5px 10px;
  border: 1px solid;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  min-width: 70px;
  background: transparent;
}

.sticky-btn-verde { 
  border-color: rgba(22,163,74,0.5); 
  color: #86efac; 
}
.sticky-btn-verde:hover { 
  background: rgba(22,163,74,0.15); 
  border-color: rgba(22,163,74,0.7);
}

.sticky-btn-rojo { 
  border-color: rgba(220,38,38,0.5); 
  color: #fca5a5; 
}
.sticky-btn-rojo:hover { 
  background: rgba(220,38,38,0.15); 
  border-color: rgba(220,38,38,0.7);
}

.sticky-btn-amarillo { 
  border-color: rgba(234,179,8,0.5); 
  color: #fde047; 
}
.sticky-btn-amarillo:hover { 
  background: rgba(234,179,8,0.12); 
  border-color: rgba(234,179,8,0.7);
}

/* ── EDICIÓN DENTRO DE TARJETA ── */
.sticky-edit-form {
  display: none;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.08);
  animation: fadeInUp 0.25s ease;
}

.sticky-note.editando .sticky-edit-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sticky-note.editando .sticky-note-texto,
.sticky-note.editando .sticky-expand-content {
  display: none !important;
}

.form-group-inline label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.55;
  display: block;
  margin-bottom: 2px;
  color: rgba(255,255,255,0.6);
}

.form-group-inline textarea,
.form-group-inline input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #2a2a4a;
  border-radius: 6px;
  background: #0d0d0d;
  color: #e0e0e0;
  font-size: 13px;
  outline: none;
  resize: none;
  overflow: hidden;
  font-family: inherit;
}

.form-group-inline textarea:focus,
.form-group-inline input:focus {
  border-color: #ce93d8;
  background: #12121f;
}

/* Selector de tipo en edición */
.tipo-selector-mini {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tipo-chip {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.55);
}

.tipo-chip:hover {
  background: rgba(255,255,255,0.12);
}

.tipo-chip.activo {
  border-color: #ce93d8;
  background: rgba(206,147,216,0.12);
  color: #ce93d8;
  font-weight: 600;
}

/* ── SIN NOTAS ── */
#sin-notas {
  text-align: center;
  padding: 60px 20px;
  color: rgba(255,255,255,0.2);
}

.sin-notas-emoji { font-size: 44px; margin-bottom: 8px; }
.sin-notas-texto { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.sin-notas-hint { font-size: 12px; }

/* ── MODAL ALARMA ACTIVA ── */
#alarma-modal {
  display: none;
  /* z-index 99999 inline en el HTML para máxima prioridad */
}

.alarma-activa {
  background: #1a1a2e;
  color: #e0e0e0;
  border: 1px solid rgba(239,68,68,0.4);
  padding: 28px 36px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 0 40px rgba(220,38,38,0.25), 0 16px 48px rgba(0,0,0,0.4);
  animation: alarmaPulse 1s ease infinite;
  max-width: 340px;
  width: 90%;
  position: relative;
  z-index: 99999;
}

@keyframes alarmaPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 40px rgba(220,38,38,0.25); }
  50% { transform: scale(1.02); box-shadow: 0 0 60px rgba(220,38,38,0.4); }
}

.alarma-icono { font-size: 48px; margin-bottom: 8px; }
.alarma-titulo { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.alarma-mensaje { font-size: 13px; margin-bottom: 12px; opacity: 0.85; }
.alarma-tiempo { font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 16px; color: #ef4444; }

.alarma-cerrar {
  padding: 8px 20px;
  background: rgba(220,38,38,0.15);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.5);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.alarma-cerrar:hover {
  background: rgba(220,38,38,0.3);
  transform: scale(1.05);
}

/* ── INDICADOR DE ALARMA ACTIVA ── */
.alarma-indicador {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
  animation: alarmaBlink 1s ease infinite;
  box-shadow: 0 0 6px #ef4444;
}

@keyframes alarmaBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ── FAB ── */
.fab-notas {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #6a1b9a;
  color: white;
  border: none;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 0 0 2px rgba(106,27,154,0.3);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
  display: none;
}

/* Mostrar solo cuando el panel de notas está activo */
#panel-notas.activo .fab-notas {
  display: flex;
}

.fab-notas:hover {
  background: #8e24aa;
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 6px 20px rgba(106,27,154,0.5), 0 0 0 3px rgba(206,147,216,0.3);
}

.fab-notas:active {
  transform: scale(0.95);
}

/* Ocultar elementos de Notas cuando el panel no está activo */
#panel-notas:not(.activo) #sin-notas,
#panel-notas:not(.activo) #grid-notas,
#panel-notas:not(.activo) #muro-notas {
  display: none !important;
}

/* ── SCROLLBAR ── */
#muro-notas::-webkit-scrollbar {
  width: 6px;
}

#muro-notas::-webkit-scrollbar-track {
  background: #1a1a2e;
  border-radius: 3px;
}

#muro-notas::-webkit-scrollbar-thumb {
  background: #6a1b9a;
  border-radius: 3px;
}

/* Responsive */
@media (max-width: 900px) {
  .grid-notas { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width: 600px) {
  .grid-notas { grid-template-columns: 1fr; }
  .sticky-note.expandida { grid-column: span 1; }
}
