/* ------------ Gallery Styles ------------ */

/* Container */
.gallery-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Title */
.gallery-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: bold;
    color: #1a1a1a;
}

/* Masonry Layout */
.boxes-con {
    display: flex;
    gap: 10px;
    padding: 10px;
}

/* Individual Box */
.boxes {
    margin: 0 auto;
    width: 100%;
    border-radius: 5px;
    overflow: hidden;
    background: #ddd;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15);
}

.boxes img {
    width: 100%;
    height: auto;
    display: block;
}

/* Subcontainers */
.sub {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
}

/* Gallery Items */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Title and Date Overlay */
.image-title,
.image-date {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 14px;
    pointer-events: none;
}

.image-title {
    top: 10px;
    left: 10px;
}

.image-date {
    bottom: 10px;
    left: 10px;
}

/* Default hidden state for title, date, and delete button */
.gallery-item .image-title,
.gallery-item .image-date,
.gallery-item .delete-button {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Visible on hover */
.gallery-item:hover .image-title,
.gallery-item:hover .image-date,
.gallery-item:hover .delete-button {
    opacity: 1;
}

/* Delete Button Styling */
.delete-button {
    position: absolute;
    top: 10px;
    right: 10px;
    color: white;
    font-weight: bold;
    border-radius: 25%;
    padding: 5px 10px;
    z-index: 10;
    font-size: 14px;
    background-color: rgba(235, 73, 33, 0.6);
}

.delete-button:hover {
    background-color: rgba(235, 73, 33, 0.8);
}

/* ------------------ OnClick Gallery Modal ----------------- */

/* Modal Container */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: hidden;
    align-content: center;
    justify-content: center;
    align-items: center;
}

/* Overlay Content (Header + Caption) */
.overlay-content {
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 1100;
    display: flex;
    flex-direction: column;
}

/* Modal Header Row */
.gallery-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 100px;
}

/* Image Title in Modal Header */
.modal-title {
    color: white;
    font-size: 1rem;
    font-weight: bold;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Edit Button for Title */
.edit-title-btn {
    border: 1px solid white;
    padding: 5px 10px;
    font-size: 1rem;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    border-radius: 5px;
    margin-left: 10px;
}

.edit-title-btn:hover {
    background-color: rgba(255, 255, 255, 0.5);
    color: black;
}

/* Close Button */
.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
}

.close-modal:hover {
    color: #bbb;
}

/* Caption Text */
#caption {
    text-align: center;
    color: white;
    font-size: 16px;
    margin: 7px 0;
    padding: 5px;
}

/* Modal Image */
.modal-content {
    margin: auto;
    display: block;
    max-height: 85%;
    object-fit: contain;
    background-color: rgba(0, 0, 0, 0);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
    top: 15px;
}

/* Carousel Controls */
.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    padding: 10px 15px;
    z-index: 1100;
}

.carousel-control.prev {
    left: 50px;
}

.carousel-control.next {
    right: 50px;
}

.carousel-control:hover {
    background: rgba(255, 255, 255, 0.5);
    color: black;
}

/* Info Row (Caption and Date) */
.info-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    color: white;
    font-size: 16px;
    margin: 10px auto;
    text-align: center;
}

/* ------------------ Edit Title Modal Styling ----------------- */

.edit-title-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
}

/* Edit Modal Content */
.edit-modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 400px;
    text-align: center;
    z-index: 2100;
}

/* Edit Title Textarea */
.edit-title-textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

/* Buttons in Modal */
.save-btn {
    background-color: #28a745;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
}

.cancel-btn {
    background-color: #dc3545;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
}

/* Modal Buttons Container */
.modal-buttons {
    display: flex;
    justify-content: space-between;
}