/* ================= GLOBAL STYLES ================= */
:root {
  --bg: #020617;
  --card-bg: rgba(30, 41, 59, 0.5);
  --border: #334155;
  --accent: #38bdf8;
  --text: #f1f5f9;
  --low: #4ade80;
  --medium: #facc15;
  --high: #fb7185;
  --critical: #ef4444;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at center, #0f172a, #020617);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ================= HEADER & NAV ================= */
header {
  text-align: center;
  padding: 40px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(10px);
}

h1 {
  font-size: 2.5rem;
  letter-spacing: -1px;
  background: linear-gradient(to right, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}

.nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(2, 6, 23, 0.9);
  border-bottom: 1px solid var(--border);
}

.nav button {
  background: transparent;
  border: 1px solid var(--border);
  color: #94a3b8;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

/* Tab Highlighting */
.nav button.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* ================= MAIN LAYOUT ================= */
.mode {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
}

.hidden { display: none; }

input, select {
  background: #1e293b;
  border: 1px solid var(--border);
  color: white;
  padding: 12px;
  border-radius: 8px;
  width: 100%;
  margin: 8px 0;
  box-sizing: border-box;
}

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 15px;
  margin-bottom: 30px;
}

/* ================= CARD GRID ================= */
#results, #auditResults {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: 12px;
  transition: transform 0.2s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}


/* Ensure the audit results use the same grid as the main results */
#auditResults {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Force code text to wrap so long dorks don't break the card */
.query-box code {
    white-space: pre-wrap;
    word-break: break-all;
    display: block;
    padding-right: 40px; /* Space for copy button */
}

/* Container for the audit controls */
.audit-controls {
    display: flex;
    gap: 10px;
    align-items: center; /* Centers elements vertically */
    width: 100%;
    margin-bottom: 25px;
}

/* Domain Input - Expands to fill available middle space */
#auditDomain {
    flex: 1; /* Grows to take up remaining space */
    height: 42px; /* Set a fixed height for all elements */
    padding: 0 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Engine Selector - Fixed professional width */
#auditEngine {
    width: 160px; /* Fixed width prevents it from being too lengthy */
    height: 42px;
    padding: 0 10px;
    background: #1e293b;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    box-sizing: border-box;
}

/* Audit Button - Fixed width and matching height */
.audit-btn {
    width: 120px;
    height: 42px;
    background: #38bdf8; /* Your sky-blue accent color */
    color: #0f172a; /* Dark text for better contrast on light blue */
    border: none;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
    box-sizing: border-box;
}

.audit-btn:hover {
    background: #7dd3fc;
}

/* ================= QUERY BOX & BUTTONS ================= */
.query-box {
  background: #000;
  padding: 15px;
  border-radius: 6px;
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  margin: 10px 0;
  position: relative;
  overflow-x: auto;
  border: 1px solid #1e293b;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent);
  border: none;
  color: var(--bg);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

/* Fix for buttons inside cards to ensure they are uniform */
.audit-card .google-link {
    width: 100%;
    margin-top: 10px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.google-link {
  margin-top: auto;
  text-align: center;
  background: #38bdf820;
  color: var(--accent);
  padding: 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: 0.3s;
}

.google-link:hover { 
  background: var(--accent); 
  color: var(--bg); 
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.audit-card {
    border-top: 2px solid var(--accent);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Responsive Grid for Open Directory Buttons */
.od-grid {
    display: grid;
    /* This creates as many columns as will fit, with a minimum width of 180px each */
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); 
    gap: 12px;
    margin-top: 20px;
}

.od-btn {
    background: #1e293b;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
}

.od-btn:hover {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* Styling for Search Engine Dropdown Groups */
select optgroup {
    background: #0f172a;
    color: var(--accent);
    font-weight: bold;
    font-style: normal;
}

select option {
    background: #1e293b;
    color: white;
}

/* ================= FOOTER ================= */
footer {
  margin-top: 50px;
  padding: 40px;
  border-top: 1px solid var(--border);
  text-align: center;
}

footer a {
  transition: 0.3s;
  margin: 0 15px;
  text-decoration: none;
}

footer a:hover {
  color: var(--text) !important;
}