:root {
    --primary: #EF4444;
    /* Red */
    --primary-hover: #dc2626;
    --accent: #22C55E;
    /* Green */
    --accent-hover: #16a34a;
    --warning: #F59E0B;
    /* Orange/Yellow */
    --background: #18181B;
    /* Zinc 900 */
    --surface: #27272A;
    /* Zinc 800 */

    --glass-bg: rgba(39, 39, 42, 0.7);
    --glass-border: rgba(239, 68, 68, 0.2);

    --text-main: #f8fafc;
    --text-muted: #a1a1aa;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    min-height: 100vh;
}

/* Base Layout */
.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 15% 50%, rgba(239, 68, 68, 0.05), transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(34, 197, 94, 0.05), transparent 40%);
}

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

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.25rem;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

header p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-top: 0.5rem;
}

.layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

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

h2 {
    font-size: 1.2rem;
    color: var(--text-main);
    font-weight: 600;
}

h3 {
    font-size: 1.05rem;
    color: var(--text-main);
}

/* Utilities */
.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.hidden {
    display: none !important;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 2rem 0;
}

/* Components */
.badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.badge.success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent);
    border: 1px solid var(--accent);
}

.badge.error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--primary);
    border: 1px solid var(--primary);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

input[type="text"],
select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e2e8f0;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    transition: all 0.2s;
    outline: none;
}

select {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.small-select {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    width: auto;
}

/* Tooltip */
.tooltip-label {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted var(--text-muted);
}

.tooltip-label:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
    margin-bottom: 5px;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.full-width {
    width: 100%;
}

.small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

.primary-btn {
    background: var(--primary);
    color: #fff;
}

.primary-btn:hover {
    background: var(--primary-hover);
}

.outline-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-main);
}

.outline-btn:hover {
    border-color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Animation / Flow Nodes */
.nodes-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding: 2rem 0;
}

.node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    z-index: 2;
}

.node-icon {
    font-size: 2.5rem;
    background: var(--surface);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.node-label {
    font-weight: 600;
    font-size: 1.1rem;
}

.node-sub {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 150px;
    word-break: break-all;
    text-align: center;
}

.browser-node .node-icon {
    border-color: rgba(56, 189, 248, 0.5);
}

.server-node .node-icon {
    border-color: rgba(168, 85, 247, 0.5);
}

.connection-path {
    position: absolute;
    top: 50%;
    left: 100px;
    right: 100px;
    transform: translateY(-50%);
    height: 40px;
    z-index: 1;
}

.path-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    height: 2px;
    background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0, rgba(255, 255, 255, 0.2) 5px, transparent 5px, transparent 10px);
}

.moving-packet {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.3rem 0.8rem;
    background: #fff;
    color: #000;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-weight: 700;
    font-size: 0.8rem;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    opacity: 1;
}

/* Logging Window */
.log-window {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    height: 200px;
    overflow-y: auto;
    padding: 1rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    margin-top: 0.5rem;
}

.log-window::-webkit-scrollbar {
    width: 6px;
}

.log-window::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.log-entry {
    margin-bottom: 0.4rem;
    padding-left: 1rem;
    text-indent: -1rem;
}

.log-entry.info {
    color: var(--text-muted);
}

.log-entry.req {
    color: #38BDF8;
}

.log-entry.res {
    color: #A855F7;
}

.log-entry.success {
    color: var(--accent);
    font-weight: 600;
}

.log-entry.error {
    color: var(--primary);
    font-weight: 600;
}

/* Diagnosis Box */
.diagnosis-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 1.25rem;
}

.diagnosis-box.success-box {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--accent);
}

#diagnosis-title {
    margin-bottom: 0.5rem;
}

#diagnosis-desc {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #fff;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-main);
    color: #000;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
}

.toast.show {
    opacity: 1;
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .nodes-container {
        padding: 1rem 0;
    }

    .connection-path {
        left: 80px;
        right: 80px;
    }
}