/* Whiteboard Application Styles */

body {
    margin: 0;
    overflow: hidden; /* Prevent body scroll */
}

#whiteboard-app {
    display: flex;
    height: 100vh;
    width: 100vw;
    background-color: #f5f5f5;
    font-family: 'Inter', sans-serif;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    z-index: 10;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.whiteboard-list {
    flex: 1;
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
}

.whiteboard-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.whiteboard-item:hover {
    background: #f9f9f9;
}

.whiteboard-item.active {
    background: #e8f5e9;
    border-left: 4px solid #4CAF50;
    padding-left: 16px;
}

.whiteboard-name {
    font-weight: 500;
    color: #444;
}

.delete-whiteboard-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.whiteboard-item:hover .delete-whiteboard-btn {
    opacity: 1;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #eee;
}

.w-100 {
    width: 100%;
}

/* Workspace */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.workspace-header {
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    z-index: 5;
}

.workspace-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: #333;
}

.workspace-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.game-mode-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.whiteboard-area {
    flex: 1;
    position: relative;
    background-color: #fafafa;
    overflow: hidden; /* could use overflow: auto if panning is implemented */
}

.whiteboard-area.has-board {
    background-image: radial-gradient(#d0d0d0 1px, transparent 1px);
    background-size: 20px 20px;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #888;
    font-size: 1.2rem;
    pointer-events: none;
}

/* Whiteboard Notes */
.wb-note {
    position: absolute;
    background-image: url('images/note-bg.png');
    background-repeat: no-repeat;
    background-size: cover;
    border-radius: 0;
    padding: 1.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(0, 0, 0, 0.1);
    cursor: grab;
    user-select: none;
    transition: box-shadow 0.2s;
    min-width: 180px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

.wb-note:active {
    cursor: grabbing;
    box-shadow: 4px 8px 16px rgba(0,0,0,0.2);
    z-index: 1000 !important;
}

.wb-note:hover:not(.expanded):not(.hover-active) {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.wb-note.hover-active {
    height: auto !important;
    min-height: 120px;
    z-index: 2147483647 !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25), 0 3px 8px rgba(0, 0, 0, 0.2);
}

.wb-note.hover-active.large-note {
    min-height: 200px;
}

.wb-note.hover-active .wb-note-content {
    overflow: visible;
}

.wb-note.hover-active .wb-note-content::after {
    display: none;
}

.wb-note.normal-note {
    width: 180px;
    height: 120px;
}

.wb-note.large-note {
    width: 270px;
    height: 200px;
}

.wb-note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 5px;
}

.wb-note-title {
    font-weight: bold;
    font-size: 1.1rem;
    margin: 0;
    word-break: break-word;
}

/* Action Zones positioning inside workspace */
.workspace > .completion-zone,
.workspace > .delete-zone {
    position: absolute;
}

/* Selection Box for Multi-Select */
.selection-box {
    position: fixed;
    border: 1px solid #007bff;
    background-color: rgba(0, 123, 255, 0.2);
    z-index: 9999;
    pointer-events: none;
}

/* Normal Note Specific Adjustments */
.wb-note.normal-note .wb-note-header {
    position: absolute;
    top: 10px;
    right: 10px;
    margin: 0;
    padding: 0;
    border: none;
    width: auto;
}

.wb-note.normal-note .wb-note-title {
    display: none;
}

.wb-note-controls {
    display: flex;
    gap: 5px;
}

.wb-note-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(0,0,0,0.5);
    padding: 2px;
}

.wb-note-btn:hover {
    color: rgba(0,0,0,0.8);
}

.wb-note-content {
    flex: 1;
    overflow: hidden;
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
    white-space: pre-wrap;
    position: relative;
}

.wb-note-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(transparent, rgba(255, 255, 255, 0.8));
    pointer-events: none;
}

.wb-note.expanded {
    height: auto !important;
    min-height: 120px;
    z-index: 2147483647 !important;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28), 0 4px 10px rgba(0, 0, 0, 0.22);
}

.wb-note.expanded.large-note {
    min-height: 200px;
}

.wb-note.expanded .wb-note-content {
    overflow: visible;
}

.wb-note.expanded .wb-note-content::after {
    display: none;
}

/* Rotation Handle */
.wb-rotation-handle {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: #fff;
    border: 2px solid #333;
    border-radius: 50%;
    cursor: crosshair;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.wb-rotation-handle::after {
    content: '';
    position: absolute;
    bottom: -10px;
    width: 2px;
    height: 10px;
    background: #333;
}

.wb-rotation-handle i {
    font-size: 10px;
    color: #333;
}

.wb-note:hover .wb-rotation-handle {
    opacity: 1;
}

/* Text Note (Handwriting) */
.wb-note.text-note {
    background: transparent !important;
    box-shadow: none !important;
    border: none;
    min-width: 50px;
    min-height: 30px;
    font-family: 'Caveat', cursive;
    font-size: 2rem;
    color: #333;
    padding: 10px;
    cursor: grab;
}

.wb-note.text-note .wb-rotation-handle {
    /* Handle is now visible for text notes */
}

.wb-note.text-note .wb-note-header {
    position: absolute;
    top: -15px;
    right: -15px;
    border: none;
    padding: 0;
    margin: 0;
    opacity: 0;
    transition: opacity 0.2s;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.wb-note.text-note:hover .wb-note-header {
    opacity: 1;
}

.wb-note.text-note .wb-note-title {
    display: none;
}



.wb-note.text-note .wb-note-content {
    font-family: 'Caveat', cursive;
    font-size: 2.2rem;
    overflow: visible;
    white-space: pre;
    text-align: center;
}

/* Template Dropdown Styles */
.template-dropdown {
    position: relative;
    display: inline-block;
}

.template-dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1000;
    border-radius: 8px;
    overflow: hidden;
    top: 100%;
    left: 0;
    margin-top: 0.25rem;
}

.template-dropdown-content button {
    width: 100%;
    border-radius: 0;
    border: none;
    background: #f9f9f9;
    color: #333;
    padding: 0.75rem 1rem;
    text-align: left;
    transition: background-color 0.2s;
    cursor: pointer;
}

.template-dropdown-content button:hover:not(:disabled) {
    background-color: #e0e0e0;
}

.template-dropdown-content button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Show dropdown on hover */
.template-dropdown:hover .template-dropdown-content {
    display: block;
}

/* Links inside whiteboard notes */
.wb-note-content a {
    color: #0066cc;
    text-decoration: underline;
    word-break: break-all;
    cursor: pointer;
}

.wb-note-content a:hover {
    color: #004499;
    text-decoration: none;
}

/* Editing cursor for text notes */
.text-note .wb-note-content[contenteditable="true"] {
    cursor: text;
    outline: 2px dashed rgba(0,120,255,0.4);
    border-radius: 3px;
    min-width: 50px;
    min-height: 20px;
}
