/* --- Core Container for the Sticky Notes Module --- */
.sticky-notes-component-container {
    /* For Desktop: A horizontal container at the bottom */
    position: fixed;
    bottom: 0;
    left: 250px; /* Aligns with the end of the sidebar */
    width: calc(100vw - 250px); /* Spans the remaining width */
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Aligns items to the bottom */
}

/* --- Loader Overlay --- */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(26, 26, 26, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

.loader-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loader {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(240, 215, 136, 0.2);
    border-radius: 50%;
    border-top-color: #F0D788;
    animation: spin 1s linear infinite, glow 1.5s ease-in-out infinite alternate;
}

.loader-text {
    margin-top: 20px;
    color: #F0D788;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes glow {
    from { box-shadow: 0 0 5px #F0D788; }
    to { box-shadow: 0 0 20px #F0D788, 0 0 30px #F0D788; }
}

/* --- Sticky Notes Toggle Button (FAB) --- */
.sticky-notes-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #1a1a1a;
    color: #F0D788;
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease;
}

.sticky-notes-toggle-btn.active {
    transform: translateX(-50%) rotate(45deg);
}

.sticky-notes-toggle-btn:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.sticky-notes-toggle-btn:active {
    transform: translateX(-50%) translateY(0);
}

/* --- Sticky Notes Panel --- */
.sticky-notes-panel {
    position: fixed;
    bottom: 90px;
    left: 250px;
    width: calc(100vw - 250px);
    height: 450px; 
    background: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    transform: scale(0.8) translateY(10%);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
}

.sticky-notes-panel.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.sticky-notes-panel .panel-header {
    background: #3a3a3a;
    color: white;
    padding: 15px 20px;
    border-bottom: 1px solid #4a4a4a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Prevent header from shrinking */
}

.sticky-notes-panel .panel-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #F0D788;
}

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

.sync-btn {
    background: none;
    border: none;
    color: #F0D788;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.3s ease-in-out;
}

.sync-btn:hover { transform: scale(1.1); }
.sync-btn.syncing .sync-icon { animation: spin 1.5s linear infinite; }

.sync-status {
    font-size: 0.85rem;
    color: #f7f7f7;
}

/* Notes List Container */
.notes-list {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

/* Note Item Styling */
.note-item {
    background-color: #3a3a3a;
    border-left: 4px solid #F0D788;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    transition: transform 0.2s ease;
}

.note-item:hover { transform: translateY(-2px); }

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

.note-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #36454F;
}

.note-body {
    flex-grow: 1;
    overflow-y: auto;
    max-height: 200px; /* Prevent single note taking up too much space */
}

.todo-list, .bullet-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.todo-list li, .bullet-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #36454F;
    margin-bottom: 5px;
    position: relative;
}

.todo-list li input[type="checkbox"] {
    accent-color: #F0D788;
    flex-shrink: 0;
}

.todo-list li.checked span {
    text-decoration: line-through;
    color: #888;
}

.todo-list li span, .bullet-list li span {
    outline: none;
    cursor: text;
    flex-grow: 1;
}

.bullet-list li::before {
    content: '•';
    color: #F0D788;
    font-weight: bold;
}

.delete-task-btn {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    visibility: hidden;
}

.todo-list li:hover .delete-task-btn, .bullet-list li:hover .delete-task-btn {
    visibility: visible;
}

.empty-state-text {
    font-style: italic;
    font-size: 0.9rem;
    color: rgba(54, 69, 79, 0.6);
    text-align: center;
    width: 100%;
    margin-top: 15px;
}

.limit-reached-message {
    font-size: 0.9rem;
    text-align: center;
    color: #36454F;
    opacity: 0.7;
    margin-top: 10px;
}

.note-footer {
    padding-top: 10px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
    text-align: center;
    color: #36454F;
}

.add-item-btn {
    background: none;
    border: none;
    color: #36454F;
    font-weight: 500;
    cursor: pointer;
}

.add-item-btn:hover { color: #F0D788; }

.note-delete-btn {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 1rem;
    cursor: pointer;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .sticky-notes-toggle-btn {
        position: fixed;
        top: 50%;
        right: 20px;
        left: auto;
        transform: translateY(-50%);
    }

    .sticky-notes-toggle-btn.active {
        transform: translateY(-50%) rotate(45deg);
    }
    
    /* 🚀 FIX: Full Screen Overlay for Mobile */
    .sticky-notes-panel {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        background: rgba(26, 26, 26, 0.98);
        transform: scale(0.95) translateY(0);
        
        /* Ensure proper flex behavior */
        display: flex;
        flex-direction: column;
    }
    
    /* 🚀 FIX: Scrollable Notes List */
    .notes-list {
        display: block; /* Stack notes vertically */
        padding: 15px;
        /* Critical: Add bottom padding so FAB doesn't cover last item */
        padding-bottom: 100px; 
        flex-grow: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .note-item {
        margin-bottom: 20px;
    }

    .sticky-notes-component-container {
        width: 100%;
        left: 0;
        right: 0;
    }
}

/* --- Conflict Modal Styles --- */
.conflict-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(26, 26, 26, 0.9);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999; opacity: 1; transition: opacity 0.3s;
}
.conflict-modal-overlay.hidden { opacity: 0; pointer-events: none; }

.conflict-modal {
    background: #1a1a1a;
    border: 1px solid #4a4a4a;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    padding: 30px; text-align: center;
    max-width: 450px; width: 90%;
}

.modal-header h3 {
    margin: 0; font-size: 1.5rem; color: #F0D788;
    border-bottom: 2px solid #F0D788; padding-bottom: 10px;
}
.modal-body p { color: #f7f7f7; font-size: 1rem; margin: 20px 0; }
.modal-footer { display: flex; justify-content: center; gap: 15px; }

.modal-btn {
    padding: 12px 25px; border: none; border-radius: 8px;
    font-weight: 500; cursor: pointer;
}
.primary-btn { background-color: #F0D788; color: #1a1a1a; }
.secondary-btn { background-color: #3a3a3a; color: #f7f7f7; border: 1px solid #4a4a4a; }
