:root {
  --bg-color: #1e1e1e; /* Dark background */
  --primary-color: #131920; /* Slightly lighter dark background for containers */
  --secondary-color: #131920; /* Medium dark for secondary elements */
  --text-color: #ebebe3; /* Light gray text */
  --accent-color: #489dd3; /* Bright blue accent (keep for consistency) */
  --border-title-color: #424650; /* Bright blue accent (keep for consistency) */
  --ssl-accent-color: #66bb6a; /* Muted green, common in SSL indicators */
  --ssl-accent-light: #81c784; /* Lighter shade of the SSL green */
  --border-color: #555; /* Dark gray border */
  --success-color: var(--ssl-accent-color); /* Use SSL green for success */
  --error-color: #f44336; /* Keep red for errors */
  --warning-color: #ffc107; /* Yellow for warnings (e.g., expiring soon) */
  --neutral-color: #777; /* Gray for neutral states */
  --button-bg: var(--accent-color); /* Keep blue for primary buttons */
  --button-hover-bg: #0056b3; /* Darker blue for button hover */
  --input-bg: #333; /* Dark input background */
  --input-border: #555; /* Dark input border */
  --input-focus-border: var(
    --ssl-accent-light
  ); /* Focus with lighter SSL green */
  --logo-bg: #444; /* Dark logo background */
  --logo-text: #ccc; /* Light logo text */
}

.header-cta {
  font-size: 1.1em;
  color: var(--ssl-accent-color);
  font-weight: bold;
  text-decoration: underline;
}

.header-cta:hover {
  color: var(--accent-color);
}
.controls-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px 20px;
  backdrop-filter: blur(10px);
}

.left-controls {
  flex-shrink: 0;
}

.right-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.compact-toggle-btn {
  padding: 8px 16px;
  color: rgb(195, 195, 201);
  background-color: transparent;
  border: 1px solid #2171c6;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.compact-toggle-btn:hover {
  text-decoration: underline;
}

.inline-select-group {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.compact-label {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.compact-select {
  padding: 6px 25px 6px 10px;
  border: 1px solid #666;
  border-radius: 4px;
  background: #333;
  font-size: 13px;
  color: #bcbaba;
  cursor: pointer;
  min-width: 80px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23666' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 12px;
  transition: all 0.2s ease;
}

.compact-select:focus {
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
}

.compact-select:hover {
  border-color: #999;
}

.compact-select.field-error {
  border-color: #dc3545;
}

.compact-error {
  position: absolute;
  top: 100%;
  left: 0;
  font-size: 11px;
  color: #dc3545;
  margin-top: 2px;
  white-space: nowrap;
}

/* Responsive design */
@media (max-width: 768px) {
  .controls-container {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  .logo-placeholder {
    align-self: center;
  }
  .left-controls {
    display: flex;
    justify-content: center;
  }

  .right-controls {
    justify-content: center;
    gap: 15px;
  }

  .compact-toggle-btn {
    width: auto;
    min-width: 120px;
  }
}

@media (max-width: 480px) {
  .controls-container {
    padding: 12px 15px;
  }

  .right-controls {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .inline-select-group {
    justify-content: space-between;
    width: 100%;
  }

  .compact-select {
    min-width: 100px;
    flex: 1;
    margin-left: 10px;
  }
}

.help-tooltip-container {
  position: relative;
  display: inline-block;
  margin-left: 5px;
  vertical-align: middle;
}

.help-icon {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 18px;
  height: 18px;
  background-color: #888;
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  cursor: help;
  user-select: none;
  box-sizing: border-box;
  transition: background-color 0.2s ease;
  position: relative;
  top: -4px;
}

.help-icon:hover {
  background-color: #555; /* Darker background on hover */
}

.tooltip-text {
  /* Visibility & Positioning */
  visibility: hidden; /* Hidden by default */
  opacity: 0; /* Start fully transparent */
  position: absolute; /* Position relative to the container */
  z-index: 10; /* Ensure it's above other elements */
  bottom: 135%; /* Position above the icon (adjust px or % as needed) */
  left: 50%; /* Start positioning from the middle */
  transform: translateX(-50%); /* Center the tooltip horizontally */

  /* Appearance */
  background-color: #333; /* Tooltip background */
  color: #fff; /* Tooltip text color */
  text-align: center;
  padding: 8px 12px; /* Padding inside the tooltip */
  border-radius: 6px; /* Rounded corners */
  min-width: 150px; /* Minimum width, adjust as needed */
  max-width: 300px; /* Maximum width, adjust as needed */
  white-space: normal; /* Allow text wrapping */
  font-size: 12px; /* Tooltip font size */
  font-weight: normal; /* Reset font weight from label */
  line-height: 1.4; /* Improve readability for wrapped text */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); /* Optional shadow */

  /* Transition */
  transition: opacity 0.3s ease, visibility 0.3s ease; /* Smooth fade */
}

/* Tooltip Arrow (Optional but nice) */
.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%; /* Position arrow at the bottom of the tooltip */
  left: 50%;
  margin-left: -5px; /* Should be half the border-width */
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent; /* Arrow color matching tooltip background */
}

/* Show tooltip on container hover */
.help-tooltip-container:hover .tooltip-text {
  visibility: visible; /* Make it visible */
  opacity: 1; /* Make it fully opaque */
}

/* --- End Styles for Help Icon and Tooltip --- */

/* Increase placeholder text size for both mobile and desktop */
#url::placeholder,
#domain::placeholder,
#port::placeholder,
#email::placeholder,
#state::placeholder,
#locality::placeholder,
#organization::placeholder,
#org_unit::placeholder,
#email_recipient::placeholder {
  font-size: 16px; /* Increase the size on all devices */
}

/* Ensure consistent appearance across browsers */
#url::-webkit-input-placeholder,
#domain::-webkit-input-placeholder,
#port::-webkit-input-placeholder,
#email::-webkit-input-placeholder,
#state::-webkit-input-placeholder,
#locality::-webkit-input-placeholder,
#organization::-webkit-input-placeholder,
#org_unit::-webkit-input-placeholder,
#email_recipient::-webkit-input-placeholder {
  /* Chrome/Safari/Opera */
  font-size: 16px;
}

#url::-moz-placeholder,
#domain::-moz-placeholder,
#port::-moz-placeholder,
#email::-moz-placeholder,
#state::-moz-placeholder,
#locality::-moz-placeholder,
#organization::-moz-placeholder,
#org_unit::-moz-placeholder,
#email_recipient::-moz-placeholder {
  /* Firefox */
  font-size: 16px;
}

#url:-ms-input-placeholder,
#domain:-ms-input-placeholder,
#port:-ms-input-placeholder,
#email:-ms-input-placeholder,
#state:-ms-input-placeholder,
#locality:-ms-input-placeholder,
#organization:-ms-input-placeholder,
#org_unit:-ms-input-placeholder,
#email_recipient:-ms-input-placeholder {
  /* IE/Edge */
  font-size: 16px;
}

/* --- New styles for SSL Check Results --- */
.results {
  margin-top: 30px;
  padding: 15px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  background-color: var(
    --primary-color
  ); /* Use primary color for the results container */
}

.results h2 {
  color: var(
    --ssl-accent-light
  ); /* Use lighter SSL green for the main heading */
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 15px;
}

.section-header {
  background-color: var(
    --secondary-color
  ); /* Slightly darker background for section headers */
  padding: 8px 15px;
  margin: 15px 0 10px 0;
  border-radius: 4px;
  font-weight: bold;
  border-left: 4px solid var(--ssl-accent-color); /* Use SSL green for the left border */
  color: var(--text-color);
}

.result-item {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dotted var(--border-color); /* Use dark border for separator */
}

.result-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.result-item strong {
  display: inline-block;
  min-width: 180px; /* Adjust as needed */
  color: var(
    --ssl-accent-light
  ); /* Highlight key labels with lighter SSL green */
}

.status-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-left: 5px;
  vertical-align: middle;
  border-radius: 50%;
  text-align: center;
  line-height: 20px;
  font-weight: bold;
  font-size: 12px;
  color: white;
}

.status-success {
  background-color: var(--success-color); /* Use SSL green */
}

.status-success::after {
  content: "✓";
}

.status-warning {
  background-color: var(--warning-color); /* Use yellow */
  color: var(--primary-color); /* Dark text on yellow */
}

.status-warning::after {
  content: "!";
}

.status-error {
  background-color: var(--error-color); /* Use red */
}

.status-error::after {
  content: "✗";
}

.status-neutral {
  background-color: var(--neutral-color); /* Use gray */
}

.status-neutral::after {
  content: "?";
}

.cert-chain {
  margin-left: 20px;
  border-left: 2px solid var(--secondary-color); /* Darker border for chain */
  padding-left: 15px;
}

.cert-chain h3 {
  font-size: 1.1em;
  margin-top: 1em;
  border: none;
  color: var(--ssl-accent-color); /* Use SSL green for chain headings */
}

.cert-chain .result-item strong {
  min-width: 120px; /* Adjust for chain details */
}

.error-message {
  color: var(--error-color);
  background-color: rgba(
    244,
    67,
    54,
    0.1
  ); /* Slightly transparent red background */
  border: 1px solid var(--error-color);
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.long-text {
  word-break: break-word;
  max-height: 100px;
  overflow-y: auto;
  padding: 8px;
  background-color: var(--input-bg); /* Dark background for long text */
  border: 1px solid var(--input-border); /* Dark border */
  border-radius: 3px;
  color: var(--text-color);
  font-family: monospace; /* Monospace for technical details */
  font-size: 0.9em;
}

@media (min-width: 768px) {
  .main-menu {
    border: none;
    border-radius: 0px;
    padding: 0px;
    margin-bottom: 0px;
  }
  .main-menu a {
    display: inline-block;
    width: auto;
    text-align: center;
  }
  .main-menu ul {
    border: 1px solid var(--border-title-color);
    border-radius: 8px;
    gap: 10px;
    padding: 5px 5px;
    margin-bottom: 5px;
  }
}

.menu-toggle {
  display: none;
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  color: var(--accent-color);
}

textarea {
  width: 100%;
  padding: 7px;
  outline: none;
  color: var(--text-color);
  background-color: var(--input-bg);
  border: 1px solid var(--input-border); /* Default border color is now applied correctly */
  border-radius: 4px;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
  min-height: 200px;
  font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
  font-size: 0.9em;
  resize: vertical;
}

textarea:focus {
  border-color: var(
    --input-focus-border
  ); /* Apply focus color only when focused */
  outline: none; /* Ensure no default browser outline interferes */
}

dl {
  margin: 0;
  padding: 0;
}
dt {
  font-weight: bold;
  color: #444;
  padding-top: 8px;
}
dd {
  margin-left: 20px;
  padding-bottom: 8px;
  word-wrap: break-word; /* Wrap long values */
}

/* --- Styling for Subject Items --- */
.subject-item {
  margin: 5px 0 10px 0; /* Adjust spacing: top right bottom left */
  padding-bottom: 5px;
  border-bottom: 1px dashed #eee; /* Optional separator */
  word-wrap: break-word; /* Keep word wrapping */
}
.subject-item:last-child {
  border-bottom: none; /* Remove separator from last item */
  margin-bottom: 20px; /* Add space after the last item before the next section */
}
.subject-item strong {
  color: #9be460; /* Optional: Slightly darker color for the bold text */
}

a,
a:hover,
a:active,
a:visited,
a:focus {
  text-decoration: none;
}
/* Hamburger and X transition */
.menu-toggle::before {
  content: "\2630"; /* ☰ */
  transition: transform 0.3s ease, content 0.3s ease;
  display: inline-block;
}

.menu-toggle.active::before {
  content: "\2715"; /* ✕ */
  transform: rotate(180deg);
}

.main-menu {
  display: block;
  width: 100%;
  margin: 5px 0 5px 0;
  padding: 0 10px;
  box-sizing: border-box;
  background-color: #181a23;
}

.main-menu ul {
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 2px 10px; /* Added 15px horizontal padding */
  max-width: 800px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  gap: 5px; /* Or whatever gap you prefer between items */

  /* Properties specific to desktop layout (adjust if they conflict) */
  border: 1px solid var(--border-title-color);
  border-radius: 8px;
  /* You might remove the padding here if you want the above 'padding: 5px 15px;' to be the primary one for all screen sizes */
  /* padding: 5px 5px; */ /* If this line exists, it will override the above. Decide which one you want to apply. */
  margin-bottom: 5px;
}

/* For Chrome/Safari/Opera - Hide scrollbar */
.main-menu ul::-webkit-scrollbar {
  display: none;
}

.h1,
h2,
h3,
p {
  color: #eeeeee;
  margin-top: 5px;
  margin-bottom: 5px;
}

.main-menu a {
  color: #d3d3d3;
  text-decoration: none;
  padding: 5px;
}

.main-menu a:hover {
  color: var(--accent-color);
}

.main-menu a.active {
  color: var(--accent-color);
  font-weight: bold;
}

/* 🔽 Responsive styles */
@media screen and (max-width: 768px) {
  #url::placeholder,
  #domain::placeholder,
  #port::placeholder,
  #email::placeholder,
  #state::placeholder,
  #locality::placeholder,
  #organization::placeholder,
  #org_unit::placeholder,
  #email_recipient::placeholder {
    font-size: 16px; /* Slightly smaller on mobile if desired */
  }

  #url::-webkit-input-placeholder,
  #domain::-webkit-input-placeholder,
  #port::-webkit-input-placeholder,
  #email::-webkit-input-placeholder,
  #state::-webkit-input-placeholder,
  #locality::-webkit-input-placeholder,
  #organization::-webkit-input-placeholder,
  #org_unit::-webkit-input-placeholder,
  #email_recipient::-webkit-input-placeholder {
    font-size: 14px;
  }

  #url::-moz-placeholder,
  #domain::-moz-placeholder,
  #port::-moz-placeholder,
  #email::-moz-placeholder,
  #state::-moz-placeholder,
  #locality::-moz-placeholder,
  #organization::-moz-placeholder,
  #org_unit::-moz-placeholder,
  #email_recipient::-moz-placeholder {
    font-size: 14px;
  }

  #url:-ms-input-placeholder,
  #domain:-ms-input-placeholder,
  #port:-ms-input-placeholder,
  #email:-ms-input-placeholder,
  #state:-ms-input-placeholder,
  #locality:-ms-input-placeholder,
  #organization:-ms-input-placeholder,
  #org_unit:-ms-input-placeholder,
  #email_recipient:-ms-input-placeholder {
    font-size: 14px;
  }
  .header-content {
    justify-content: center;
  }

  .logo-placeholder {
    order: -1;
  }

  .menu-toggle {
    display: block;
  }

  .main-menu {
    display: none;
    flex-direction: column;
    margin-top: 15px;
  }

  .menu-toggle {
    display: block;
  }

  .main-menu.active {
    display: flex;
  }

  .main-menu ul {
    flex-direction: column;
    gap: 0.5rem;
  }
  .header-text h2 {
    display: none;
  }
}

.highlight {
  animation: flash 2s;
}

@keyframes flash {
  0% {
    background-color: transparent;
  }
  25% {
    background-color: rgba(255, 255, 0, 0.2);
  }
  100% {
    background-color: transparent;
  }
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 20px;
  line-height: 1.6;
}

.container {
  max-width: 850px;
  margin: 10px auto;
  background-color: var(--primary-color);
  padding: 5px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

header {
  background-color: #181a23; /* Ensures the header has a solid background for the shadow */
  padding: 5px 0; /* Adds some vertical spacing inside the header */
  position: relative; /* Optional: Good practice for potential z-index stacking */
  z-index: 10; /* Optional: Ensures header stays above other simple content */
}
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  /* Ensure this max-width matches your container's effective content width, e.g., 850px - (5px * 2) = 840px */
  max-width: 840px; /* Adjusted to typically match inner container width if container padding is 5px */
  margin: 0 auto; /* Centers the header content on the page */
  padding: 0 10px; /* Add 10px internal padding to push content away from its edges. This effectively creates the 10px gap *inside* header-content */
}

.header-text {
  flex: 1;
  text-align: center;
  padding: 0 20px;
}

.header-text h1 {
  color: var(--accent-color);
  margin: 0 0 5px 0;
  font-size: 1.8em;
}

.header-text h2 {
  color: #b0b0b0;
  margin: 0;
  font-size: 1.2em;
  font-weight: normal;
}

.logo-placeholder {
  flex: 0 0 auto;
}

header h1 {
  color: var(--accent-color);
  margin-bottom: 5px;
}

h2 {
  margin: 0;
  padding: 0 0;
}

header p {
  color: #b0b0b0;
  margin-bottom: 5px;
}

.generate-new-button {
  background-color: var(--accent-color);
  margin-left: 10px;
  font-size: 0.9em;
  padding: 5px 10px;
  float: right;
  cursor: pointer;
  border-radius: 4px;
  color: white; /* Text color */
  border: none;
}

.generate-new-button:hover {
  background-color: #45a049; /* Darker green for hover */
}

/* Make sure the container clears the float */
.result-box:after {
  content: "";
  display: table;
  clear: both;
}

.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: normal;
  color: #c0c0c0;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group select {
  width: 100%;
  padding: 12px;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-color);
  border-radius: 4px;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
}
.form-group input[type="text"]:focus,
.form-group input[type="emaila"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus {
  border-color: var(--input-focus-border);
  outline: none;
}
.form-group select {
  background-image: url('data:image/svg+xml;utf8,<svg fill="%23e0e0e0" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 30px;
}
.toggle-button {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.3s ease, opacity 0.3s ease;
  color: #fff;
}
.button-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.submit-button,
.copy-button {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.3s ease, opacity 0.3s ease;
  color: #1a1818;
}
.toggle-button {
  background-color: var(--secondary-color);
  border: 1px solid var(--border-color);
}
.toggle-button:hover {
  background-color: #4a4a4a;
}
.submit-button {
  background-color: var(--button-bg);
}
.submit-button:hover {
  background-color: var(--button-hover-bg);
}
.copy-button {
  background-color: var(--accent-color);
  margin-left: 10px;
  font-size: 0.9em;
  padding: 5px 10px;
  vertical-align: middle;
}
.copy-button:hover {
  opacity: 0.8;
}

.advanced-fields {
  margin-top: 5px;
  padding-top: 5px;
}

.results-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px dashed var(--border-color);
}
.results-section h2 {
  color: var(--accent-color);
  margin-bottom: 5px;
}
.result-box {
  margin-bottom: 25px;
}
.result-box label {
  display: inline-block;
  margin-right: 5px;
  margin-bottom: 10px;
  font-weight: bold;
}
.result-box pre {
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  padding: 15px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text-color);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9em;
  max-height: 300px;
  overflow-y: auto;
}

.error-message {
  color: var(--error-color);
  font-size: 0.9em;
  margin-top: 5px;
  display: block;
}
.field-error {
  border-color: var(--error-color) !important;
}
.success-message {
  color: var(--success-color);
  text-align: center;
  margin-bottom: 15px;
  font-weight: bold;
}
.email-recipient-group {
  margin-top: 10px;
  padding-top: 10px;
}

.captcha-group label {
  display: inline-block;
  margin-right: 10px;
  vertical-align: middle;
}
.captcha-group .captcha-question {
  font-weight: bold;
  color: var(--accent-color);
  margin-right: 5px;
  vertical-align: middle;
  background-color: var(--input-bg);
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid var(--input-border);
}
.captcha-group input[type="number"] {
  width: 80px;
  display: inline-block;
  vertical-align: middle;
  padding: 8px;
  appearance: textfield;
  -moz-appearance: textfield;
}
.captcha-group input[type="number"]::-webkit-outer-spin-button,
.captcha-group input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.footer {
  margin: 30px 30px;
  text-align: center;
  font-size: 0.6em;
  color: #ddd3d3;
}
.footer a {
  color: #d3d3d3;
  text-decoration: none;
}
.footer a:hover {
  color: #00aaff;
}
