:root {
    --primary: #00d2ff;
    --primary-hover: #3a7bd5;
    --bg-dark: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-dark);
    background-image: radial-gradient(circle at top right, rgba(0, 210, 255, 0.1), transparent 40%),
                      radial-gradient(circle at bottom left, rgba(58, 123, 213, 0.1), transparent 40%);
    color: var(--text-main);
    min-height: 100vh;
}

.screen {
    display: none;
    opacity: 0;
}

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

/* Glassmorphism Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Login Screen */
#login-screen {
    height: 100vh;
    width: 100vw;
    align-items: center;
    justify-content: center;
}

.login-card {
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 {
    margin-bottom: 8px;
    font-size: 28px;
    background: -webkit-linear-gradient(right, var(--primary), var(--primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

input, textarea, select.form-select {
    width: 100%;
    padding: 14px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
}

input:focus, textarea:focus, select.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 210, 255, 0.2);
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    font-size: 16px;
}

.btn-primary.small {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
}

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

.btn-secondary {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: white;
}

.btn-secondary.small {
    font-size: 12px;
    padding: 6px 12px;
}

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

.btn-danger {
    padding: 10px 20px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger.small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

/* Dashboard Layout */
#dashboard-screen {
    flex-direction: row;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    background: rgba(15, 23, 42, 0.98);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    z-index: 100;
}

.sidebar-brand {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 50px;
    padding: 0 10px;
}

.sidebar-nav {
    flex: 1;
}

.nav-item {
    padding: 14px 18px;
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-item.active {
    background: rgba(0, 210, 255, 0.1);
    color: var(--primary);
}

.dashboard-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

.glass-nav {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 40px;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 90;
}

.dashboard-content {
    padding: 40px;
    width: 100%;
}

.view-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.view-section.active {
    display: block;
}

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

.grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.card {
    padding: 30px;
    margin-bottom: 30px;
}

.card.full-width {
    grid-column: 1 / -1;
}

.card h3 {
    margin-bottom: 10px;
    font-size: 20px;
    font-weight: 600;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 12px 15px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
    font-size: 14px;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
}

tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge-primary { background: rgba(0, 210, 255, 0.2); color: var(--primary); }

/* QR Section */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
}

.qr-container img {
    max-width: 200px;
    border-radius: 8px;
    background: white;
    padding: 10px;
}

/* Stats Section */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-box {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-box h4 {
    font-size: 32px;
    margin-bottom: 5px;
}

.stat-box span {
    color: var(--text-muted);
    font-size: 14px;
}

.stat-box.success h4 { color: var(--success); }
.stat-box.warning h4 { color: var(--warning); }
.stat-box.danger h4 { color: var(--danger); }

/* API Key Box */
.api-key-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 15px;
    font-family: monospace;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    padding: 40px;
}

/* Markdown Docs */
.markdown-body {
    color: var(--text-main);
    line-height: 1.6;
}

.markdown-body h2 { margin: 25px 0 15px; border-bottom: 1px solid var(--glass-border); padding-bottom: 10px; }
.markdown-body h3 { margin: 20px 0 10px; color: var(--primary); }
.markdown-body p { margin-bottom: 15px; }
.markdown-body code { background: rgba(0, 0, 0, 0.3); padding: 2px 6px; border-radius: 4px; font-family: monospace; }
.markdown-body pre { background: rgba(0, 0, 0, 0.3); padding: 15px; border-radius: 8px; overflow-x: auto; margin-bottom: 20px; }
.markdown-body pre code { background: none; padding: 0; }

.error-msg {
    color: var(--danger);
    margin-top: 15px;
    font-size: 14px;
}

.loader {
    border: 3px solid rgba(255,255,255,0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
