/* ================================================================
   CSS MODAL DE NAVIGATION - V3
   ================================================================ */

/* Modal Container */
.tc-navigation-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.tc-navigation-modal.tc-modal-open {
  display: flex;
}

/* Backdrop */
.tc-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: tc-fade-in 0.2s ease-out;
}

@keyframes tc-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal Container */
.tc-modal-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  display: flex;
  flex-direction: column;
  animation: tc-modal-enter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes tc-modal-enter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ================================================================
   HEADER
   ================================================================ */

.tc-modal-header {
  position: relative;
  padding: var(--space-6);
  border-bottom: 1px solid var(--stone-200);
  flex-shrink: 0;
}

.tc-modal-title-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.tc-modal-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--stone-900);
  margin: 0;
}

.tc-modal-shortcut-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--stone-500);
}

.tc-modal-shortcut-hint kbd {
  padding: 2px 6px;
  background: var(--stone-100);
  border: 1px solid var(--stone-300);
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
  color: var(--stone-700);
}

/* Search Bar */
.tc-search-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--stone-50);
  border: 2px solid var(--stone-200);
  border-radius: 10px;
  padding: var(--space-3);
  transition: all 0.2s ease;
}

.tc-search-bar:focus-within {
  border-color: var(--sage-500);
  background: white;
  box-shadow: 0 0 0 3px rgba(86, 108, 64, 0.1);
}

.tc-search-icon {
  color: var(--stone-500);
  font-size: 20px;
  flex-shrink: 0;
}

.tc-search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 15px;
  color: var(--stone-900);
  outline: none;
}

.tc-search-input::placeholder {
  color: var(--stone-400);
}

.tc-search-clear {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
  border-radius: 4px;
  color: var(--stone-500);
  transition: all 0.2s ease;
}

.tc-search-clear:hover {
  background: var(--stone-100);
  color: var(--stone-700);
}

/* Close Button */
.tc-modal-close-btn {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  border-radius: 8px;
  color: var(--stone-600);
  transition: all 0.2s ease;
}

.tc-modal-close-btn:hover {
  background: var(--stone-100);
  color: var(--stone-900);
}

/* ================================================================
   FILTERS
   ================================================================ */

.tc-modal-filters {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--stone-200);
  overflow-x: auto;
  flex-shrink: 0;
}

.tc-filter-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--stone-50);
  border: 1px solid var(--stone-200);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--stone-700);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tc-filter-btn:hover {
  background: var(--stone-100);
  border-color: var(--stone-300);
}

.tc-filter-btn.tc-filter-active {
  background: var(--sage-500);
  border-color: var(--sage-500);
  color: white;
}

.tc-filter-btn .material-symbols-outlined {
  font-size: 18px;
}

.tc-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: white;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.tc-filter-btn.tc-filter-active .tc-filter-count {
  background: var(--sage-700);
  color: white;
}

/* ================================================================
   CONTENT / GRID
   ================================================================ */

.tc-modal-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

.tc-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
}

/* Grid Item */
.tc-grid-item {
  background: var(--stone-50);
  border: 1px solid var(--stone-200);
  border-radius: 10px;
  padding: var(--space-4);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.tc-grid-item:hover {
  background: white;
  border-color: var(--sage-400);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.tc-grid-item:focus {
  outline: 2px solid var(--sage-500);
  outline-offset: 2px;
}

.tc-grid-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tc-grid-item-icon {
  width: 40px;
  height: 40px;
  background: var(--sage-100);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tc-grid-item-icon .material-symbols-outlined {
  color: var(--sage-600);
  font-size: 24px;
}

.tc-favorite-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
  border-radius: 4px;
  color: var(--stone-400);
  transition: all 0.2s ease;
}

.tc-favorite-btn:hover {
  background: var(--stone-100);
  color: var(--copper-500);
}

.tc-favorite-btn.tc-favorite-active {
  color: var(--copper-500);
}

.tc-grid-item-content {
  flex: 1;
}

.tc-grid-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--stone-900);
  margin: 0 0 var(--space-2) 0;
  line-height: 1.4;
}

.tc-grid-item-description {
  font-size: 13px;
  color: var(--stone-600);
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tc-grid-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tc-grid-item-badges {
  display: flex;
  gap: var(--space-1);
}

.tc-grid-item-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.tc-badge-ai .material-symbols-outlined {
  font-size: 14px;
  color: var(--copper-500);
}

.tc-badge-recent .material-symbols-outlined {
  font-size: 14px;
  color: var(--sage-600);
}

.tc-badge-progression {
  width: 100%;
}

.tc-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--stone-200);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.tc-progress-fill {
  height: 100%;
  background: var(--sage-500);
  transition: width 0.3s ease;
}

.tc-progress-text {
  font-size: 11px;
  color: var(--stone-600);
  font-weight: 500;
}

/* Grid Info */
.tc-grid-info {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--stone-200);
  text-align: center;
  font-size: 13px;
  color: var(--stone-500);
}

/* ================================================================
   EMPTY STATE
   ================================================================ */

.tc-modal-empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
}

.tc-modal-empty-state .tc-empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-4);
  background: var(--stone-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tc-modal-empty-state .tc-empty-icon .material-symbols-outlined {
  font-size: 40px;
  color: var(--stone-500);
}

.tc-modal-empty-state .tc-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--stone-800);
  margin: 0 0 var(--space-2) 0;
}

.tc-modal-empty-state .tc-empty-message {
  font-size: 14px;
  color: var(--stone-600);
  margin: 0 0 var(--space-6) 0;
  line-height: 1.6;
}

.tc-btn-secondary {
  background: white;
  border: 1px solid var(--stone-300);
  color: var(--stone-700);
}

.tc-btn-secondary:hover {
  background: var(--stone-50);
  border-color: var(--stone-400);
}

/* ================================================================
   FOOTER
   ================================================================ */

.tc-modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--stone-200);
  background: var(--stone-50);
  flex-shrink: 0;
}

.tc-footer-stats {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-3);
}

.tc-stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 13px;
  color: var(--stone-600);
}

.tc-stat-item .material-symbols-outlined {
  font-size: 16px;
  color: var(--stone-500);
}

.tc-footer-recent {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.tc-recent-label {
  font-size: 12px;
  color: var(--stone-500);
  font-weight: 500;
}

.tc-recent-items {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.tc-recent-item {
  padding: 2px 8px;
  background: white;
  border: 1px solid var(--stone-200);
  border-radius: 4px;
  font-size: 11px;
  color: var(--stone-600);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tc-recent-item:hover {
  border-color: var(--sage-400);
  background: var(--sage-50);
  color: var(--sage-700);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 768px) {
  .tc-navigation-modal {
    padding: 0;
  }

  .tc-modal-container {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .tc-modal-header,
  .tc-modal-content,
  .tc-modal-footer {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .tc-modal-grid {
    grid-template-columns: 1fr;
  }

  .tc-modal-filters {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .tc-footer-stats {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .tc-modal-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ================================================================
   ACCESSIBILITY
   ================================================================ */

.tc-grid-item:focus-visible,
.tc-favorite-btn:focus-visible,
.tc-filter-btn:focus-visible {
  outline: 2px solid var(--sage-500);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tc-navigation-modal *,
  .tc-modal-backdrop,
  .tc-modal-container {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
