/**
 * Bookmarks Panel Styles
 * Uses native Popover API
 */

/* Reset button styles for icon trigger */
button.hbutton-icon {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#bookdiv {
    /* Popover positioning - set dynamically by JS */
    position: fixed;
    inset: unset;
    margin: 0;

    /* Appearance */
    background: #fff;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 280px;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.bookmarks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #0e5d54;
    border-radius: 8px 8px 0 0;
}

.bookmarks-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bookmarks-title i {
    color: #f59e0b;
}

.bookmarks-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
}

.bookmarks-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.bookmarks-list {
    max-height: 300px;
    overflow-y: auto;
}

.bookmarks-empty {
    padding: 32px 16px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

.bookmark-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f5f5f5;
}

.bookmark-item:last-child {
    border-bottom: none;
}

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

.bookmark-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    overflow: hidden;
}

.bookmark-content i {
    color: #999;
    font-size: 12px;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}

.bookmark-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow: hidden;
}

.bookmark-name {
    color: #333;
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-url {
    color: #999;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-delete {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.15s;
    opacity: 0;
}

.bookmark-item:hover .bookmark-delete {
    opacity: 1;
}

.bookmark-delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

.bookmarks-add {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    background: #fafafa;
    border-radius: 0 0 8px 8px;
}

#bookmarks-name-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 8px;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

#bookmarks-name-input:focus {
    outline: none;
    border-color: #999;
}

.bookmarks-add-btn {
    width: 100%;
    padding: 8px 12px;
    background: #0e5d54;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.bookmarks-add-btn:hover:not(:disabled) {
    background: #0a4a43;
}

.bookmarks-add-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#bookmarks-feedback {
    display: none;
    padding: 8px 16px;
    font-size: 12px;
}

.bookmarks-feedback-success {
    background: #ecfdf5;
    color: #059669;
}

.bookmarks-feedback-error {
    background: #fef2f2;
    color: #dc2626;
}

/* Popover animation */
#bookdiv {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease, display 0.15s allow-discrete;
}

#bookdiv:popover-open {
    opacity: 1;
    transform: translateY(0);
}

@starting-style {
    #bookdiv:popover-open {
        opacity: 0;
        transform: translateY(-8px);
    }
}
