:root {
    --primary: #ec4899;
    --primary-dark: #db2777;
    --success: #10b981;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

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

html, body {
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    color: white;
}

.hidden { display: none !important; }

/* Share Button */
.share-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 100;
    transition: all 0.3s ease;
}

.share-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* Connection Status */
.connection-status {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--gray-800);
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 100;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
    animation: pulse 2s infinite;
}

.connection-status.connected .status-dot {
    background: var(--success);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
}

/* Header */
.app-header {
    background: rgba(0, 0, 0, 0.3);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

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

.header-left h1 {
    font-size: 24px;
    margin: 0;
}

.room-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
}

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

.grid-info, .user-count {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
}

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Toolbar */
.toolbar-left {
    width: 240px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    padding: 20px;
    overflow-y: auto;
}

.tool-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tool-section:last-child {
    border-bottom: none;
}

.tool-section h3 {
    font-size: 14px;
    margin-bottom: 12px;
    opacity: 0.8;
}

.tool-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tool-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 8px;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

/* Color Palette */
.color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: white;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
}

.color-picker-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.color-picker-custom input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.color-picker-custom label {
    font-size: 14px;
}

.current-color {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.color-display {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid white;
}

#currentColorHex {
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

/* Grid Size Select */
.grid-select {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
}

.grid-select option {
    background: var(--gray-900);
    color: white;
}

/* Action Buttons */
.action-btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.canvas-wrapper {
    position: relative;
    background: white;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    border-radius: 8px;
    overflow: hidden;
}

#pixelCanvas {
    display: block;
    cursor: crosshair;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Zoom Controls */
.zoom-controls {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.zoom-controls button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.zoom-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
}

#zoomLevel {
    font-size: 14px;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

/* Right Sidebar */
.sidebar-right {
    width: 220px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    padding: 20px;
    overflow-y: auto;
}

.users-panel h3 {
    font-size: 14px;
    margin-bottom: 12px;
    opacity: 0.8;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 14px;
}

.user-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid white;
}

/* Remote Cursors */
.remote-cursor {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
    transition: transform 0.1s ease-out;
}

.remote-cursor-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid white;
}

.remote-cursor-label {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }

    .toolbar-left {
        width: 100%;
        max-height: 30vh;
    }

    .sidebar-right {
        display: none;
    }

    .tool-section {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }
}

