:root {
    /* Light mode colors (OKLCH) */
    --background: oklch(1 0 0);
    --foreground: oklch(0.145 0 0);
    --primary: oklch(0.205 0 0);
    --secondary: oklch(0.97 0 0);
    --accent: oklch(0.97 0 0);
    --destructive: oklch(0.577 0.245 27.325);
    --border: oklch(0.922 0 0);
    --muted: oklch(0.97 0 0);
    --muted-foreground: oklch(0.466 0 0);
    --card: oklch(1 0 0);
    --popover: oklch(1 0 0);

    /* Border radius - Pocket ID system */
    --radius: 0.75rem;
    --radius-sm: calc(var(--radius) - 4px);
    --radius-md: calc(var(--radius) - 2px);
    --radius-lg: var(--radius);
    --radius-xl: calc(var(--radius) + 4px);
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark mode colors */
        --background: oklch(0.145 0 0);
        --foreground: oklch(0.985 0 0);
        --primary: oklch(0.922 0 0);
        --secondary: oklch(0.269 0 0);
        --accent: oklch(0.269 0 0);
        --destructive: oklch(0.704 0.191 22.216);
        --border: oklch(0.269 0 0);
        --muted: oklch(0.205 0 0);
        --muted-foreground: oklch(0.722 0 0);
        --card: oklch(0.145 0 0);
        --popover: oklch(0.145 0 0);
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: color 0.2s, background-color 0.2s;
}

.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
}

.logo img {
    height: 2rem;
    width: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--foreground);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--secondary);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--foreground);
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.container {
    background: var(--card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    max-width: 800px;
    width: 100%;
}

.title {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--foreground);
    font-weight: 600;
}

.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.server-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0;
    transition: all 0.2s;
    position: relative;
    background: var(--card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.server-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}


.server-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.server-icon {
    flex-shrink: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.server-icon img {
    width: 3rem;
    height: 3rem;
    object-fit: contain;
}

.server-info {
    flex: 1;
    min-width: 0;
}

.server-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foreground);
    word-wrap: break-word;
}

.server-description {
    color: var(--muted-foreground);
    font-size: 0.9rem;
    line-height: 1.4;
}

.server-connect-button {
    width: 100%;
    background: var(--primary);
    color: var(--background);
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0;
}

.server-connect-button:hover:not(:disabled) {
    background: var(--primary);
    opacity: 0.9;
}

.server-connect-button:disabled {
    background: var(--muted);
    color: var(--muted-foreground);
    opacity: 0.5;
    cursor: not-allowed;
}

.loading {
    display: none;
    text-align: center;
    margin-top: 1rem;
    color: var(--foreground);
    opacity: 0.7;
}

.error {
    background: color-mix(in oklch, var(--destructive) 10%, transparent);
    color: var(--destructive);
    border: 1px solid color-mix(in oklch, var(--destructive) 20%, transparent);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: none;
}

.success {
    background: color-mix(in oklch, var(--primary) 10%, transparent);
    color: var(--primary);
    border: 1px solid color-mix(in oklch, var(--primary) 20%, transparent);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: none;
    text-align: center;
}


.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

/* Responsive design */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .main {
        padding: 1rem;
    }

    .container {
        padding: 1.5rem;
    }

    .servers-grid {
        grid-template-columns: 1fr;
    }

    .logo {
        font-size: 1.2rem;
    }
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}