* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-color: #f5f5f5;
  --container-bg: #fff;
  --text-color: #333;
  --heading-color: #2d3748;
  --border-color: #e2e8f0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --primary-color: #4299e1;
  --primary-hover: #3182ce;
  --secondary-bg: #f8fafc;
  --input-border: #ddd;
  --error-color: #e53e3e;
  --success-color: #48bb78;
  --warning-color: #ed8936;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color 0.3s, color 0.3s;
}

.container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 2rem;
  background-color: var(--container-bg);
  border-radius: 8px;
  box-shadow: 0 2px 10px var(--shadow-color);
  transition: background-color 0.3s, box-shadow 0.3s;
  position: relative;
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--heading-color);
}

h2 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: var(--heading-color);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 1rem;
}

.form-controls {
  display: flex;
  gap: 10px;
}

.select-container {
  display: flex;
  align-items: center;
  gap: 5px;
}

.user-agent-container {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

input[type="url"] {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  font-size: 16px;
  background-color: var(--container-bg);
  color: var(--text-color);
}

select {
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  font-size: 14px;
  background-color: var(--container-bg);
  color: var(--text-color);
}

button {
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
}

button:hover {
  background-color: var(--primary-hover);
}

.toggle-mode-btn, .print-btn {
  font-size: 0.85rem;
  padding: 8px 12px;
  background-color: var(--secondary-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.toggle-mode-btn:hover, .print-btn:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Theme toggle button styles */
.theme-toggle-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-color);
  transition: background-color 0.3s;
  position: absolute;
  top: 2rem;
  right: 2rem;
}

.theme-toggle-button:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.theme-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* In light mode, show the moon icon */
.theme-icon.sun-icon {
  display: none;
}

.theme-icon.moon-icon {
  display: flex;
}

/* In dark mode, show the sun icon */
body.dark-mode .theme-icon.sun-icon {
  display: flex;
}

body.dark-mode .theme-icon.moon-icon {
  display: none;
}

.hidden {
  display: none;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1rem;
}

.summary-container {
  padding: 10px;
  background-color: var(--secondary-bg);
  border-radius: 4px;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
}

.results-container {
  margin-top: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  background-color: var(--secondary-bg);
}

#redirectList {
  list-style-position: inside;
  padding-left: 0.5rem;
}

.redirect-item {
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 6px;
  background-color: var(--container-bg);
  border-left: 4px solid var(--primary-color);
  box-shadow: 0 1px 3px var(--shadow-color);
}

.redirect-item.non-ssl {
  border-left-color: var(--error-color);
}

.redirect-item.final {
  border-left-color: var(--success-color);
}

.redirect-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  align-items: center;
}

.step-label {
  font-weight: 600;
  color: var(--heading-color);
  font-size: 1.05rem;
}

.redirect-url {
  flex: 1;
  word-break: break-all;
  margin-right: 10px;
}

.redirect-duration {
  font-weight: bold;
  color: var(--heading-color);
  padding: 3px 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
}

.error-message {
  color: var(--error-color);
  text-align: center;
  font-weight: bold;
}

.redirect-error {
  padding: 10px;
  margin: 10px 0;
  background-color: #FEF2F2;
  border-left: 4px solid var(--error-color);
  color: #b91c1c;
  border-radius: 4px;
}

.warning-container {
  padding: 10px;
  margin: 10px 0;
  background-color: #FEFCBF;
  border-left: 4px solid var(--warning-color);
  color: #975a16;
  border-radius: 4px;
}

/* Spinner styling */
.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-left-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

#loading {
  text-align: center;
  margin: 2rem 0;
}

/* Details section styling */
.details-container {
  margin-top: 10px;
}

.toggle-details-btn {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.9rem;
  padding: 8px;
  background-color: var(--secondary-bg);
  color: var(--heading-color);
  border-radius: 4px;
  transition: background-color 0.2s;
}

.toggle-details-btn:hover {
  background-color: var(--border-color);
}

.details-content {
  margin-top: 10px;
  padding: 15px;
  border-radius: 6px;
  background-color: var(--secondary-bg);
  border: 1px solid var(--border-color);
}

/* Tab styling */
.tabs-container {
  margin-top: 10px;
}

.tab-buttons {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 15px;
}

.tab-button {
  background-color: transparent;
  color: var(--heading-color);
  padding: 8px 15px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-right: 5px;
  transition: all 0.3s;
  cursor: pointer;
  font-size: 0.9rem;
}

.tab-button:hover {
  background-color: var(--secondary-bg);
  color: var(--primary-color);
}

.tab-button.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  font-weight: 600;
}

.tab-content {
  padding: 10px;
  background-color: var(--container-bg);
  border-radius: 4px;
  border: 1px solid var(--border-color);
  max-height: 300px;
  overflow-y: auto;
}

/* Main tabs for list/graph view */
.tabs-main {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 15px;
}

.tab-main {
  background-color: transparent;
  color: var(--heading-color);
  padding: 10px 20px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-right: 5px;
  transition: all 0.3s;
  cursor: pointer;
}

.tab-main:hover {
  background-color: var(--secondary-bg);
}

.tab-main.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  font-weight: 600;
}

.tab-main-content {
  display: block;
}

.tab-main-content.hidden {
  display: none;
}

/* Graph styling */
.graph-container {
  min-height: 400px;
  padding: 20px;
  background-color: var(--container-bg);
  border-radius: 6px;
  border: 1px solid var(--border-color);
  margin-top: 10px;
  overflow-x: auto;
}

/* Pre-formatted content styling */
pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 10px;
  background-color: var(--secondary-bg);
  border-radius: 4px;
  color: var(--heading-color);
  overflow-x: auto;
}

.headers-content, 
.body-content, 
.metadata-content, 
.ssl-content {
  max-height: 250px;
  overflow-y: auto;
}

/* Dark mode */
body.dark-mode {
  --bg-color: #121212;
  --container-bg: #1e1e1e;
  --text-color: #f5f5f5;
  --heading-color: #e2e8f0;
  --border-color: #2d3748;
  --shadow-color: rgba(0, 0, 0, 0.4);
  --secondary-bg: #2a2a2a;
  --input-border: #4a5568;
}

body.dark-mode .spinner {
  border-color: rgba(255, 255, 255, 0.1);
  border-left-color: var(--primary-color);
}

body.dark-mode pre {
  background-color: #2a2a2a;
  color: #e2e8f0;
}

/* Print mode */
@media print {
  body {
    background-color: white;
    color: black;
  }
  
  .container {
    box-shadow: none;
    margin: 0;
    padding: 0;
  }
  
  .no-print {
    display: none !important;
  }
  
  .redirect-item {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  
  .toggle-details-btn {
    display: none;
  }
  
  .details-content.hidden {
    display: block !important;
  }
  
  .graph-container {
    height: 100vh;
    width: 100%;
  }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
    margin: 1rem;
  }
  
  .redirect-item-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .redirect-duration {
    margin-top: 5px;
  }
  
  .tab-buttons {
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
    flex-wrap: nowrap;
  }
  
  .tab-button {
    flex: 1;
    min-width: auto;
  }
  
  .input-group {
    flex-direction: column;
  }
  
  .form-controls {
    flex-direction: column;
  }
  
  input[type="url"], button, select {
    width: 100%;
  }
  
  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .summary-container {
    width: 100%;
  }
}

.header-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.header-container h1 {
  margin-bottom: 0;
  width: 100%;
  text-align: center;
}

.header-container p {
  flex: 1;
  width: 100%;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.header-container .toggle-mode-btn {
  padding: 8px 12px;
  font-size: 0.9rem;
  background-color: var(--secondary-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.header-container .toggle-mode-btn:hover {
  background-color: var(--primary-color);
  color: white;
}

.mermaid-error {
  padding: 15px;
  margin: 10px 0;
  background-color: #FEF2F2;
  border-left: 4px solid var(--error-color);
  color: #b91c1c;
  border-radius: 4px;
  font-weight: bold;
}

/* URL container with copy button */
.url-container {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.redirect-url {
  flex: 1;
  word-break: break-all;
  margin-right: 10px;
}

.copy-url-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  background-color: var(--secondary-bg);
  color: var(--heading-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-url-btn:hover {
  background-color: var(--primary-color);
  color: white;
}

.copy-url-btn.copied {
  background-color: var(--success-color);
  color: white;
}

/* Tracking parameters table */
.tracking-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.9rem;
}

.tracking-table th, 
.tracking-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.tracking-table th {
  background-color: var(--secondary-bg);
  font-weight: 600;
  color: var(--heading-color);
}

.param-name {
  font-weight: 600;
  white-space: nowrap;
  color: var(--heading-color);
  width: 30%;
}

.param-value {
  word-break: break-all;
} 