/* Reset et base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background-color: #ffffff;
  color: #3c4043;
  line-height: 1.5;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 30px;
}

.logo {
  margin-bottom: 25px;
}

.logo-image {
  height: auto;
  width: auto;
  max-width: 100%;
  margin-bottom: 15px;
}

.logo-slogan {
  font-size: 1.8em;
  font-weight: 500;
  color: #1a73e8;
  margin: 0;
}

/* Barre de recherche */
.search-container {
  display: flex;
  align-items: center;
  border: 1px solid #dfe1e5;
  border-radius: 24px;
  padding: 12px 16px;
  box-shadow: 0 2px 5px 1px rgba(64,60,67,.16);
  transition: box-shadow 0.2s;
  background: white;
  max-width: 600px;
  margin: 0 auto;
}

.search-container:hover {
  box-shadow: 0 2px 8px 1px rgba(64,60,67,.24);
}

.search-container:focus-within {
  box-shadow: 0 2px 8px 1px rgba(64,60,67,.24);
  border-color: transparent;
}

#query {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  color: #3c4043;
  background: transparent;
}

#query::placeholder {
  color: #9aa0a6;
}

.search-buttons {
  display: flex;
  gap: 8px;
  margin-left: 12px;
}

.search-btn {
  background: #f8f9fa;
  border: 1px solid #f8f9fa;
  border-radius: 4px;
  color: #3c4043;
  font-size: 14px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.1s ease;
  white-space: nowrap;
}

.search-btn:hover {
  box-shadow: 0 1px 1px rgba(0,0,0,.1);
  background-color: #f1f3f4;
  border-color: #dadce0;
}

.paste-btn {
  background: #1a73e8;
  border: 1px solid #1a73e8;
  color: white;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.1s ease;
  white-space: nowrap;
}

.paste-btn:hover {
  background: #1558d6;
  border-color: #1558d6;
  box-shadow: 0 1px 1px rgba(0,0,0,.1);
}

/* Système d'onglets */
.tabs-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.tabs-nav {
  display: flex;
  border-bottom: 1px solid #e8eaed;
  margin-bottom: 20px;
  gap: 0;
  width: 100%;
}

.tab-btn {
  background: none;
  border: none;
  padding: 16px 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: #5f6368;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex: 1;
  text-align: center;
  min-width: 0;
}

.tab-btn:hover {
  background-color: #f8f9fa;
  color: #1a73e8;
}

.tab-btn.active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
  background-color: #f8f9fa;
}

.tabs-content {
  flex: 1;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.tab-header {
  margin-bottom: 20px;
  text-align: center;
}

.tab-header h2 {
  font-size: 20px;
  font-weight: 400;
  color: #1a73e8;
  margin-bottom: 8px;
}

.tab-header p {
  color: #70757a;
  font-size: 14px;
}

/* Contenu des onglets */
.trending-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.trending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.trending-item:hover {
  background: #f8f9fa;
  border-color: #1a73e8;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.trending-rank {
  background: #1a73e8;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 12px;
}

.trending-query {
  flex: 1;
  font-weight: 500;
}

.trending-count {
  font-size: 12px;
  color: #70757a;
}

/* Résultats de recherche */
.results-container {
  min-height: 200px;
}

.formatted-links-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.formatted-link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  background: white;
  text-decoration: none;
  color: #1a73e8;
  transition: all 0.2s ease;
}

.formatted-link-item:hover {
  background: #f8f9fa;
  border-color: #1a73e8;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  text-decoration: none;
  color: #1558d6;
}

.formatted-link-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.formatted-link-text {
  font-size: 14px;
  font-weight: 500;
}

/* Historique */
.history-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.history-item:hover {
  background: #f8f9fa;
  border-color: #1a73e8;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.history-query {
  flex: 1;
  font-weight: 500;
  margin-right: 10px;
}

.history-date {
  font-size: 12px;
  color: #70757a;
}

/* How it works */
.howto-content {
  max-width: 800px;
  margin: 0 auto;
}

.howto-section {
  margin-bottom: 30px;
  padding: 20px;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  background: #fafafa;
}

.howto-section h3 {
  color: #1a73e8;
  margin-bottom: 12px;
  font-size: 18px;
}

.howto-section p, .howto-section li {
  color: #3c4043;
  line-height: 1.6;
  margin-bottom: 8px;
}

.howto-section ol, .howto-section ul {
  margin-left: 20px;
}

kbd {
  background-color: #f1f3f4;
  border: 1px solid #dadce0;
  border-radius: 4px;
  color: #3c4043;
  font-family: monospace;
  font-size: 11px;
  padding: 2px 6px;
  margin: 0 2px;
}

/* États vides */
.empty-state {
  text-align: center;
  padding: 40px;
  color: #70757a;
  font-size: 16px;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: #666;
}

.loading::after {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #1a73e8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Footer */
.footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #e8eaed;
  text-align: center;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1a73e8;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: #1558d6;
  text-decoration: underline;
}

.footer-icon {
  width: 20px;
  height: 20px;
}

/* Age Verification Modal */
.age-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.age-modal-overlay.hidden {
  display: none;
}

.age-modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.age-modal-header {
  text-align: center;
  padding: 30px 30px 20px;
  border-bottom: 1px solid #e8eaed;
  background: linear-gradient(135deg, #1a73e8 0%, #1558d6 100%);
  color: white;
  border-radius: 16px 16px 0 0;
}

.age-modal-icon {
  font-size: 48px;
  margin-bottom: 15px;
  display: block;
}

.age-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}

.age-modal-content {
  padding: 30px;
}

.disclaimer-section {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  border-left: 4px solid #1a73e8;
  transition: all 0.2s ease;
}

.disclaimer-section:hover {
  background: #f1f3f4;
  transform: translateX(5px);
}

.section-icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}

.section-content h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1a73e8;
}

.section-content p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #3c4043;
}

.age-modal-buttons {
  padding: 0 30px 20px;
  display: flex;
  gap: 15px;
  justify-content: center;
}

.age-btn {
  flex: 1;
  max-width: 200px;
  padding: 15px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.age-btn-agree {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
}

.age-btn-agree:hover {
  background: linear-gradient(135deg, #218838 0%, #1db584 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.age-btn-leave {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
}

.age-btn-leave:hover {
  background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(220, 53, 69, 0.3);
}

.age-modal-footer {
  padding: 0 30px 30px;
  text-align: center;
}

.age-modal-footer small {
  color: #70757a;
  font-size: 12px;
  line-height: 1.4;
}

/* Responsive pour le modal */
@media (max-width: 768px) {
  .age-modal {
    margin: 10px;
    border-radius: 12px;
  }

  .age-modal-header {
    padding: 20px 20px 15px;
    border-radius: 12px 12px 0 0;
  }

  .age-modal-icon {
    font-size: 36px;
    margin-bottom: 10px;
  }

  .age-modal-header h2 {
    font-size: 20px;
  }

  .age-modal-content {
    padding: 20px;
  }

  .disclaimer-section {
    padding: 15px;
    margin-bottom: 20px;
  }

  .section-icon {
    font-size: 20px;
    width: 35px;
  }

  .age-modal-buttons {
    padding: 0 20px 15px;
    flex-direction: column;
  }

  .age-btn {
    max-width: none;
    padding: 12px 16px;
    font-size: 14px;
  }

  .age-modal-footer {
    padding: 0 20px 20px;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 16px 12px;
  }

  .search-container {
    padding: 10px 14px;
  }

  .search-buttons {
    flex-direction: column;
    gap: 6px;
  }

  .search-btn, .paste-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  .tabs-nav {
    flex-wrap: nowrap;
    gap: 0;
    width: 100%;
  }

  .tab-btn {
    flex: 1;
    min-width: 0;
    padding: 14px 8px;
    font-size: 14px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .formatted-links-container,
  .trending-container,
  .history-container {
    grid-template-columns: 1fr;
  }

  .howto-section {
    padding: 15px;
    margin-bottom: 20px;
  }
}

/* CSS pour l'icône "ouvrir dans un nouvel onglet" */
.external-link-icon {
    width: 14px;
    height: 14px;
    margin-left: 8px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    vertical-align: middle;
    display: inline-block;
    flex-shrink: 0;
}

/* Effet au survol du lien parent */
.formatted-link-item:hover .external-link-icon {
    opacity: 0.9;
}

/* Style responsive pour mobile */
@media (max-width: 768px) {
    .external-link-icon {
        width: 12px;
        height: 12px;
        margin-left: 6px;
    }
}

/* Assurer que le texte et l'icône sont bien alignés */
.formatted-link-text {
    display: flex;
    align-items: center;
    gap: 0;
}

.header-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
}
