:root {
    --background-color: #f4f4f4;
    --text-color: #333;
    --header-bg-color: #fff;
    --modal-bg-color: rgba(0, 0, 0, 0.9);
    --button-color: #fefefe;
    --button-hover-color: #bbb;
}

body.dark-mode {
    --background-color: #333;
    --text-color: #f4f4f4;
    --header-bg-color: #222;
    --modal-bg-color: rgba(0, 0, 0, 0.95);
    --button-color: #888;
    --button-hover-color: #ddd;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

header {
    background-color: var(--header-bg-color);
    color: var(--text-color);
    padding: 1em;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s, color 0.3s;
}

header h1 {
    margin: 0;
    flex-grow: 1;
}

/* WhatsApp Button */
.whatsapp-button {
    display: inline-flex;
    align-items: center;
    background-color: #25D366; /* WhatsApp green */
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    margin-right: 1em;
    transition: background-color 0.3s ease;
}

.whatsapp-button:hover {
    background-color: #1DA851; /* Darker green on hover */
}

.whatsapp-button i {
    margin-right: 8px;
}

.whatsapp-button svg {
    margin-right: 8px;
    width: 20px;
    height: 20px;
    fill: white;
}

/* Theme Switch */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    margin-right: 1em;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin: 0 10px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Gallery Container */
.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    padding: 20px;
    max-width: 1200px;
    margin: 20px auto;
}

.gallery-item {
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out;
}

.gallery-item:hover {
    transform: scale(1.03);
}

.gallery-item img {
    width: 100%;
    height: 200px; /* Fixed height for thumbnails */
    object-fit: cover; /* Cover the area, cropping if necessary */
    display: block;
}

/* Modal (expanded image view) */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    padding-top: 60px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: var(--modal-bg-color); /* Black w/ opacity */
}

.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 900px;
    position: relative;
}

.modal-image {
    width: 100%;
    height: auto;
    display: block;
    max-height: 80vh; /* Limit height to viewport height */
    object-fit: contain; /* Ensure the whole image is visible */
}

/* Close button */
.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: var(--button-color);
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    z-index: 2; /* Ensure it's above the image */
}

.close:hover,
.close:focus {
    color: var(--button-hover-color);
    text-decoration: none;
    cursor: pointer;
}

/* Next & previous buttons */
.prev,
.next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: var(--button-color);
    font-weight: bold;
    font-size: 20px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    -webkit-user-select: none;
    background-color: rgba(0, 0, 0, 0.5);
}

.next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.prev:hover,
.next:hover {
    background-color: rgba(0, 0, 0, 0.8);
    color: var(--button-hover-color);
}

/* Responsive adjustments */
@media only screen and (max-width: 768px) {
    .gallery-container {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        padding: 10px;
    }

    .gallery-item img {
        height: 150px;
    }

    .modal-content {
        width: 95%;
    }

    .prev,
    .next,
    .close {
        font-size: 30px;
        padding: 10px;
    }
}

@media only screen and (max-width: 480px) {
    header {
        flex-direction: column;
        padding: 0.5em;
    }

    .theme-switch-wrapper {
        margin-top: 0.5em;
        margin-right: 0;
    }

    .gallery-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 5px;
    }

    .gallery-item img {
        height: 120px;
    }

    .close {
        top: 5px;
        right: 15px;
        font-size: 30px;
    }

    .prev,
    .next {
        top: 45%;
        font-size: 24px;
        padding: 8px;
    }
}
