/* style.css */
* {
    margin: auto;
    box-sizing: border-box;
}
body {
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
}
.input-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 10px;
}
input, button {
    margin: 5px auto;
    padding: 8px;
    width: 80%;
}
input {
    width: 98%;
}
.error-box {
    margin: 5px auto;
    width: 80%;
    text-align: center;
}
.navbar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 15px;
    background-color: var(--bg-navbar);
    border-bottom: 1px solid var(--border-color, #444);
}
.nav-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin: 0;
}
.theme-toggle {
    width: auto;
    margin: 0;
    padding: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover {
    opacity: 0.7;
}
.theme-toggle svg {
    stroke: var(--text-page);
}
.nav-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    margin: 0;
}

/* Bookmark Grid */
.bookmark-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 10px;
    width: 98%;
    margin: 0 auto;
    justify-items: center;
}
.bookmark-grid.dense {
    grid-template-columns: repeat(2, 1fr);
}
@media only screen and (min-width: 768px) {
    .bookmark-grid.dense {
        grid-template-columns: repeat(2, 1fr);
    }
    .bookmark-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media only screen and (min-width: 1500px) {
    .bookmark-grid.dense {
        grid-template-columns: repeat(3, 1fr);
    }
    .bookmark-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media only screen and (min-width: 2300px) {
    .bookmark-grid.dense {
        grid-template-columns: repeat(4, 1fr);
    }
    .bookmark-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Bookmark Card */
.bookmark-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease;
    max-width: 400px;
    width: 100%;
}
.bookmark-card:hover {
    transform: translateY(-2px);
}
.card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background-color: #333;
}
.card-body {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}
.card-title {
    font-size: 1rem;
    font-weight: bold;
    margin: 0;
    line-height: 1.3;
    overflow-wrap: break-word;
}
.card-description {
    font-size: 0.85rem;
    line-height: 1.3;
    margin: 0;
    overflow-wrap: break-word;
    opacity: 0.85;
}
.card-url-tooltip {
    position: fixed;
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.bookmark-card:hover .card-url-tooltip {
    opacity: 1;
}
.close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.bookmark-card:hover .close-btn {
    opacity: 1;
}
.bookmark-placeholder {
    text-align: center;
    padding: 40px;
    opacity: 0.6;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal-overlay.open {
    display: flex;
}
.modal-content {
    background-color: var(--bg-card);
    box-shadow: var(--card-shadow);
    border-radius: 8px;
    width: 90%;
    max-width: 420px;
    overflow: hidden;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #444);
}
.modal-title {
    font-size: 1.1rem;
    margin: 0;
    color: var(--text-page);
}
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-page);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    width: auto;
    margin: 0;
    padding: 0;
}
.modal-close:hover {
    opacity: 0.7;
}

/* Filter */
.filter-container {
    display: flex;
    flex-direction: row;
    gap: 8px;
    width: 98%;
    margin: 10px auto;
    padding: 0 10px;
    align-items: center;
    justify-content: center;
}
.filter-container input {
    margin: 0;
    flex: 1;
    max-width: 400px;
}
.filter-btn {
    width: auto;
    margin: 0;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

@media only screen and (min-width: 768px) {
    input {
        width: 50%;
    }
    .bookmark-grid {
        width: 65%;
    }
    button {
        width: 300px;
    }
}
