/* Notes Container */
.notes-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Create Note Section */
.create-note-section {
    max-width: 600px;
    margin: 0 auto 30px;
}

.create-note-collapsed {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    cursor: text;
    transition: box-shadow 0.2s;
}

.create-note-collapsed:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.create-note-collapsed input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
    cursor: text;
}

.create-note-icons {
    display: flex;
    gap: 8px;
}

.create-note-expanded {
    padding: 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.note-input-title {
    width: 100%;
    border: none;
    outline: none;
    font-size: 18px;
    font-weight: 500;
    padding: 8px 0;
    margin-bottom: 12px;
    resize: none;
    overflow: hidden;
}

.note-input-content {
    width: 100%;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 8px 0;
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Checklist Styles */
.checklist-container {
    margin: 12px 0;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    margin: 2px 0;
    border-radius: 4px;
    transition: all 0.2s;
    position: relative;
    cursor: grab;
    user-select: none;
}

.checklist-item::before {
    content: '⋮⋮';
    position: absolute;
    left: -16px;
    color: #5f6368;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: grab;
}

.checklist-item:hover,
.checklist-item:focus-within {
    background-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.checklist-item:hover::before,
.checklist-item:focus-within::before {
    opacity: 0.6;
}

.checklist-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.checklist-item.drag-over {
    background-color: rgba(66, 133, 244, 0.1);
    border-top: 2px solid #4285f4;
}

.checklist-item input[type="checkbox"] {
    margin-top: 3px;
    cursor: pointer;
    flex-shrink: 0;
}

.checklist-item input[type="text"],
.checklist-item textarea {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    padding: 2px 4px;
    resize: none;
    overflow: hidden;
    min-height: 20px;
    line-height: 1.4;
}

.checklist-item-delete {
    opacity: 0;
    background: none;
    border: none;
    color: #5f6368;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checklist-item:hover .checklist-item-delete,
.checklist-item:focus-within .checklist-item-delete {
    opacity: 1;
}

.checklist-item-delete:hover {
    color: #d93025;
    transform: scale(1.2);
}

#addChecklistItem {
    background: none;
    border: none;
    color: #5f6368;
    cursor: pointer;
    padding: 8px;
    margin: 4px 0;
    font-size: 14px;
    text-align: left;
    width: 100%;
    border-radius: 4px;
    transition: background-color 0.2s;
}

#addChecklistItem:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Note Images */
.note-images-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.note-image-preview {
    position: relative;
    width: 100px;
    height: 100px;
}

.note-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.note-image-preview img:hover {
    opacity: 0.8;
}

.note-image-preview .delete-image {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.note-image-preview:hover .delete-image {
    opacity: 1;
}

.note-image-preview .delete-image:hover {
    background: rgba(217, 48, 37, 0.9);
}

/* Create Note Footer */
.create-note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e8eaed;
}

.note-actions {
    display: flex;
    gap: 4px;
    position: relative;
}

.create-note-buttons {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s;
    font-size: 18px;
}

.icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Color Picker */
.color-picker {
    position: relative;
}

.color-palette {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    z-index: 1000;
    min-width: 200px;
}

.color-option {
    width: 28px;
    height: 28px;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.color-option:hover {
    border-color: #666;
    transform: scale(1.1);
}

.color-option.selected {
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.3);
}

/* Notes Controls */
.notes-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.view-toggle {
    display: flex;
    gap: 4px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 2px;
    background: white;
}

.view-btn {
    background: none;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    transition: background-color 0.2s;
}

.view-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.view-btn.active {
    background-color: #e8f0fe;
    color: #1967d2;
}

.filter-buttons {
    display: flex;
    gap: 8px;
}

.filter-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.filter-btn:hover {
    background-color: #f8f9fa;
}

.filter-btn.active {
    background-color: #e8f0fe;
    border-color: #1967d2;
    color: #1967d2;
    font-weight: 500;
}

.search-box {
    flex: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: box-shadow 0.2s;
}

.search-input:focus {
    box-shadow: 0 1px 6px rgba(66, 133, 244, 0.3);
    border-color: #4285f4;
}

/* Notes Grid */
.notes-section {
    min-height: 300px;
}

.notes-group {
    margin-bottom: 32px;
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    color: #202124;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.notes-grid.list-view {
    grid-template-columns: 1fr;
}

/* Note Card */
.note-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px !important;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    min-height: 100px;
}

.note-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-color: #d0d0d0;
}

.note-card.highlighted {
    border: 3px solid #1a73e8;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
    background-color: rgba(26, 115, 232, 0.2);
    filter: brightness(0.95);
}

.note-card.pinned::before {
    content: '📌';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 14px;
}

.note-card h3 {
    margin: 0 0 8px 0;
    padding-right: 30px; /* Space for pin/share icons */
    font-size: 16px;
    font-weight: 500;
    word-break: break-word;
}

.note-card p {
    margin: 0;
    padding-right: 8px; /* Ensure text doesn't touch edge */
    font-size: 14px;
    color: #5f6368;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 8;
    -webkit-box-orient: vertical;
}

.note-card .note-content {
    overflow: hidden;
}

.note-card .note-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.note-card .note-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0;
    padding-left: 0 !important;
    font-size: 14px;
    color: #5f6368;
    word-break: break-word;
}

.note-card .note-checklist li::before {
    content: none !important;
}

.note-card .note-checklist li input[type="checkbox"] {
    margin-top: 2px;
    pointer-events: none;
}

.note-card .note-card-images,
.note-card .note-images {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 12px;
}

.note-card .note-card-images img,
.note-card .note-images img {
    width: 100%;
    max-height: 100px;
    object-fit: cover;
    border-radius: 4px;
}

/* No Notes Message */
.no-notes {
    text-align: center;
    padding: 60px 20px;
    color: #5f6368;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #5f6368;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: auto;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

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

.modal-actions {
    display: flex;
    gap: 4px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #5f6368;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-body .note-input-title,
.modal-body .note-input-content {
    width: 100%;
}

.modal-body .note-input-content {
    min-height: 200px;
}

/* Image Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 2001;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
}

#lightboxImage {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
}

/* Buttons */
.btn {
    padding: 8px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #1a73e8;
    color: white;
}

.btn-primary:hover {
    background-color: #1557b0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-text {
    background: none;
    color: #1a73e8;
}

.btn-text:hover {
    background-color: rgba(26, 115, 232, 0.1);
}

/* Drag and Drop */
.create-note-expanded.drag-over,
.modal-body.drag-over {
    border: 2px dashed #4285f4;
    background-color: rgba(66, 133, 244, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .notes-grid {
        grid-template-columns: 1fr;
    }
    
    .notes-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    #lightboxImage {
        max-width: 95%;
        max-height: 95%;
    }
    
    .lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }
}

/* Keyboard Shortcuts Help */
.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
}

.shortcuts-table tr {
    border-bottom: 1px solid #e8eaed;
}

.shortcuts-table td {
    padding: 12px 8px;
}

.shortcuts-table td:first-child {
    width: 60%;
    font-weight: 500;
}

.shortcuts-table kbd {
    display: inline-block;
    padding: 3px 8px;
    font-family: monospace;
    font-size: 13px;
    color: #202124;
    background-color: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

/* ===== Priority 3: Labels, Sharing, URL Navigation ===== */

/* Labels Input Container */
.labels-input-container {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #e8eaed;
}

.labels-input-container:empty {
    display: none;
    margin: 0;
    padding: 0;
    border: none;
}

.labels-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.labels-chips:empty {
    display: none;
}

.label-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background-color: #e8f0fe;
    color: #1967d2;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.label-chip:hover {
    background-color: #d2e3fc;
}

.label-chip-remove {
    background: none;
    border: none;
    color: #1967d2;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.label-chip-remove:hover {
    background-color: rgba(25, 103, 210, 0.2);
}

.labels-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 13px;
    padding: 6px 0;
    background: transparent;
}

.labels-suggestions {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 4px;
}

.label-suggestion {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
}

.label-suggestion:hover {
    background-color: #f8f9fa;
}

/* Label Filters */
.label-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.label-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.label-filter-chip:hover {
    background-color: #f8f9fa;
}

.label-filter-chip.active {
    background-color: #e8f0fe;
    border-color: #1967d2;
    color: #1967d2;
    font-weight: 500;
}

.label-filter-chip .filter-count {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.label-filter-chip.active .filter-count {
    background-color: rgba(25, 103, 210, 0.2);
}

/* Note Card Labels */
.note-card-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.note-card-labels .label-chip {
    font-size: 11px;
    padding: 3px 8px;
}

/* Share Indicator on Note Card */
.note-card.shared::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 32px; /* Right of pin icon if present */
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='18' cy='5' r='3'%3E%3C/circle%3E%3Ccircle cx='6' cy='12' r='3'%3E%3C/circle%3E%3Ccircle cx='18' cy='19' r='3'%3E%3C/circle%3E%3Cline x1='8.59' y1='13.51' x2='15.42' y2='17.49'%3E%3C/line%3E%3Cline x1='15.41' y1='6.51' x2='8.59' y2='10.49'%3E%3C/line%3E%3C/svg%3E");
    background-size: contain;
    opacity: 0.7;
}

.note-card.pinned.shared::before {
    right: 32px; /* Adjust when both pin and share icons present */
}

/* Share Dialog */
.share-toggle {
    display: flex;
    align-items: center;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #1a73e8;
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.share-link-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: #f8f9fa;
    font-family: monospace;
}

.share-link-input:focus {
    outline: none;
    border-color: #4285f4;
    background-color: white;
}

#shareLinkContainer {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Completed Items Section ===== */

.completed-section {
    margin-top: 16px;
    border-top: 1px solid #e8eaed;
    padding-top: 8px;
}

.completed-header {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #5f6368;
    font-weight: 500;
    margin-bottom: 8px;
    user-select: none;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.completed-header:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #202124;
}

.completed-toggle {
    transition: transform 0.2s;
    font-size: 10px;
}

.completed-items.collapsed {
    display: none;
}

.checklist-item.checked input[type="text"] {
    text-decoration: line-through;
    color: #9aa0a6;
}
