:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #3b82f6;
    --font-family: 'Outfit', sans-serif;
    --glass-blur: blur(12px);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Background Animations */
.background-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59,130,246,0.6) 0%, rgba(15,23,42,0) 70%);
    top: -100px;
    left: -100px;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139,92,246,0.4) 0%, rgba(15,23,42,0) 70%);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(16,185,129,0.3) 0%, rgba(15,23,42,0) 70%);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 50px) scale(1.1); }
}

/* Glassmorphism */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Views */
.view {
    display: none;
    height: 100vh;
    width: 100vw;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.view.active {
    display: flex;
    opacity: 1;
}

/* Login View */
#login-view {
    align-items: center;
    justify-content: center;
}

.login-panel {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header {
    text-align: center;
}

.logo-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--accent-color), #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-icon svg {
    width: 28px;
    height: 28px;
}

.logo-icon.small {
    width: 36px;
    height: 36px;
    margin: 0;
}

.logo-icon.small svg {
    width: 20px;
    height: 20px;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-color), #2563eb);
    color: white;
    border: none;
    padding: 0.875rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.primary-btn:active {
    transform: translateY(0);
}

.loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

.error-msg {
    color: var(--danger);
    font-size: 0.875rem;
    text-align: center;
    background: rgba(239, 68, 68, 0.1);
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    padding: 1rem;
    gap: 1rem;
}

.sidebar {
    width: 260px;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    font-weight: 500;
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(59,130,246,0.15) 0%, rgba(59,130,246,0) 100%);
    border-left: 3px solid var(--accent-color);
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--panel-border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition);
}

.icon-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    height: 72px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    width: 300px;
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--accent-color);
    width: 350px;
}

.search-bar svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.search-bar input {
    background: transparent;
    border: none;
    color: white;
    width: 100%;
    font-family: inherit;
    font-size: 0.9rem;
}

.search-bar input:focus {
    outline: none;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.secondary-btn svg {
    width: 16px;
    height: 16px;
}

.logs-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.logs-header {
    display: flex;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--panel-border);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.col {
    padding: 0 0.5rem;
}

.col-level { width: 100px; }
.col-time { width: 180px; }
.col-resource { width: 150px; }
.col-message { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.logs-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.logs-list::-webkit-scrollbar {
    width: 6px;
}
.logs-list::-webkit-scrollbar-track {
    background: transparent;
}
.logs-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

.log-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
    font-size: 0.9rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.log-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.log-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.level-info .log-badge { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.level-warn .log-badge { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.level-error .log-badge { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.level-success .log-badge { background: rgba(16, 185, 129, 0.15); color: var(--success); }

.log-time { color: var(--text-secondary); }
.log-resource { color: #a78bfa; font-weight: 500; }
.log-message { color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.logs-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    gap: 1rem;
}

.logs-loading .loader {
    width: 32px;
    height: 32px;
    border-top-color: var(--accent-color);
}

.no-logs {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--panel-border);
}

.modal-header h3 {
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

pre {
    background: rgba(15, 23, 42, 0.8);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    color: #e2e8f0;
    font-size: 0.9rem;
    border: 1px solid var(--panel-border);
}

/* Syntax Highlighting for JSON */
.string { color: #a5d6ff; }
.number { color: #79c0ff; }
.boolean { color: #ff7b72; }
.null { color: #ff7b72; }
.key { color: #7ee787; font-weight: 500; }
