
:root {
  --overlay-bg: rgba(0, 0, 0, 0.8);
  --modal-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --link-color: #ffffff;
}

[data-theme="light"] {
  --overlay-bg: rgba(15, 23, 42, 0.6);
  --modal-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --link-color: #0025f8;
}


.sitemap-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--overlay-bg);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background-color: var(--card-bg);
  color: var(--text-main);
  width: 80%;
  max-width: 900px;
  height: 80%;
  max-height: 90vh;
  padding: 32px 24px 24px; 
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--modal-shadow);
  

  overflow: hidden; 
  box-sizing: border-box;
  
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1001;
}

.modal::-webkit-scrollbar { width: 8px; }
.modal::-webkit-scrollbar-thumb { background-color: var(--border); border-radius: 4px; }

.items-container {
  flex: 2; 
  overflow-y: auto;
  overflow-x: hidden; 
  margin-top: 20px;
  padding-right: 4px;
  width: 100%;
}

.items-container::-webkit-scrollbar,
.modal-list::-webkit-scrollbar,
.duplicate-list::-webkit-scrollbar,
.ads-txt-content::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.items-container::-webkit-scrollbar-thumb,
.modal-list::-webkit-scrollbar-thumb,
.duplicate-list::-webkit-scrollbar-thumb,
.ads-txt-content::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 4px;
}

.modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px; 
}

.modal-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
  text-align: center;
}

.modal-close-button {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 44px;
  font-weight: 300;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.modal-close-button:hover {
  color: var(--error);
  transform: scale(1.15);
}


.modal-list,
.items-list {
  margin-top: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  list-style: none;
  padding: 0;
  padding-right: 4px; 
  margin: 0;
  flex: 2; 
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-list-item,
.items-list-item {
  font-size: 15px;
  line-height: 1.5;
  padding: 12px 16px;
  background-color: var(--item-bg);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 8px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.modal-list-item:hover,
.items-list-item:hover {
  border-color: var(--primary); 
}

.empty-state {
  margin-top: 22px;
  font-style: italic;
  color: var(--text-muted);
  text-align: center;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.loading-spinner {
  border: 6px solid var(--item-bg);
  border-top: 6px solid var(--primary);
  border-radius: 50%;
  width: 64px;
  height: 64px;
  animation: spin 1s linear infinite;
}

.modal-loading-text {
  font-size: 18px;
  font-weight: 500;
  text-align: center;
  color: var(--text-muted);
  margin-top: 24px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


.modal-info {
  font-size: 16px;
  text-align: center;
  color: var(--text-muted);
  margin-top: 24px;
  padding: 16px;
  background-color: var(--item-bg);
  border-radius: 8px;
  border: 1px dashed var(--border);
}

.duplicate-container {
  flex: 1;
  margin-top: 24px;
  background-color: var(--item-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 4px 20px 20px; 
  max-height: 35%; 
  display: flex;
  flex-direction: column;
}

.duplicate-header {
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-right: 16px;
}

.duplicate-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.duplicate-message {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.duplicate-list {
  flex: 1; 
  overflow-y: auto;
  overflow-x: hidden;
  padding-left: 20px;
  padding-right: 12px;
  margin: 0;
  color: var(--text-main);
}

.duplicate-list-item,
.duplicate-list-item a {
  font-size: 14px;
  padding: 4px 0;
  color: var(--error);
  word-break: break-all;
  text-decoration: none;
}

.duplicate-list-item a:hover {
  text-decoration: underline;
}


.ads-txt-content {
  background-color: var(--item-bg);
  color: var(--text-main);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: auto;
  max-height: 350px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  margin: 0;
  tab-size: 4;
}

.modal-analysis {
  margin-top: 20px;
  padding: 16px;
  background-color: var(--item-bg);
  color: var(--text-main);
  border-radius: 8px;
  border-left: 4px solid var(--primary);
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

a {
  color: var(--link-color); 
  text-decoration: none; 
  font-weight: 500;
  word-break: break-all;
  transition: opacity 0.2s, color 0.3s;
}


@media (max-width: 600px) {
  .modal {
    width: 95%;
    height: 90%;
    padding: 20px 16px;
    border-radius: 12px;
  }

  .modal-title {
    font-size: 18px;
    max-width: 70%;
  }

  .modal-close-button {
    font-size: 28px;
    right: 0;
  }

  .duplicate-container {
    padding: 16px;
  }

  .duplicate-list {
    max-height: 150px;
  }

  .ads-txt-content {
    font-size: 12px;
    max-height: 250px;
  }
}