body {
    font-family: sans-serif;
    margin: 0;
    background-color: #f0f2f5;
    color: #1c1e21;
}

header {
    background-color: #ffffff;
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #dddfe2;
}

header h1 {
    margin: 0;
    font-size: 2em;
    color: #007bff; /* Inspired by Claude's blue */
}

.add-bookmark-form {
    margin-top: 20px;
    /* display: flex; */ /* Replaced by grid for form */
    /* justify-content: center; */
    /* align-items: center; */
}

.add-bookmark-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    text-align: left;
}

.add-bookmark-container h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5em;
    color: #333;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two columns */
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1; /* Span across both columns */
}

.form-group label {
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-group input[type="url"],
.form-group input[type="text"],
.form-group textarea {
    padding: 10px;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    font-size: 1em;
    width: 100%; /* Make input take full width of its grid cell */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

.form-group textarea {
    min-height: 80px;
    min-height: 80px; /* Match this height for thumbnail area */
    resize: vertical;
}

/* New Thumbnail Input Area Styles */
.thumbnail-input-area {
    border: 1px solid #dddfe2; /* Match other inputs */
    border-radius: 6px;
    min-height: 80px; /* Match description textarea */
    display: flex;
    position: relative; /* For positioning the preview */
    overflow: hidden; /* Hide overflowing preview */
    background-color: #f9f9f9;
    box-sizing: border-box;
}

.thumbnail-half {
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-align: center;
    font-size: 0.9em;
    color: #007bff;
    box-sizing: border-box;
    padding: 10px;
    transition: background-color 0.2s ease;
}

.paste-half {
    border-right: 1px dashed #ccc;
}

.thumbnail-half:hover {
    background-color: #e7f3ff;
}

.thumbnail-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the area */
    display: none; /* Initially hidden */
    z-index: 1; /* Above the trigger divs */
}

/* Style to hide triggers when preview is shown */
.thumbnail-input-area.has-preview .thumbnail-half {
    display: none;
}
.thumbnail-input-area.has-preview .thumbnail-preview {
    display: block;
}


#addBtn {
    padding: 12px 25px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    display: block; /* Make button take full width or center it */
    margin: 0 auto; /* Center button */
}

#addBtn:hover {
    background-color: #0056b3;
}

main {
    padding: 20px;
    padding-bottom: 200px; /* Add padding to bottom of main to avoid overlap with fixed/absolute footer if we were to use one. For now, footer is static. */
}

footer {
    background-color: #ffffff;
    padding: 20px;
    border-top: 1px solid #dddfe2;
    margin-top: 30px; /* Add some space above the footer */
}

/* .add-bookmark-container is already styled, can be reused in footer */

.bookmark-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 items per row */
    gap: 20px;
}

.bookmark-item {
    background-color: #ffffff;
    border: 1px solid #dddfe2;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    position: relative; /* Needed for absolute positioning of delete button */
}

/* Delete Button Style */
.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    color: #dc3545; /* Red color for delete */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.delete-btn:hover {
    background-color: #dc3545;
    color: white;
}


.bookmark-item img.thumbnail {
    width: 100%;
    height: 150px; /* Fixed height for thumbnails */
    object-fit: cover; /* Crop image to fit */
    border-radius: 6px;
    margin-bottom: 10px;
    background-color: #e9ecef; /* Placeholder color */
}

.bookmark-item h3 {
    font-size: 1.2em;
    margin: 0 0 10px 0;
    color: #050505;
}

.bookmark-item p {
    font-size: 0.9em;
    color: #606770;
    flex-grow: 1; /* Make description take available space */
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Limit to 3 lines */
    -webkit-box-orient: vertical;
}

.bookmark-item a.link {
    display: inline-block;
    padding: 8px 12px;
    background-color: #e7f3ff;
    color: #007bff;
    text-decoration: none;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
}

.bookmark-item a.link:hover {
    background-color: #cce0ff;
}
