/* Reset and basic setup */
* {
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    /* overflow: hidden; Removed to allow scrolling */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body.noscroll {
    overflow: hidden;
}

/* The corkboard background */
#board {
    width: 4000px;
    /* Huge canvas */
    height: 4000px;
    position: relative;
    /* ... texture ... */
    background-color: #d4a373;
    /* Create a repeating cork pattern using CSS gradients if no image is available, 
       but for "rich aesthetics" a real texture would be better. 
       We will simulate a high quality texture with noise and colors. */
    background-image:
        radial-gradient(hsla(34, 50%, 40%, 0.1) 2px, transparent 2.5px),
        radial-gradient(hsla(34, 50%, 30%, 0.1) 2px, transparent 2.5px);
    background-size: 30px 30px, 20px 20px;
    background-position: 0 0, 15px 15px;
    position: relative;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.5);
    /* Vignette effect */
}

/* Draggable Items */
.item {
    position: absolute;
    padding: 10px 10px 30px 10px;
    /* Polaroid style padding (more at bottom) */
    background: #fdfdfd;
    box-shadow: 2px 5px 15px rgba(0, 0, 0, 0.4);
    cursor: grab;
    transition: transform 0.1s;
    max-width: 250px;
    user-select: none;
    touch-action: none;
    /* Prevents browser scrolling/zooming when touching item */
}

.item:active {
    cursor: grabbing;
    transform: scale(1.02);
    box-shadow: 5px 10px 20px rgba(0, 0, 0, 0.5);
}

.item img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
    /* Prevent browser image drag behavior */
}

/* Pin graphic (optional css pin) */
.pin {
    position: absolute;
    top: -10px;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-left: -10px;
    background: radial-gradient(circle at 30% 30%, #ff5e5e, #aa0000);
    border-radius: 50%;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

/* Controls UI */
#controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#trash {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 20px;
    font-size: 40px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    user-select: none;
}

#trash.hover {
    transform: scale(1.2);
    background: rgba(255, 100, 100, 0.9);
}


#controls h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #333;
}

/* Custom file input styling */
.upload-btn-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.btn {
    border: 2px solid gray;
    color: gray;
    background-color: white;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: all 0.2s;
}

.btn:hover {
    background: #f0f0f0;
    color: #333;
    border-color: #333;
}

.upload-btn-wrapper input[type=file] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

/* Loading indicator */
#loading {
    display: none;
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* Lightbox */
#lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 20000;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
    backdrop-filter: blur(5px);
}

#lightbox img {
    max-width: 90%;
    max-height: 90%;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    border: 5px solid white;
    cursor: default;
    /* transition: transform 0.1s; */
    /* Can cause jitter in custom pan/zoom implementation */
}

#timestamp {
    position: absolute;
    bottom: 20px;
    color: white;
    font-size: 16px;
    text-shadow: 0 1px 3px black;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 15px;
    padding: 5px 15px;
    border-radius: 20px;
    pointer-events: none;
}

/* PDF Support */
#pdfWrapper {
    display: none;
    width: 90%;
    height: 90%;
    background: white;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    -webkit-overflow-scrolling: touch;
    /* iPad fix */
    overflow-y: auto;
    position: relative;
    /* Context for children if needed */
}

#pdfFrame {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
}

.pdf-card {
    width: 150px;
    height: 200px;
    background: #fff;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 50px;
    color: #cc0000;
    /* PDF red */
    overflow: hidden;
    position: relative;
    text-align: center;
}

.pdf-label {
    font-size: 14px;
    color: #333;
    padding: 10px;
    word-break: break-word;
    /* Wrap long names */
    max-height: 60px;
    overflow: hidden;
    line-height: 1.2;
}

#openBtn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    color: #333;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    z-index: 20001;
    /* Above lightbox z-index 20000 */
    display: none;
}