:root {
    --bg-color: #f8fafc;
    --grid-color: #e2e8f0;
    --primary: #6366f1;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --sidebar-bg: rgba(255, 255, 255, 0.9);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --note-yellow: #fef3c7;
    --note-green: #d1fae5;
    --note-blue: #dbeafe;
    --note-purple: #f3e8ff;
    --note-pink: #fee2e2;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Header */
.main-header {
    height: 60px;
    background: white;
    border-bottom: 1px solid var(--grid-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
}

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

.logo {
    color: var(--primary);
    display: flex;
    align-items: center;
}

#document-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: text;
}

#document-title:hover {
    background: #f1f5f9;
}

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

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-size: cover;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.9rem;
    border: none;
    transition: all 0.2s;
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

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

.btn-primary:hover {
    background: #4f46e5;
}

/* Sidebar */
.sidebar {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--grid-color);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 90;
}

.tool-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

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

.divider {
    height: 1px;
    background: var(--grid-color);
    margin: 4px 0;
}

.color-palette {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

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

.color-swatch.active {
    border-color: var(--primary);
}

/* Canvas */
.canvas-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: crosshair;
}

.canvas {
    width: 5000px;
    height: 5000px;
    background-color: var(--bg-color);
    background-image: radial-gradient(var(--grid-color) 1px, transparent 1px);
    background-size: 30px 30px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    transform-origin: center;
}

/* Sticky Note Styles */
.sticky-note {
    position: absolute;
    width: 200px;
    min-height: 200px;
    padding: 16px;
    border-radius: 2px;
    box-shadow: 0 10px 15px -10px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    cursor: move;
    display: flex;
    flex-direction: column;
    font-family: inherit;
    transition: box-shadow 0.2s, transform 0.1s;
    user-select: none;
}

.sticky-note:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.sticky-note.dragging {
    opacity: 0.8;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1000 !important;
}

.sticky-note-content {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    color: #4b5563;
    outline: none;
    padding: 0;
}

.sticky-note-footer {
    font-size: 0.7rem;
    color: rgba(0, 0, 0, 0.3);
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.delete-note {
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.2s;
    background: none;
    border: none;
    color: rgba(0, 0, 0, 0.3);
}

.sticky-note:hover .delete-note {
    opacity: 1;
}

.delete-note:hover {
    color: #ef4444;
}

/* Resizer handle */
.resizer {
    width: 12px;
    height: 12px;
    position: absolute;
    right: 0;
    bottom: 0;
    cursor: nwse-resize;
    background: transparent;
    z-index: 10;
}

.sticky-note:hover .resizer::after {
    content: '';
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 4px;
    height: 4px;
    border-right: 2px solid rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid rgba(0, 0, 0, 0.2);
}

/* Footer Controls */
.footer-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    z-index: 100;
}

.history-controls,
.zoom-controls {
    background: white;
    padding: 6px 12px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--grid-color);
}

.footer-controls button {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-muted);
    transition: all 0.2s;
}

.history-controls button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.footer-controls button:hover:not(:disabled) {
    background: #f1f5f9;
    color: var(--text-main);
}

#zoom-level {
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 45px;
    text-align: center;
}