/* public/css/style.css */
:root {
    --bg-color: #f0f2f5;
    --board-bg: #ffffff;
    --note-bg: #ffc;
    --text-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.15);
    --border-color: #e0e0e0;
    --grid-size: 25px; /* Define grid size as a variable */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

header {
    background-color: #fff;
    padding: 0.5rem 1rem;
    text-align: center;
    box-shadow: 0 1px 3px var(--shadow-color);
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
}

#canvas-viewport {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    cursor: grab;
    background-color: var(--board-bg);
}

/* Create the grid background on the viewport's pseudo-element */
#canvas-viewport::before {
    content: '';
    position: absolute;
    /* Make it huge to cover any zoom/pan */
    left: -10000px;
    top: -10000px;
    width: 20000px;
    height: 20000px;
    background-image:
        linear-gradient(rgba(0,0,0,0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.08) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
    /* This transform will be controlled by JS to move the background */
    transform: var(--board-transform, translate(0px, 0px) scale(1));
    z-index: -1;
}

/* This is our new (0,0) origin point. We pan/zoom by transforming this element. */
#canvas-origin {
    position: absolute;
    /* This is critical for the transform to work correctly */
    transform-origin: 0 0;
}

.board-item {
    position: absolute;
    /* Position the center of the item at its coordinates */
    transform: translate(-50%, -50%);
    /* Use left/top to place it on the canvas-origin */
    left: var(--x, 0px);
    top: var(--y, 0px);
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 4px 8px var(--shadow-color);
    min-width: 180px;
    word-wrap: break-word;
    white-space: pre-wrap;
    cursor: move;
    font-size: 16px;
    line-height: 1.4;
    user-select: none;
    transition: box-shadow 0.2s ease-in-out, transform 0.1s linear;
}

.board-item.dragging {
    box-shadow: 0 10px 20px rgba(0,0,0,0.25);
    z-index: 1000;
}

.board-action {
    user-select: none;;
}
/* Specific styles for different item types */
.board-item.note-item {
    background-color: var(--note-bg);
    border: 1px solid #e8d789;
    min-height: 50px;
}

.board-item.image-item {
    padding: 0;
    background-color: #fff;
    min-width: auto;
    overflow: hidden;
}

.board-item.image-item img {
    display: block;
    max-width: 300px;
    max-height: 300px;
    width: auto;
    height: auto;
}

.board-item.document-item {
    background-color: #e9f5ff;
    border: 1px solid #b3d7f0;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.board-item.document-item a {
    text-decoration: none;
    color: #0056b3;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.board-item.document-item a:hover {
    text-decoration: underline;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background-color: #fff;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 10px var(--shadow-color);
    border-radius: 5px;
    z-index: 2000;
    padding: 5px 0;
    min-width: 150px;
}

.context-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.context-menu li {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 0.9em;
}

.context-menu li:hover {
    background-color: var(--bg-color);
}

.note-item.editing {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5), 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: text;
}

/* --- NEW: UPLOAD PROGRESS STYLES --- */
#upload-progress-overlay {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 1rem;
    border-radius: 8px;
    z-index: 3000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    width: 300px;
    box-sizing: border-box;
}

.progress-container {
    width: 100%;
}

.progress-text {
    font-size: 0.9em;
    margin-bottom: 8px;
    text-align: center;
    user-select: none;
    -webkit-user-select: none; 
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background-color: #555;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: #4CAF50;
    border-radius: 5px;
    transition: width 0.1s ease-out;
}