:root {
    --sidebar-width: 100px;
    --sidebar-bg: #2c3e50;
    --main-bg: #f3f4f6;
    --accent-color: #e53e3e;
    --text-color: #e2e8f0;
    --hover-bg: #4a5568;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--main-bg);
    display: flex;
    color: #1a202c;
    overflow: hidden;
}

.hidden { display: none !important; }

body.draw-cursor {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path></svg>') 0 24, crosshair;
}
body.eraser-cursor {
    cursor: crosshair;
}

.loader-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); display: flex; flex-direction: column;
    justify-content: center; align-items: center; z-index: 100;
    color: white;
}
.loader-spinner {
    border: 5px solid #f3f3f3; border-top: 5px solid var(--accent-color);
    border-radius: 50%; width: 50px; height: 50px;
    animation: spin 1s linear infinite; margin-bottom: 1rem;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.sidebar {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: var(--sidebar-width); 
    height: 100vh;
    background-color: var(--sidebar-bg); 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    padding-top: 1rem; 
    z-index: 50;
    overflow-y: auto;
}

.tool-group {
    width: 100%;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--hover-bg);
}
.tool-group:last-child { border-bottom: none; }

.sidebar-button {
    background: none; border: 2px solid transparent; color: var(--text-color);
    font-size: 1.8rem; cursor: pointer; border-radius: 12px;
    width: 54px; height: 54px; display: flex; justify-content: center;
    align-items: center; margin: 0.5rem auto; transition: all 0.2s ease;
}
.sidebar-button:hover { background-color: var(--hover-bg); }
.sidebar-button.active {
    background-color: var(--accent-color);
    border-color: rgba(255, 255, 255, 0.5);
}

#file-upload { display: none; }

.draw-tools-submenu {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}
.draw-tools-submenu input[type="color"] {
    width: 40px; height: 40px; border: 2px solid var(--text-color);
    border-radius: 50%; padding: 0; cursor: pointer; background: transparent;
}
.brush-size-container {
    color: var(--text-color); font-size: 0.8rem; text-align: center;
}
.brush-size-container input { width: 80%; }

.tool-label {
    color: var(--text-color);
    text-align: center;
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}
.sidebar-select {
    width: 80%;
    margin: 0 auto;
    display: block;
    background-color: var(--hover-bg);
    color: var(--text-color);
    border: 1px solid var(--text-color);
    border-radius: 5px;
    padding: 5px;
    font-size: 0.9rem;
    cursor: pointer;
}
.sidebar-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

#main-content {
    width: calc(100vw - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    height: 100vh;
    overflow-y: auto;
    text-align: center;
    padding: 2rem;
    box-sizing: border-box;
}
#start-message {
    margin-top: 20vh;
    color: #718096;
}
#pdf-viewer {
    transform-origin: top center;
    transition: transform 0.2s ease-in-out;
}
.page-container {
    position: relative;
    margin: 0 auto 1rem auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.pdf-canvas, .drawing-canvas {
    display: block;
    width: 100%;
    border-radius: 5px;
}
.drawing-canvas { position: absolute; top: 0; left: 0; }