:root {
    --bs-body-bg: #f1f5f9;
    --grid-color: #cbd5e1;
    --primary-color: #0d6efd;
    --danger-color: #ef4444;
    font-size: 14.4px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bs-body-bg);
    margin: 0;
    overflow: auto;
}

#canvas-container {
    width: 100%;
    min-height: 100vh;
    position: relative;
    overflow: auto;
}

#infinite-canvas {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 24px;
    padding-top: 80px;
    padding-bottom: 100px;
    align-items: flex-start;
    align-content: flex-start;
}

/* Search Bar */
.search-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1500;
    background: #ffffff;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    height: 54px;
}
.search-bar input {
    flex: 1;
    height: 100%;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    padding: 0 20px 0 45px;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    background: transparent;
    transition: background 0.2s;
}
.search-bar input:focus {
    background: #fdfdfd;
}
.search-bar .search-icon {
    position: absolute;
    left: 18px;
    color: #94a3b8;
    font-size: 1rem;
    pointer-events: none;
    z-index: 2;
}
.search-bar .search-count {
    font-size: 0.75rem;
    color: #94a3b8;
    padding-right: 15px;
    white-space: nowrap;
}
.search-bar .btn-clear-search {
    border: none;
    background: transparent;
    color: #94a3b8;
    width: 40px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.15s;
}
.search-bar .btn-clear-search:hover {
    color: #334155;
}

/* Notes Search Bar (Modal) */
.notes-search-container {
    position: relative;
    background: #ffffff;
    display: flex;
    align-items: center;
    height: 48px;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    margin-top: 12px;
}
.notes-search-input {
    flex: 1;
    height: 100%;
    border: none;
    padding: 0 15px 0 40px;
    font-size: 0.9rem;
    outline: none;
    background: transparent;
}
.notes-search-input::placeholder {
    color: #94a3b8;
}
.notes-search-icon {
    position: absolute;
    left: 15px;
    color: #94a3b8;
    font-size: 0.9rem;
    pointer-events: none;
}
.btn-clear-notes-search {
    border: none;
    background: transparent;
    color: #94a3b8;
    width: 40px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
}
.btn-clear-notes-search:hover {
    color: #334155;
}


.canvas-card {
    width: fit-content;
    max-width: 85vw;
    cursor: pointer;
    transition: transform 0.15s ease;
    user-select: none;
}

.canvas-card:hover {
    transform: translateY(-2px);
}

.canvas-card.selected .card {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 15px rgba(13, 110, 253, 0.3);
}

.canvas-card .card {
    border: none;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    background: #ffffff;
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.canvas-card .card-text {
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.4;
    word-wrap: break-word;
    display: inline-block;
    white-space: pre-wrap;
    margin: 0; 
}

.canvas-card .card-body {
    padding: 0.75rem 1rem;
    width: max-content;
    max-width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* Indicador de Notas no Card */
.note-indicator {
    color: var(--primary-color);
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 2px;
}

#selection-marquee {
    position: fixed;
    border: 1px solid var(--primary-color);
    background: rgba(13, 110, 253, 0.1);
    pointer-events: none;
    z-index: 2000;
    display: none;
}

.fab-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.fab-btn {
    width: 52px;
    height: 52px;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    padding: 0;
    transition: all 0.2s;
}

@media (min-width: 768px) {
    .fab-container { bottom: 30px; right: 30px; }
    .fab-btn { width: 48px; height: 48px; }
}

.fab-btn:hover { transform: scale(1.1); }

/* Responsive Adjustments */
@media (max-width: 768px) {
    #infinite-canvas {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        padding-top: 70px;
        gap: 16px;
    }

    .canvas-card {
        width: 100% !important;
        max-width: 100% !important;
    }

    .canvas-card .card {
        width: 100%;
    }

    .canvas-card .card-body {
        width: 100%;
        max-width: 100%;
    }

    .canvas-card .card-text {
        width: 100%;
        font-size: 1rem;
    }

    .search-bar {
        height: 48px;
    }

    .search-bar input {
        padding-left: 40px;
        font-size: 0.95rem;
    }

    .fab-btn {
        width: 56px;
        height: 56px;
    }

    /* Floating Notepad on Mobile */
    #floating-notepad {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 50vh !important;
        max-width: 100vw !important;
        max-height: 80vh !important;
        border-radius: 20px 20px 0 0 !important;
        resize: none !important;
        transform: none !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    }

    #floating-notepad.minimized {
        height: 48px !important;
        border-radius: 16px 16px 0 0 !important;
    }

    .notepad-header {
        padding: 12px 16px;
        cursor: default;
    }

    .modal-fullscreen-sm-down .modal-content {
        border-radius: 0;
    }

    /* Modal padding adjustments */
    .modal-body {
        padding: 1rem !important;
    }
    .modal-header, .modal-footer {
        padding: 0.75rem 1rem !important;
    }
    .modal-header {
        border-bottom: 1px solid #f1f5f9; /* Subtle border to separate header */
    }
    .modal-title {
        font-size: 1.1rem;
    }

    #modalCard .modal-body textarea {
        font-size: 0.95rem;
        padding: 10px;
    }

    /* Small content modals should stay compact */
    .modal-dialog-centered.modal-sm {
        margin: 1.75rem auto;
    }
}



.modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    overflow: hidden;
}

#modalCard .modal-content, #modalNoteForm .modal-content, #modalNotesList .modal-content {
    border-top: 6px solid var(--primary-color);
}

#modalDelete .modal-content, #modalDeleteNote .modal-content {
    border-top: 6px solid var(--danger-color);
}

.modal-backdrop.show { opacity: 0.6; }

.form-control {
    font-size: 1rem;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.toast-container { z-index: 2000; width: auto; max-width: 90vw; }
.toast { width: fit-content !important; min-width: 150px; max-width: 85vw; }

#save-indicator {
    position: fixed;
    top: 15px;
    right: 15px;
    font-size: 0.7rem;
    color: #94a3b8;
    z-index: 1001;
    display: none;
}

.selection-hint {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    pointer-events: none;
    z-index: 1001;
    display: none;
}

.note-item { border-bottom: 1px solid #f1f5f9; padding: 16px 0; margin-bottom: 8px; transition: background 0.2s; }
.note-item:last-child { border-bottom: none; margin-bottom: 0; }
.note-date { font-size: 0.7rem; color: #94a3b8; }
.note-text { font-size: 0.9rem; color: #475569; display: block; margin-top: 4px; white-space: pre-wrap; }
.note-actions { display: flex; gap: 8px; }
.btn-note-action {
    border: none;
    background: #f8fafc;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #64748b;
    transition: all 0.2s;
}
.btn-note-action:hover { background: #e2e8f0; color: var(--primary-color); }
.btn-note-delete:hover { background: #fee2e2; color: var(--danger-color); }

/* Floating Notepad */
#floating-notepad {
    position: fixed;
    top: 80px;
    right: 30px;
    width: 340px;
    height: 360px;
    min-width: 240px;
    min-height: 120px;
    max-width: 90vw;
    max-height: 80vh;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0,0,0,0.05);
    overflow: hidden;
    resize: both;
    transition: box-shadow 0.2s;
}
#floating-notepad:hover {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(13,110,253,0.15);
}
#floating-notepad.minimized {
    width: 200px !important;
    height: 42px !important;
    min-height: 42px;
    resize: none;
    border-radius: 12px;
}
#floating-notepad.minimized .notepad-body {
    display: none;
}
.notepad-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    cursor: grab;
    background: linear-gradient(135deg, #0d6efd 0%, #4f8fff 100%);
    color: white;
    flex-shrink: 0;
    user-select: none;
}
.notepad-header:active { cursor: grabbing; }
.notepad-header-title {
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.notepad-header-actions {
    display: flex;
    gap: 4px;
}
.notepad-header-actions button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: background 0.15s;
    cursor: pointer;
}
.notepad-header-actions button:hover {
    background: rgba(255,255,255,0.35);
}
.notepad-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#notepad-textarea {
    flex: 1;
    border: none;
    outline: none;
    padding: 14px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    line-height: 1.6;
    color: #334155;
    background: transparent;
    resize: none;
}
#notepad-textarea::placeholder {
    color: #94a3b8;
}
.notepad-footer {
    padding: 6px 14px;
    font-size: 0.65rem;
    color: #94a3b8;
    text-align: right;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.fab-notepad { background-color: #f59e0b; color: white; border: none; }

/* Login Page Styles */
.login-body {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}
.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}
.brand-logo {
    width: 64px;
    height: 64px;
    background: #0d6efd;
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 16px rgba(13, 110, 253, 0.3);
}
.login-card .btn-primary {
    border-radius: 12px;
    padding: 0.75rem;
    font-weight: 600;
    background: #0d6efd;
    border: none;
    transition: all 0.2s;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}
.forgot-link {
    font-size: 0.85rem;
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}
.forgot-link:hover { color: #0d6efd; }
