:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-width: 260px;
    --sidebar-collapsed: 60px;
    --header-height: 60px;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
}

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

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

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 28px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

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

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

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

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

.btn-block {
    width: 100%;
}

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--bg);
}

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

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

.divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider span {
    padding: 0 12px;
}

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

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--error);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .sidebar-footer {
    display: none;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.sidebar-title {
    font-size: 20px;
    font-weight: 600;
}

.sidebar-collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-muted);
    transition: transform 0.3s;
}

.sidebar.collapsed .sidebar-collapse-btn {
    transform: rotate(180deg);
}

.sidebar-nav {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 4px;
    border: none;
    background: none;
    width: 100%;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.nav-item:hover {
    background: var(--bg);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-section {
    margin-top: 24px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 16px;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-empty {
    font-size: 13px;
    color: var(--text-muted);
    padding: 12px 16px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.sidebar-version {
    font-size: 12px;
    color: var(--text-muted);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed);
}

.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 8px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-email {
    font-size: 14px;
    color: var(--text-muted);
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-user {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-admin {
    background: #fef3c7;
    color: #b45309;
}

.content-area {
    padding: 32px;
}

.content-area h1 {
    margin-bottom: 8px;
}

.content-area > p {
    color: var(--text-muted);
    margin-bottom: 32px;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.card-icon {
    width: 48px;
    height: 48px;
    background: var(--bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary);
    margin-bottom: 16px;
}

.card h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.card p {
    font-size: 14px;
    color: var(--text-muted);
}

.webhook-result {
    padding: 16px;
    border-radius: 8px;
    margin-top: 24px;
}

.webhook-result.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.webhook-result.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.webhook-btn {
    text-align: left;
}

.webhook-btn .badge {
    margin-left: auto;
    font-size: 9px;
    padding: 2px 6px;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .oauth-buttons {
        flex-direction: column;
    }
}
