/* Estilos para o sistema de bookmarks do Gaegu */

/* Container principal dos links com CSS Grid responsivo */
.links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  width: 100%;
  padding: 20px 0;
}

/* Corrigir conflitos com estilos globais */
.link-category ul {
  list-style-type: none;
  padding: 0;
  border: 0;
  margin: 0;
}

.link-category li {
  line-height: 20px;
  padding: 0;
  border: 0;
  margin: 0;
}

/* Loading estado */
.loading {
  text-align: center;
  padding: 40px;
  grid-column: 1 / -1;
  color: var(--font-color);
}

/* Categoria de links - Bloco individual */
.link-category {
  background-color: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  position: relative;
  z-index: 1;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.link-category:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.12);
  background-color: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .link-category {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .link-category:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.link-category .title {
  font-weight: 600;
  font-size: 1.2em;
  padding: 0 0 12px 0;
  margin: 0 0 15px 0;
  color: var(--heading-color);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  text-transform: capitalize;
}

[data-theme="dark"] .link-category .title {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.links-container {
  position: relative;
  overflow: visible;
  min-height: 140px;
}

.links-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.3s ease;
}

.link-item {
  display: inline-block;
  text-decoration: none;
  line-height: 22px;
  padding: 4px 0;
  border: 0;
  position: relative;
  transition: color 0.3s ease-in-out;
  color: var(--primary-color);
  z-index: 2;
  font-size: 0.95rem;
}

.link-item:hover {
  color: var(--secondary-color);
}

/* Sobrescrever o estilo original .effect:before */
.link-item.effect:before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 2px;
  background: rgb(var(--highlight-color));
  transform: scaleX(0);
  transform-origin: center;
  transition: all 0.3s ease-in-out;
}

.link-item.effect:hover:before {
  transform: scaleX(1);
}

/* Paginação */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
  margin-bottom: 0;
  gap: 8px;
  position: relative;
  z-index: 3;
}

.pagination-btn {
  background-color: var(--bg-color);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  color: var(--font-color);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  font-family: "Gaegu", cursive;
  font-size: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.pagination-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .pagination-btn {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .pagination-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pagination-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-btn.disabled:hover {
  background-color: var(--bg-color);
  border-color: rgba(0, 0, 0, 0.15);
  transform: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .pagination-btn.disabled:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.page-indicator {
  font-size: 0.8rem;
  color: var(--font-color);
  margin: 0 4px;
  opacity: 0.7;
  background-color: rgba(0, 0, 0, 0.03);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

[data-theme="dark"] .page-indicator {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Botões de controle */
.control-buttons {
  display: flex;
  gap: 15px;
  margin-top: 30px;
  margin-bottom: 20px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 10;
  clear: both;
}

/* Botão de edição */
.edit-btn {
  background-color: var(--bg-color);
  color: var(--font-color);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 10px 20px;
  cursor: pointer;
  font-family: "Gaegu", cursive;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.edit-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .edit-btn {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .edit-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Botão de reset */
.reset-btn {
  background-color: var(--bg-color);
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.2);
  border-radius: 6px;
  padding: 10px 20px;
  cursor: pointer;
  font-family: "Gaegu", cursive;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.reset-btn:hover {
  background-color: rgba(220, 53, 69, 0.05);
  border-color: rgba(220, 53, 69, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.1);
}

[data-theme="dark"] .reset-btn {
  color: #ff6b7a;
  border-color: rgba(255, 107, 122, 0.2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .reset-btn:hover {
  background-color: rgba(255, 107, 122, 0.05);
  border-color: rgba(255, 107, 122, 0.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Modal de Edição */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: var(--bg-color);
  padding: 30px;
  border: 3px solid var(--primary-color);
  border-radius: 10px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
}

/* Seção de configurações globais */
.global-settings {
  background-color: rgba(var(--highlight-color), 0.05);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 30px;
}

.global-settings h3 {
  color: var(--heading-color);
  font-family: "Gaegu", cursive;
  font-size: 1.3rem;
  margin-bottom: 15px;
  text-align: center;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.modal-header h2 {
  color: var(--heading-color);
  font-family: "Gaegu", cursive;
  font-size: 2rem;
  text-shadow: 1px 1px 2px var(--shadow-color);
}

.close-btn {
  background: none;
  border: none;
  color: var(--font-color);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease-in-out;
  font-family: "Gaegu", cursive;
}

.close-btn:hover {
  color: var(--primary-color);
  transform: rotate(90deg);
}

.category {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.category-title {
  color: var(--heading-color);
  font-size: 1.5rem;
  font-family: "Gaegu", cursive;
  text-shadow: 1px 1px 2px var(--shadow-color);
}

.link-editor {
  display: grid;
  grid-template-columns: 1fr 3fr auto auto auto;
  gap: 15px;
  margin-bottom: 15px;
  align-items: center;
}

.link-editor input {
  padding: 12px 15px;
  background-color: var(--bg-color);
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  color: var(--font-color);
  font-family: "Gaegu", cursive;
  font-size: 1.1rem;
  transition: all 0.3s ease-in-out;
}

.link-editor input:focus {
  outline: none;
  border-color: rgba(var(--highlight-color), 0.8);
  box-shadow: 0 0 8px rgba(var(--highlight-color), 0.3);
  transform: scale(1.02);
}

.action-btn {
  background-color: transparent;
  border: 2px solid #e74c3c;
  color: #e74c3c;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease-in-out;
  font-family: "Gaegu", cursive;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
}

.action-btn:hover {
  background-color: #e74c3c;
  color: var(--bg-color);
  transform: scale(1.1);
}

/* Toggle para nova aba */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle {
  position: relative;
  width: 50px;
  height: 26px;
  background-color: #ddd;
  border-radius: 13px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.toggle.active {
  background-color: rgba(var(--highlight-color), 0.8);
}

.toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle.active .toggle-slider {
  transform: translateX(24px);
}

.toggle-label {
  font-size: 0.9rem;
  color: var(--font-color);
  font-family: "Gaegu", cursive;
  white-space: nowrap;
}

.add-btn {
  background-color: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.3s ease-in-out;
  font-family: "Gaegu", cursive;
}

.add-btn:hover {
  background-color: var(--primary-color);
  color: var(--bg-color);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  margin-top: 20px;
}

.save-btn {
  background-color: transparent;
  color: var(--primary-color);
  border: 3px solid var(--primary-color);
  padding: 12px 25px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease-in-out;
  font-family: "Gaegu", cursive;
}

.save-btn:hover {
  background-color: var(--primary-color);
  color: var(--bg-color);
  transform: translateY(-2px);
}

.cancel-btn {
  background-color: transparent;
  color: var(--font-color);
  border: 2px solid var(--border-color);
  padding: 12px 25px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease-in-out;
  font-family: "Gaegu", cursive;
}

.cancel-btn:hover {
  background-color: var(--border-color);
  color: var(--bg-color);
}

/* Responsividade para diferentes tamanhos de tela */

/* Desktop grande (>= 1200px): 5-6 colunas */
@media (min-width: 1200px) {
  .links {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
  }
}

/* Desktop médio (>= 992px): 4-5 colunas */
@media (min-width: 992px) and (max-width: 1199px) {
  .links {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
  }
}

/* Tablet (>= 768px): 3-4 colunas */
@media (min-width: 768px) and (max-width: 991px) {
  .links {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 18px;
  }
  
  .link-category {
    padding: 18px;
  }
}

/* Mobile grande (>= 576px): 2-3 colunas */
@media (min-width: 576px) and (max-width: 767px) {
  .links {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
  }
  
  .link-category {
    padding: 15px;
  }
  
  .link-category .title {
    font-size: 1.2em;
  }
}

/* Mobile pequeno (< 576px): 1-2 colunas */
@media (max-width: 575px) {
  .links {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    padding: 15px 0;
  }
  
  .link-category {
    padding: 12px;
  }
  
  .link-category .title {
    font-size: 1.1em;
    margin-bottom: 12px;
    padding-bottom: 10px;
  }
  
  .links-container {
    min-height: 100px;
  }
  
  .link-item {
    font-size: 0.9rem;
    line-height: 20px;
  }
}

/* Responsividade para o modal */
@media only all and (orientation: portrait) {
  .modal-content {
    padding: 20px;
    margin: 10px;
  }
  
  .link-editor {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .category-header {
    flex-direction: column;
    gap: 15px;
  }
  
  .modal-footer {
    flex-direction: column;
    gap: 12px;
  }
  
  .control-buttons {
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
  }
  
  .edit-btn, .reset-btn {
    width: 200px;
    justify-content: center;
  }
  
  .links {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 10px;
  }
  
  .link-category {
    margin-bottom: 15px;
  }
  
  .links-container {
    min-height: 100px;
  }
  
  .global-settings {
    padding: 15px;
  }
  
  .settings-row {
    flex-direction: column;
    gap: 10px;
  }
}