/* --- 1. Variables and Base Styling --- */
:root {
  --bg: #0d111a; /* Very deep blue-black */
  --card: #182033; /* Dark slate blue for surfaces */
  --muted: #aab8cf; /* Light grey text */
  --accent: #0099ff; /* Primary vibrant blue */
  --accent-hover: #33aaff;
  --text: #eef4ff; /* Off-white text */
  --radius: 10px;
  --shadow-dark: 0 6px 20px rgba(0, 0, 0, 0.7);
  --success: #10b981;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.6;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

h1, h2, h3 { color: var(--text); margin-top: 0; line-height: 1.2; }
code { 
    background: rgba(255, 255, 255, 0.1); 
    padding: 3px 6px; 
    border-radius: 4px; 
    color: var(--accent-hover);
    font-weight: 500;
}

/* --- 2. Topbar (Mobile Only) --- */
.topbar {
  background: var(--card);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-dark);
}
.topbar h1 {
  font-size: 20px;
  margin: 0;
  color: var(--accent);
}
.btn {
  background: var(--accent);
  border: 0;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn:hover {
  background: var(--accent-hover);
}
.btn:active {
    transform: scale(0.95);
}

/* --- 3. Sidebar (Navigation) --- */
.sidebar {
  position: fixed;
  top: 0;
  right: -280px;
  bottom: 0;
  width: 280px;
  background: var(--card);
  padding: 20px 15px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(255,255,255,0.05);
  transition: right 0.3s ease;
  z-index: 150;
}
.sidebar.show { right: 0; }
.sidebar nav { display: flex; flex-direction: column; gap: 6px; }

.sidebar nav button {
  width: 100%;
  background: none;
  border: 0;
  color: var(--muted);
  padding: 12px 15px;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 16px;
  transition: background 0.2s, color 0.2s, box-shadow 0.3s;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}
.sidebar nav button.active {
  background: var(--accent);
  color: white;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(0, 153, 255, 0.6); /* Glowing effect */
}
.sidebar nav button:hover:not(.active) {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  transform: translateX(3px);
}


/* --- 4. Main Content Area & Cards --- */
main {
  margin: 20px;
  padding: 25px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-dark);
  border: 1px solid rgba(255,255,255,0.1);
}
main h2 {
    color: var(--accent);
    font-size: 28px;
    border-bottom: 2px solid rgba(0, 153, 255, 0.3);
    padding-bottom: 10px;
    margin-bottom: 25px;
}

/* Home and Utility Grid */
.home-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 20px;
}
.card {
  padding: 30px 20px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  text-align: center;
  font-size: 18px;
  transition: transform 0.3s, background 0.3s, box-shadow 0.3s;
  border: 1px solid rgba(255,255,255,0.1);
  position: relative;
  overflow: hidden;
}
.card i {
    font-size: 2.2rem;
    color: var(--accent);
    margin-bottom: 10px;
    transition: color 0.3s;
}
.card:hover {
  transform: translateY(-8px);
  background: rgba(0, 153, 255, 0.15);
  box-shadow: 0 10px 25px rgba(0, 153, 255, 0.3);
}
.card:hover i {
    color: var(--accent-hover);
}

/* Proxy Table Responsiveness */
.table-wrapper {
    overflow-x: auto; /* Allows table to scroll horizontally on small screens */
    margin-top: 20px;
    border-radius: var(--radius);
}

/* Proxy Table Sheet Style */
.proxy-table {
  width: 100%;
  min-width: 600px; /* Ensure a minimum width to keep columns readable */
  border-collapse: collapse;
  font-size: 14px;
}
.proxy-table th, .proxy-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  border-right: 1px solid rgba(255,255,255,0.05);
  white-space: nowrap; /* Prevent content from wrapping */
}
.proxy-table th:last-child, .proxy-table td:last-child {
    border-right: none;
}
.proxy-table thead th {
    background: var(--accent);
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.proxy-table tbody tr {
    transition: background 0.2s;
}
.proxy-table tbody tr:hover {
  background: rgba(0, 153, 255, 0.05);
}
.copy-btn {
  background: var(--accent);
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  color: white;
  transition: background 0.2s;
  font-weight: 600;
  font-size: 13px;
}
.copy-btn.success {
    background: var(--success) !important;
}

/* Tool Result Display (Retained but unused by the new checker section) */
#toolResult {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: var(--radius);
    margin-top: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    animation: fadeIn 0.5s ease-out;
}
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-hover);
    font-style: italic;
}
.loading-indicator .fas {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 5. Custom Message Toast --- */
#messageModal {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}
.message-toast {
    background: var(--success); 
    color: white; 
    padding: 12px 20px; 
    border-radius: 6px;
    box-shadow: var(--shadow-dark); 
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease-out, fadeOut 0.3s ease-in 2.7s forwards;
    opacity: 0;
    font-weight: 500;
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateX(100%); }
}


/* --- 6. Desktop Layout --- */
@media (min-width: 768px) {
    .topbar { display: none; }
    
    .sidebar {
        position: fixed;
        left: 0; 
        right: auto;
        padding-top: 20px;
        box-shadow: none;
        border-right: 1px solid rgba(255,255,255,0.05);
        border-left: none;
        width: 280px; 
    }
    
    main {
        margin-left: 300px;
        margin-right: 20px;
        max-width: calc(100% - 320px);
    }
}