@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

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

.board-body {
    background: #000 !important;
    overflow: hidden;
    width: 1920px;
    height: 1080px;
    font-family: 'Poppins', Arial, sans-serif;
}

/* WRAPPER fisso 1920x1080 con background template */
#board-wrapper {
    width: 1920px;
    height: 1080px;
    position: relative;
    overflow: hidden;
}

#board-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 1920px;
    height: 1080px;
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

/* OVERLAY PATIENT FIELDS - posizioni assolute sul template */
.overlay-field {
    position: absolute;
    left: 135px;
    width: 230px;
    height: 24px;
    z-index: 5;
    border: none;
    background: transparent;
    font: 400 14px 'Poppins', Arial, sans-serif;
    color: #333;
    outline: none;
    padding: 2px 4px;
}

.overlay-field:focus {
    background: rgba(255, 255, 255, 0.8);
}

#patient-age {
    top: 407px;
}

#patient-gender {
    top: 440px;
}

#patient-weight {
    top: 477px;
}

#patient-height {
    top: 507px;
}

.overlay-textarea {
    position: absolute;
    z-index: 5;
    left: 32px;
    width: 353px;
    font: 400 13px/1.4 'Poppins', Arial, sans-serif;
    color: #333;
    outline: none;
    overflow-y: auto;
    padding: 4px 6px;
    background: transparent;
}

.overlay-textarea:focus {
    background: rgba(255, 255, 255, 0.8);
}

#patient-symptoms {
    top: 604px;
    height: 177px;
}

#patient-therapy {
    top: 829px;
    height: 111px;
}

/* AREA CANVAS (post-it + paint) - a destra della sidebar */
#board-canvas {
    position: absolute;
    left: 325px;
    top: 100px;
    width: 1595px;
    height: 900px;
    z-index: 5;
    overflow: hidden;
}

#paint-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

#paint-canvas.active {
    pointer-events: auto;
    cursor: crosshair;
}

.erase-mode #paint-canvas.active {
    cursor: cell;
}

#postit-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
}

/* POST-IT */
.postit {
    position: absolute;
    cursor: grab;
    user-select: none;
    min-width: 100px;
    min-height: 100px;
}

.postit:active {
    cursor: grabbing;
}

.postit .postit-bg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.postit .postit-text {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    padding: 18px 12px 12px;
    font-size: 14px;
    line-height: 1.3;
    color: #333;
    overflow: hidden;
    outline: none;
    word-wrap: break-word;
}

.postit .postit-delete {
    position: absolute;
    top: 2px;
    right: 6px;
    z-index: 3;
    font-size: 18px;
    color: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    display: none;
}

.postit:hover .postit-delete {
    display: block;
}

.postit .postit-delete:hover {
    color: #c00;
}

.postit .postit-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    cursor: nwse-resize;
    z-index: 3;
    opacity: 0;
}

.postit:hover .postit-resize {
    opacity: 1;
    background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.2) 50%);
}

/* TOOLBAR BUTTONS - trasparenti sopra la barra del template */
.toolbar-btn {
    position: absolute;
    bottom: 0;
    width: 66px;
    height: 91px;
    z-index: 10;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.toolbar-btn.active {
    background: rgba(255, 255, 255, 0.25);
    outline: 2px solid rgba(255, 255, 255, 0.5);
}

/* TEXT COLOR PALETTE */
.fmt-colors {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ccc;
    transition: transform 0.1s;
}

.color-dot:hover {
    transform: scale(1.2);
}

.color-dot.selected {
    border-color: #1a3a5c;
    box-shadow: 0 0 4px rgba(0,0,0,0.4);
    transform: scale(1.15);
}

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 550px;
    width: 90%;
}

.modal-box h3 {
    margin-bottom: 12px;
    color: #1a3a5c;
    font-size: 18px;
}

.modal-close {
    margin-top: 12px;
    padding: 6px 16px;
    background: #c00;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.modal-close:hover {
    background: #a00;
}

/* POST-IT PICKER */
.picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.picker-item {
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.15s;
    border: 3px solid transparent;
}

.picker-item:hover {
    transform: scale(1.06);
    border-color: #2196F3;
}

.picker-item img {
    width: 100%;
    display: block;
}

/* TEXT FORMAT TOOLBAR */
#text-format {
    position: absolute;
    top: 50px;
    left: 325px;
    z-index: 50;
    background: rgba(30,30,30,0.92);
    border-radius: 8px;
    padding: 6px 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

#text-format .fmt-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

#text-format select {
    padding: 2px 4px;
    font-size: 12px;
    border: 1px solid #555;
    border-radius: 3px;
    background: #fff;
    height: 28px;
}

.fmt-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #555;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}

.fmt-btn:hover {
    background: #e8e8e8;
}

.fmt-btn.active {
    background: #1a3a5c;
    color: #fff;
    border-color: #1a3a5c;
}

.fmt-close {
    color: #c00;
    font-size: 16px;
    font-weight: bold;
}

.fmt-sep {
    width: 1px;
    height: 22px;
    background: rgba(255,255,255,0.3);
}

/* LOCKED */
#board-wrapper.locked #board-canvas,
#board-wrapper.locked .overlay-field,
#board-wrapper.locked .overlay-textarea {
    pointer-events: none;
    opacity: 0.7;
}

#board-wrapper.locked .toolbar-btn {
    pointer-events: none;
    opacity: 0.3;
}

/* ERASE MODE */
#board-canvas.erase-mode .postit {
    cursor: pointer;
}

/* BOARD LIST OVERVIEW */
.boardlist-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

.boardlist-header {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 20px;
}

.boardlist-title {
    color: #fff;
    text-align: center;
    font-weight: 700;
    font-size: 32px;
    margin: 20px 0 30px;
    letter-spacing: 1px;
}

.boardlist-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.boardlist-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: linear-gradient(145deg, #2c5f8a, #1e4870);
    color: #fff;
    padding: 30px 15px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    border: 2px solid rgba(255,255,255,0.15);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    min-height: 130px;
    text-align: center;
}

.boardlist-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
    border-color: #f5a623;
    color: #fff;
}

.boardlist-btn-code {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.boardlist-btn-topic {
    font-size: 13px;
    opacity: 0.85;
    font-weight: 400;
}

.boardlist-btn.demo {
    background: linear-gradient(145deg, #f5a623, #d48806);
    grid-column: 1 / -1;
    min-height: 90px;
}

.boardlist-btn.demo .boardlist-btn-code {
    font-size: 22px;
}

@media (max-width: 1100px) {
    .boardlist-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
    .boardlist-grid { grid-template-columns: repeat(2, 1fr); }
}

#board-canvas.erase-mode .postit:hover {
    outline: 3px solid #c00;
}