:root {
    --bg-grad-1: #0f172a;
    --bg-grad-2: #1e1b4b;
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    background: linear-gradient(135deg, var(--bg-grad-1), var(--bg-grad-2));
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.view {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.view.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    flex: 1;
}

#login-view {
    align-items: center;
    justify-content: center;
}

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

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

.gradient-text {
    background: linear-gradient(to right, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h1 { margin-bottom: 0.5rem; font-weight: 700; }
h2 { font-weight: 600; }
h3 { margin-bottom: 1.5rem; font-weight: 600; color: #e2e8f0; border-bottom: 1px solid var(--glass-border); padding-bottom: 0.5rem; }
p { color: var(--text-muted); margin-bottom: 2rem; font-size: 0.95rem; }

input {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

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

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

.btn.primary { background: var(--primary); color: white; width: 100%; }
.btn.primary:hover { background: var(--primary-hover); }

.btn.secondary { background: transparent; border: 1px solid var(--glass-border); color: white; }
.btn.secondary:hover { background: rgba(255,255,255,0.1); }

.btn.danger { background: var(--danger); color: white; padding: 0.4rem 0.8rem; font-size: 0.85rem; width: auto; }
.btn.danger:hover { background: var(--danger-hover); }

.error-msg {
    color: #fca5a5;
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.2rem;
}

/* Dashboard */
.glass-header {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.stats { display: flex; gap: 1rem; }
.stat-box {
    background: rgba(0,0,0,0.3);
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}
.stat-box .label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.stat-box .value { font-size: 1.25rem; font-weight: 700; color: #a78bfa; margin-top: 0.2rem;}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.inline-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}
.inline-form input { margin-bottom: 0; }
.inline-form .btn { white-space: nowrap; width: auto; }

.table-container {
    overflow-x: auto;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
}

.tokens-table {
    width: 100%;
    border-collapse: collapse;
}

.tokens-table th, .tokens-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.tokens-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255,255,255,0.02);
}

.tokens-table tr:hover {
    background: rgba(255,255,255,0.03);
}

.tokens-table td { font-size: 0.95rem; }
.tokens-table .token-col { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #cbd5e1; font-family: monospace; }

#schedule-list { list-style: none; margin-bottom: 1.5rem; }
#schedule-list li {
    padding: 0.75rem;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}
#schedule-list li:hover {
    border-color: rgba(139, 92, 246, 0.3);
}

.schedule-time { font-weight: 600; color: #e2e8f0; }
.schedule-interval { color: var(--primary); font-size: 0.85rem; font-weight: 600; background: rgba(139, 92, 246, 0.1); padding: 0.2rem 0.5rem; border-radius: 4px;}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .inline-form { flex-direction: column; }
    .inline-form .btn { width: 100%; }
}
