/* CSS Reset & Variables */
:root {
    --bg-color: #0d1117;
    --panel-bg: rgba(22, 27, 34, 0.7);
    --border-color: rgba(48, 54, 61, 0.8);
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --primary-color: #58a6ff;
    --primary-hover: #1f6feb;
    --success-color: #238636;
    --success-hover: #2ea043;
    --danger-color: #da3633;
    --danger-hover: #f85149;
    --input-bg: #010409;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

.font-prompt {
    font-family: 'Prompt', sans-serif;
}

.hidden { display: none !important; }

/* Utilities */
.w-full { width: 100%; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-md { max-width: 28rem; }
.flex { display: flex; }
.gap-2 { gap: 0.5rem; }
.flex-1 { flex: 1; }
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    display: inline-block;
    vertical-align: bottom;
}
.highlight-text { color: var(--primary-color); }
.font-bold { font-weight: 600; }
.text-danger { color: var(--danger-color); }

/* Glassmorphism Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.glass-card {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.card { padding: 1.5rem; }

/* Buttons */
button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary { background: var(--primary-color); color: #fff; padding: 0.6rem 1rem; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: var(--border-color); color: var(--text-primary); padding: 0.6rem 1rem; }
.btn-secondary:hover { background: #3d444d; }

.btn-success { background: var(--success-color); color: #fff; padding: 0.6rem 1rem; }
.btn-success:hover { background: var(--success-hover); }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.875rem; }

/* Form Inputs */
.input-group { margin-bottom: 1rem; }
.input-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    font-weight: 500;
}
input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
input:focus { border-color: var(--primary-color); }
.input-sm { padding: 0.4rem 0.6rem; font-size: 0.875rem; }

textarea, select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
textarea:focus, select:focus { border-color: var(--primary-color); }

.code-editor {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: #010409;
    color: #e6edf3;
    resize: vertical;
}

.help-text { font-size: 0.8rem; color: var(--text-secondary); }

/* Auth Layout */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.auth-card {
    width: 100%;
    max-width: 400px;
}
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-header h2 { font-size: 1.5rem; color: var(--primary-color); }
.auth-header p { color: var(--text-secondary); font-size: 0.9rem; }
.error-msg {
    color: var(--danger-hover);
    font-size: 0.875rem;
    margin-top: 1rem;
    text-align: center;
}

/* Dashboard Layout */
.dashboard-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    border-right: 1px solid var(--border-color);
    border-radius: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.logo h2 { font-size: 1.25rem; font-family: 'Prompt', sans-serif;}
.logo .badge {
    background: #FF9800;
    color: #fff;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: bold;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
}
.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
.nav-item.active {
    background: rgba(88, 166, 255, 0.1);
    color: var(--primary-color);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.top-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--panel-bg);
}

.view-section {
    padding: 2rem;
    flex: 1;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

/* Table */
.table-container {
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.data-table th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.status-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
}
.status-badge.online { background: rgba(35, 134, 54, 0.2); color: #4ade80; }
.status-badge.offline { background: rgba(218, 54, 51, 0.2); color: #f87171; }

.btn-icon {
    background: transparent;
    color: var(--primary-color);
    padding: 0.4rem;
    font-size: 0.875rem;
}
.btn-icon:hover {
    background: rgba(88, 166, 255, 0.1);
}

/* Grid Views */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 768px) {
    .grid-2col { grid-template-columns: 1fr; }
}

.info-group {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}
.info-group:last-of-type { border-bottom: none; }
.info-group label { color: var(--text-secondary); }

.divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0;
}

/* Loader */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 50vh;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
