:root {
    --primary: #78132a;
    --accent: #00b0f0;
    --hex-width: 120px; 
    --hex-height: 138.56px; 
    --sidebar-width: 320px; 
    --gap: 4px;
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #f0f2f5;
    user-select: none; 
    -webkit-user-select: none;
    overscroll-behavior: none;
}

/* --- Sidebar Logic (Mobile/Desktop) --- */
.sidebar {
    width: var(--sidebar-width);
    padding: 20px;
    background: white;
    box-shadow: 2px 0 15px rgba(0,0,0,0.1);
    z-index: 500;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #ddd;
    overflow-y: auto;
    transition: transform 0.3s ease;
    transform: translateX(0);
}

.menu-toggle {
    display: none;
    position: fixed; top: 10px; left: 10px;
    z-index: 1000;
    background: var(--primary); color: white;
    border: none; padding: 10px 15px; border-radius: 50px; font-size: 1rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2); cursor: pointer;
}

.sidebar-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 400; backdrop-filter: blur(2px);
}

.close-sidebar-btn {
    display: none; background: #ddd; border: none;
    padding: 8px; border-radius: 4px; margin-bottom: 15px;
    color: #333; font-weight: bold;
}

/* --- Buttons & Inputs --- */
h3 { color: var(--primary); margin: 10px 0 10px 0; border-bottom: 2px solid #eee; padding-bottom:5px;}

.single-add-box {
    background: #fce4ec; padding: 15px; border-radius: 8px; margin-bottom: 20px;
}
.single-add-box input {
    width: 100%; padding: 12px; box-sizing: border-box;
    border: 1px solid #f48fb1; border-radius: 6px; margin-bottom: 8px; font-size: 16px;
}

.input-area {
    width: 100%; height: 300px; min-height: 200px; padding: 15px; margin-bottom: 10px;
    border: 2px solid #bbb; border-radius: 8px; font-family: inherit;
    box-sizing: border-box; font-size: 16px; line-height: 1.5; background: #fafafa;
}
.input-area:focus { background: white; border-color: var(--primary); outline: none; }

.btn {
    width: 100%; padding: 14px; margin-bottom: 8px; border: none;
    border-radius: 8px; cursor: pointer; color: white;
    font-size: 1rem; font-weight: bold; transition: 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); }
.btn-success { background: #4CAF50; }
.btn-danger { background: #f44336; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.divider { width: 100%; opacity: 0.3; margin: 20px 0; border: 0; border-top: 1px solid #000;}
.style-row { display: flex; gap: 10px; align-items: center; margin-bottom: 15px; font-size: 1rem; font-weight: bold; }
input[type="color"] { border: none; width: 50px; height: 40px; cursor: pointer; background: none;}

/* Footer */
.sidebar-footer { margin-top: 30px; padding-top: 20px; border-top: 2px solid #eee; text-align: center; }
.footer-logo { max-width: 70%; height: auto; margin-bottom: 10px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1)); }
.copyright-text { font-size: 0.85rem; color: #555; line-height: 1.5; }
.copy-symbol { font-size: 0.75rem; color: #999; display: block; margin-top:5px;}
.info-box { margin-top: 20px; background: #fff3e0; border: 1px solid #ffb74d; padding: 15px; border-radius: 8px; font-size: 0.9rem; color: #333; line-height: 1.6; }

/* --- Canvas --- */
.canvas-container {
    flex: 1; position: relative;
    background-image: radial-gradient(#b0bec5 1.5px, transparent 1.5px);
    background-size: 30px 30px; background-color: #fafafa;
    overflow: auto; cursor: grab; touch-action: pan-x pan-y;
}
.canvas-container:active { cursor: grabbing; }

/* --- HEXAGON --- */
.hexagon {
    width: var(--hex-width); height: var(--hex-height); position: absolute;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--primary);
    display: flex; align-items: center; justify-content: center; text-align: center;
    color: white; cursor: move;
    transition: transform 0.2s; filter: drop-shadow(0px 3px 3px rgba(0,0,0,0.2));
    z-index: 10; touch-action: none; -webkit-tap-highlight-color: transparent;
}
.hex-inner { width: 70%; pointer-events: none; line-height: 1.3; font-size: inherit; word-wrap: break-word; }
.hexagon:hover { z-index: 999 !important; transform: scale(1.05); }
.hexagon.dragging { z-index: 1000; opacity: 0.8; box-shadow: 0 15px 30px rgba(0,0,0,0.4); }
.delete-btn {
    position: absolute; top: 15px; right: 50%; transform: translateX(50%);
    width: 24px; height: 24px; background: rgba(255,0,0,0.8); color: white;
    border-radius: 50%; font-size: 16px; display: none;
    align-items: center; justify-content: center;
    cursor: pointer; z-index: 1001; line-height: 1;
}
.hexagon:hover .delete-btn { display: flex; }
.sticky {
    position: absolute; width: 160px; background: #fff59d; padding: 10px;
    border-radius: 4px; box-shadow: 3px 3px 8px rgba(0,0,0,0.1); z-index: 50;
    border: 1px solid #fbc02d; touch-action: none;
}
.sticky-head { font-size: 12px; color: #888; cursor: move; display: flex; justify-content: space-between; padding-bottom:5px; margin-bottom:5px; border-bottom:1px solid rgba(0,0,0,0.1);}
.close-stick { font-size: 16px; color: red; padding: 0 5px; }

/* MEDIA QUERIES FOR DEVICES */
@media (max-width: 1024px) {
    .menu-toggle { display: block; }
    .sidebar { position: fixed; right: 0; top: 0; bottom: 0; width: 85%; max-width: 350px; transform: translateX(100%); }
    .sidebar.active { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    .close-sidebar-btn { display: block; }
    .canvas-container { width: 100%; }
    .delete-btn { display: flex; opacity: 0.7; }
}

/* =================================== */
/*         OPTIMIZED PRINT CSS         */
/* =================================== */
@media print {
    @page {
        size: landscape; /* Landscape for broader view */
        margin: 0.5cm;
    }
    
    body, html {
        height: auto;
        width: 100%;
        overflow: visible !important;
        margin: 0; padding: 0;
        background: white !important;
    }

    /* Hide UI Elements */
    .sidebar, .menu-toggle, #overlay { display: none !important; }
    .delete-btn, .close-stick { display: none !important; }

    /* Optimize Canvas for Paper */
    .canvas-container {
        position: static; /* Remove scrolling constraint */
        width: 100%;
        height: auto;
        overflow: visible !important;
        background: none !important; /* No gray grid */
        margin: 0;
        padding: 0;
    }

    .hexagon {
        /* Force background colors to print */
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        /* Break inside logic to avoid cutting hexes in half on multipage */
        break-inside: avoid;
        box-shadow: none; /* Clean look */
        border: 1px solid #999; /* Definition for light colors */
    }

    .sticky {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border: 1px solid #ccc;
        box-shadow: none;
    }
}