:root {
    --bg: #09090b;
    --card-bg: #18181b;
    --card-border: #27272a;
    --text: #fafafa;
    --subtext: #a1a1aa;
    --accent: #10b981;
    --accent-hover: #34d399;
    --success: #22c55e;
    --glass: rgba(24, 24, 27, 0.8);
    --danger: #ef4444;
    --nav-bg: rgba(9, 9, 11, 0.9);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--subtext);
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    line-height: 1.6;
    padding-top: 80px; /* Space for fixed nav */
    background-image: radial-gradient(circle at top right, #18181b, transparent);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 2rem;
    background: linear-gradient(to right, #fff, var(--subtext));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

.header-area {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.clock-container {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
}

#current-time {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
}

#current-date {
    color: var(--subtext);
    font-size: 0.9rem;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    z-index: 1000;
}

nav a {
    color: var(--subtext);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

nav a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

nav a.active {
    color: var(--accent);
    background: rgba(16, 185, 129, 0.1);
}

/* Staggered Entry Animation */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
}

/* Apply delays based on index via style attribute in JS if needed, 
   or just general classes for static ones */
.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.15s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(n+4) { animation-delay: 0.25s; }

/* Notifications */
#notification-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10001;
}

.notification-toast {
    background: var(--card-bg);
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Grid & Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    grid-auto-flow: dense; /* Fills in holes created by hero cards */
}

/* Hero Cards for Hierarchy */
@media (min-width: 1024px) {
    .card.hero {
        grid-column: span 2;
    }
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    max-width: 100%;
    min-width: 0; /* Important: Prevents content from expanding the card beyond grid width */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.dashboard-link-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s;
}

.dashboard-link-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.dashboard-link-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-link-desc {
    font-size: 0.75rem;
    color: var(--subtext);
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
}

/* Form Elements */
button {
    font-family: inherit;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: filter 0.2s;
}

button:active {
    transform: scale(0.98);
}

input, textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--card-border);
    color: white;
    padding: 0.75rem;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
}

input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Status Indicators */
.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    min-width: 0;
}

.status-item a {
    flex: 1;
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-item > span[id] {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    min-width: 0;
    overflow: hidden;
}

.status-item a:hover {
    color: var(--accent);
}

.status-dot {
    height: 10px;
    width: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    flex-shrink: 0;
}


.status-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.status-dot.warning {
    background-color: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
    animation: pulse 2s infinite;
}

.incident-title {
    font-size: 0.65rem;
    color: var(--subtext);
    margin-top: 2px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Progress Bar */
.progress-container {
    height: 2px;
    width: 100%;
    background: var(--card-border);
    margin-bottom: 15px;
    overflow: hidden;
    border-radius: 2px;
    display: none;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.3s ease;
}

.refresh-btn {
    background: none;
    border: none;
    color: var(--subtext);
    cursor: pointer;
    transition: color 0.2s, transform 0.5s;
}

/* Search Input Specific */
.search-input {
    margin-bottom: 1.5rem;
    padding: 0.85rem 1rem; /* Slightly larger padding */
    font-size: 1rem;
    border-radius: 8px;
    background: var(--card-bg); /* Match card background */
    border-color: var(--card-border);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}
.search-input::placeholder {
    color: var(--subtext);
}

.latency-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
}

.util-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.copy-btn {
    background: var(--bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 0 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.copy-btn:hover {
    background: var(--accent);
    color: var(--bg);
}

.disclaimer-container {
    margin-top: 10px;
    border-top: 1px solid var(--card-border);
    padding-top: 10px;
}

.disclaimer-toggle {
    cursor: pointer;
    color: var(--subtext);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    transition: color 0.2s;
}

.disclaimer-toggle:hover {
    color: var(--text);
}

.toggle-arrow {
    display: inline-block;
    margin-left: 5px;
    transition: transform 0.2s ease-in-out;
}

.toggle-arrow.rotated {
    transform: rotate(180deg);
}

.disclaimer-text {
    font-size: 0.7rem;
    color: var(--subtext);
    line-height: 1.4;
    max-height: 0; /* Start hidden */
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0; /* Start invisible */
}

.disclaimer-text.expanded {
    max-height: 200px; /* Sufficient height for the text */
    opacity: 1;
}

.scan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 4px;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 5px;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.scan-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--card-border);
    margin: 2px auto;
    transition: all 0.3s ease;
}

.category-header {
    grid-column: 1 / -1;
    font-size: 1.4rem;
    color: var(--accent);
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

/* Snippets Specific */
code {
    display: block;
    background: var(--bg);
    color: #34d399;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    cursor: pointer;
    position: relative;
    border: 1px solid #1e293b;
    overflow-x: auto;
}

code:hover {
    background: #0a0a0a;
}

/* Tags */
.btn-list div[style*="display: flex"] {
    min-width: 0;
}

.btn-list a {
    display: block;
    padding: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--card-border);
    margin-bottom: 0.5rem;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    min-width: 0; /* Critical for truncation in flex */
    overflow: hidden;
}

.btn-list.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}

.btn-list a span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-list a:hover {
    background: var(--accent);
    color: var(--bg);
    font-weight: bold;
}

.scratchpad-controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.scratchpad-btn {
    flex: 1;
    padding: 6px;
    font-size: 0.75rem;
    background: var(--card-border);
    color: var(--text);
    border: none;
}

.scratchpad-btn:hover {
    background: var(--card-border);
    filter: brightness(1.2);
}