:root {
    --primary: #4285f4;
    --secondary: #34a853;
    --danger: #ea4335;
    --warning: #fbbc05;
    --dark: #24292e;
    --light: #f6f8fa;
    --border: #e1e4e8;
    --text: #24292e;
    --text-light: #586069;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text);
    background: var(--light);
}

/* ========================================
   Auth Page
   ======================================== */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 100%;
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-logo p {
    color: var(--text-light);
    font-size: 0.9em;
}

.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

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

.oauth-btn.google {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}

.oauth-btn.github {
    background: #24292e;
}

.oauth-btn.facebook {
    background: #1877f2;
}

.oauth-btn.email {
    background: #6c757d;
}

.divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border);
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.divider span {
    background: white;
    padding: 0 10px;
    color: var(--text-light);
    font-size: 12px;
}

.email-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.email-form input {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

.email-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-primary {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #3367d6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.signup-link {
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    margin-top: 10px;
}

.signup-link a {
    color: var(--primary);
    text-decoration: none;
}

/* ========================================
   App Page
   ======================================== */
.navbar {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-brand {
    font-size: 1.5em;
    font-weight: bold;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.btn-logout {
    padding: 8px 16px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-logout:hover {
    background: #d33828;
}

.main-container {
    display: flex;
    height: calc(100vh - 62px);
}

.sidebar {
    width: 280px;
    background: white;
    padding: 20px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.sidebar h3 {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 15px;
    margin-top: 25px;
}

.sidebar h3:first-child {
    margin-top: 0;
}

.status-box,
.metrics-box {
    background: var(--light);
    padding: 15px;
    border-radius: 6px;
}

.status-item,
.metric-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.status-item:last-child,
.metric-item:last-child {
    border-bottom: none;
}

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

.status-badge.connected {
    background: var(--secondary);
    color: white;
}

.status-badge.disconnected {
    background: var(--danger);
    color: white;
}

.content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.canvas-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    min-height: 400px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.spinner {
    border: 4px solid var(--light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.telemetry-log {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.telemetry-log h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.btn-small {
    padding: 4px 12px;
    font-size: 12px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
}

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

.log-container {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    max-height: 300px;
    overflow-y: auto;
}

.log-entry {
    padding: 4px 0;
    border-bottom: 1px solid #333;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-timestamp {
    color: #608b4e;
}

.log-data {
    color: #ce9178;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}