/* Bookmarks Modal Styles with Card Grid */

/* Modal overlay */
.bookmarks-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999999;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.bookmarks-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Modal content container */
.bookmarks-modal-content {
    position: fixed;
    top: 12%;
    left: 12%;
    width: 76%;
    height: 76%;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

/* Modal header */
.bookmarks-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    background: #2d2d2d;
    border-bottom: 1px solid #444;
    flex-shrink: 0;
}

.bookmarks-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #e0e0e0;
}

/* Modal controls */
.bookmarks-modal-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Close button */
.bookmarks-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.bookmarks-modal-close:hover {
    background: #374151;
    color: #e0e0e0;
}

/* Modal body - Grid container */
.bookmarks-modal-body {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    background: #1a1a1a;
    padding: 20px;
}

/* Bookmark Grid */
.bookmark-grid {
    display: grid;
    grid-template-columns: repeat(3, 170px);
    grid-template-rows: repeat(3, auto);
    gap: 20px;
    justify-content: center;
}

/* Section bookmarks - align to end */
.section-bookmarks {
    justify-content: end;
}

/* Bookmark Card */
.bookmark-card {
    width: 170px;
    aspect-ratio: 350 / 450;
    border-radius: 17px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Blurred background image with dark tint */
.bookmark-card::before {
    content: '';
    background-size: cover;
    background-position: top;
    filter: blur(10px) brightness(0.7) contrast(1.2);
    z-index: -1;
    border-radius: 15px;
    position: absolute;
    inset: 0;
}

/* Default gradient when no image */
.bookmark-card.no-image::before {
    filter: none;
}

.bookmark-card:nth-child(1).no-image::before { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.bookmark-card:nth-child(2).no-image::before { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.bookmark-card:nth-child(3).no-image::before { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.bookmark-card:nth-child(4).no-image::before { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.bookmark-card:nth-child(5).no-image::before { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.bookmark-card:nth-child(6).no-image::before { background: linear-gradient(135deg, #30cfd0 0%, #330867 100%); }
.bookmark-card:nth-child(7).no-image::before { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }
.bookmark-card:nth-child(8).no-image::before { background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%); }
.bookmark-card:nth-child(9).no-image::before { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }

.image-container {
    position: relative;
    flex: 0 0 70%;
    margin: 1.3%;
    margin-bottom: 1px;
}

.image-overlay {
    background-size: cover;
    background-position: center;
    border-radius: 15px 15px 0 0;
    width: 100%;
    height: 101%;
    aspect-ratio: 350 / 233;
}

.card-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 0 0 15px 15px;
    padding: 4.4%;
    margin: 1.3% 1.3%;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    max-height: 60px;
}

.card-title {
    font-size: 10px;
    font-weight: 700;
    color: #707070;
    margin-bottom: 2.3%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.date-added {
    font-size: 7px;
    color: #999999;
    margin-top: 3%;
    font-style: italic;
    text-align: center;
}

.delete-button,
.external-link-button {
    position: absolute;
    background: #000000;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-button {
    top: 10px;
    right: 10px;
    width: 25px;
    height: 25px;
}

.external-link-button {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 50px;
    height: 50px;
    text-decoration: none;
}

.bookmark-card:hover .delete-button,
.bookmark-card:hover .external-link-button {
    opacity: 1;
}

.delete-button svg {
    width: 16px;
    height: 16px;
    display: block;
}

.external-link-button svg {
    width: 24px;
    height: 24px;
    stroke: #ffffff;
}

.delete-button:hover {
    background: #ff0000;
}

.external-link-button:hover {
    background: #000000;
}

.up-button,
.down-button {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: opacity 0.2s ease;
    border: none;
    outline: none;
    color: #707070;
    opacity: 0;
    z-index: 2;
}

.up-button {
    bottom: 70px;
    right: 15px;
}

.down-button {
    bottom: 40px;
    right: 15px;
}

.up-button svg,
.down-button svg {
    width: 12px;
    height: 12px;
    display: block;
}

.up-button:hover,
.down-button:hover {
    background: #f0f0f0;
}

.up-button:active,
.down-button:active {
    background: #e0e0e0;
}

.bookmark-card:hover .up-button,
.bookmark-card:hover .down-button {
    opacity: 1;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
