/* General */
:root {
    --container-width: 100%; /* Default for mobile */
    --fab-bottom-desktop-visible: 180px; /* Original position when carousel is visible */
    --fab-bottom-desktop-hidden: 25px; /* Position when carousel is hidden (e.g., above bottom) */
    --fab-bottom-mobile-visible: 255px; /* From media query for body.map-page #add-story-fab */
    --fab-bottom-mobile-hidden: 80px; /* Mobile bottom nav (60px) + margin (20px) */
}

@media (min-width: 576px) {
    :root { --container-width: 540px; }
}
@media (min-width: 768px) {
    :root { --container-width: 720px; }
}
@media (min-width: 992px) {
    :root { --container-width: 960px; }
}
@media (min-width: 1200px) {
    :root { --container-width: 1140px; }
}
@media (min-width: 1400px) {
    :root { --container-width: 1320px; }
}

body {
    font-family: 'Roboto', sans-serif;
    overflow-x: hidden; /* Prevent horizontal scrollbar */
    background-color: #000;
    color: #fff;
}

/* Navbar */
.navbar {
    background-color: rgba(33, 37, 41, 0.8);
    backdrop-filter: blur(10px);
    transition: top 0.3s ease-in-out; /* Animation for hiding header */
}

.navbar-brand img {
    max-height: 40px;
}

.navbar-nav .nav-link {
    color: #fff !important; /* Texto blanco para los enlaces de navegación */
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: #ffd700 !important; /* Color dorado para hover y activo */
}

/* Mapa */
#map {
    height: 100vh;
    width: 100%;
    z-index: 1;
}

/* Carousel Container */
#carousel-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 160px; /* Set a fixed height */
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2;
    overflow: hidden; /* Hide overflowing items */
    padding: 10px 0;
    transition: height 0.3s ease-in-out; /* Animation for height change */
}

/* Carousel hidden state */
#carousel-container.carousel-hidden {
    height: 0;
    padding: 0;
}

/* Hide default controls */
#video-carousel .carousel-control-prev,
#video-carousel .carousel-control-next {
    display: none;
}

/* Carousel Inner Track */
.carousel-inner {
    display: flex;
    width: max-content; /* Allow inner content to define width */
    animation: scroll 30s linear infinite;
}

/* Carousel Item */
.carousel-item {
    flex: 0 0 auto; /* Prevent shrinking/growing */
    width: 220px; /* Width of each item */
    height: 130px; /* Fixed height for the item */
    margin: 0 10px;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    position: relative; /* For caption positioning */
    display: block; /* Allow image and caption to stack */
    transition: transform 0.2s ease-in-out;
}

.carousel-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* 50% black overlay */
    z-index: 1;
}

.carousel-item:hover {
    transform: scale(1.05);
    background-color: #3c3c3c;
}

/* Carousel Caption */
.carousel-caption {
    position: absolute; /* Overlay on the image */
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%); /* Gradient background */
    padding: 10px;
    text-align: left;
    color: #fff;
    z-index: 2; /* Ensure caption is above the overlay */
}

.carousel-caption h5 {
    margin: 0;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.carousel-caption p {
    font-size: 0.75rem;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.carousel-caption .d-flex span {
    font-size: 0.7rem;
}

.carousel-caption .d-flex i {
    margin-right: 3px;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative; /* Ensure image is below overlay */
    z-index: 0;
}

/* Scrolling Animation */
@keyframes scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%); /* Scroll until the first duplicate is in view */
    }
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* --- Story Modal Styles --- */
#storyModal .modal-content {
    background-color: #212529; /* Dark background for the modal */
    color: #fff; /* White text */
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#storyModal .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

#storyModal .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

#storyModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    z-index: 10;
    position: relative;
}

/* Adjust vertical position of centered modals */
.modal-dialog.modal-dialog-centered {
    align-items: flex-start;
    margin-top: 2rem; /* Adjust this value as needed */
}

.story-content {
    white-space: pre-wrap; /* Respects newlines in the story content */
    line-height: 1.6;
}

.comments-section .list-unstyled {
    max-height: 300px; /* Limit height and allow scrolling for comments */
    overflow-y: auto;
    padding-right: 10px; /* Space for scrollbar */
}

.comments-section .d-flex {
    border-bottom: 1px solid #343a40; /* Separator for comments */
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.comments-section .rounded-circle {
    object-fit: cover;
}

.like-button {
    font-size: 1.2rem; /* Make the heart bigger */
    color: #dc3545; /* Explicitly set the danger color (red) */
    text-decoration: none;
    transition: transform 0.2s, color 0.2s;
    border: 1px solid #dc3545; /* Add red border */
    padding: 8px 15px; /* Add some padding */
    border-radius: 5px; /* Rounded corners */
}

.like-button:hover {
    transform: scale(1.1);
    color: #c82333; /* A darker red on hover */
}

/* Style for the liked state */
.like-button .fas.fa-heart {
    color: #dc3545;
}

/* Style for the unliked state */
.like-button .far.fa-heart {
    color: #6c757d; /* A neutral grey color */
}

#videoModal {
    z-index: 1060 !important;
}

#videoModal .btn-close {
    z-index: 10;
    position: relative;
}

/* --- YouTube Shorts Modal Specific Styles --- */
.modal-dialog-short {
    max-width: 400px; /* Adjust as needed for a vertical look */
    margin: 1.75rem auto; /* Center the modal */
}

.modal-dialog-short .modal-body .ratio {
    /* The ratio class itself will be dynamically changed, so this specific override might not be needed here */
}

/* Adjust iframe within the short modal */
.modal-dialog-short .modal-body iframe {
    width: 100%;
    height: 100%;
}

.ratio-vertical-short {
    padding-bottom: 177.77%; /* Approximately 9:16 aspect ratio (height:width) */
}

#storyModal .form-control {
    color: #fff !important; /* Make textarea text white */
}

/* --- Custom Scrollbar for Story Modal --- */
#storyModal *::-webkit-scrollbar {
    width: 8px;
}

/* --- Comment Like Button Styles --- */
.comment-like-button {
    border: none;
    padding: 0;
    background-color: transparent;
    transition: transform 0.2s;
}

.comment-like-button:hover {
    transform: scale(1.1);
    background-color: transparent;
}

.comment-like-button .fa-heart {
    font-size: 1.3rem; /* Make the icon bigger */
}

.comment-like-button .fas.fa-heart {
    color: #dc3545; /* Red for liked */
}

.comment-like-button .far.fa-heart {
    color: #6c757d; /* Grey for unliked */
}

/* Animation for Like Feedback */
@keyframes heart-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.heart-animation {
    animation: heart-pop 0.3s ease-out;
}


#storyModal *::-webkit-scrollbar-track {
    background: #212529;
}

#storyModal *::-webkit-scrollbar-thumb {
    background-color: #495057;
    border-radius: 4px;
    border: 2px solid #212529;
}

#storyModal *::-webkit-scrollbar-thumb:hover {
    background-color: #6c757d;
}

/* --- Floating Action Button --- */
#add-story-fab {
    position: fixed;
    bottom: var(--fab-bottom-desktop-visible); /* Use CSS variable */
    right: 25px;
    z-index: 1030;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 0; /* Remove padding to make it a clean square */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #dc3545; /* Red background */
    transition: bottom 0.3s ease-in-out; /* Add transition for bottom */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);

    /* Gold Button Style */
    background-color: #D4AF37 !important; /* Gold background */
    color: #000000 !important; /* Black text */
    border-color: #000000 !important; /* Black border */
    font-weight: bold;
    transition: all 0.3s ease, bottom 0.3s ease-in-out; /* Include bottom in transition */
}

#add-story-fab:hover {
    background-color: #212529 !important; /* Dark background on hover */
    color: #FFFFFF !important; /* White text on hover */
    border-color: #D4AF37 !important; /* Gold border on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}


/* --- Transcription Modal Styles --- */
#transcriptionModal .modal-content {
    background-color: #212529;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#transcriptionModal .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

#transcriptionModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

#transcriptionModal #transcription-textarea {
    background-color: #343a40;
    color: #fff;
    border: 1px solid #495057;
}

#transcription-status {
    font-size: 0.9rem;
    color: #adb5bd;
    min-height: 1.2rem;
}

/* --- Add Story Modal Styles --- */
#addStoryModal .modal-content {
    background-color: #212529; /* Dark background for the modal */
    color: #fff; /* White text */
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#addStoryModal .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    position: relative; /* For absolute positioning of close button */
    display: flex; /* Use flexbox for horizontal alignment */
    align-items: center; /* Vertically center items */
    justify-content: center; /* Horizontally center items */
    padding-top: 1rem; /* Add some padding */
    padding-bottom: 0.5rem;
}

#addStoryModal .modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    z-index: 10;
}

#addStoryModal #add-story-profile-img {
    border: 2px solid #ffd700; /* Gold border for profile image */
    width: 80px; /* Adjusted size */
    height: 80px; /* Adjusted size */
    object-fit: cover;
    margin-right: 0.5rem; /* Add space between image and text */
    margin-bottom: 0; /* Remove mb-2 */
}

#addStoryModal .modal-title {
    font-size: 1.5rem; /* Adjust title size for desktop */
    color: #ffd700; /* Gold color for the title */
    flex-grow: 1; /* Allow title to grow */
    text-align: left; /* Align text to left within its flex item */
}

#addStoryModal .modal-title span {
    color: #fff; /* White for username */
}

#addStoryModal .image-upload-box {
    padding: 0.75rem;
    border: 1px solid #495057;
    border-radius: 5px;
    background-color: #2c3034;
}

#addStoryModal #image-upload-container {
    gap: 10px; /* Add space between slots */
}

#addStoryModal .image-upload-slot {
    flex: 1;
}

#addStoryModal .image-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 80px;
    border: 2px dashed #6c757d; /* More visible dashed border */
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background-color: #343a40;
    transition: border-color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

#addStoryModal .image-upload-label:hover {
    border-color: #adb5bd; /* Lighter border on hover */
    background-color: #3c4248; /* Slightly lighter background on hover */
}

#addStoryModal .image-upload-label i {
    font-size: 1.5rem;
    color: #adb5bd; /* Lighter color for icon */
    transition: color 0.2s ease-in-out;
}

#addStoryModal .image-upload-label:hover i {
    color: #fff; /* White icon on hover */
}

#addStoryModal .image-upload-label img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1; /* Ensure image is above the icon if both are visible */
}

/* Style for when an image is present */
#addStoryModal .image-upload-label.has-image {
    border: 2px solid #ffd700; /* Gold border for filled slot */
    background-color: #212529; /* Darker background for filled slot */
}

#addStoryModal .image-upload-label.has-image:hover {
    border-color: #ffc107; /* Slightly different gold on hover */
}

#addStoryModal .image-upload-label.has-image i {
    display: none; /* Hide camera icon when image is present */
}

#addStoryModal .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

#addStoryModal .form-control {
    color: #fff !important; /* Make textarea text white */
    background-color: #343a40; /* Darker background for form controls */
    border-color: #495057; /* Darker border for form controls */
}

#addStoryModal .form-label {
    color: #adb5bd; /* Lighter color for labels */
}

#addStoryModal .form-select {
    color: #fff !important;
    background-color: #343a40 !important;
    border-color: #495057 !important;
}

#addStoryModal .form-select option {
    background-color: #343a40;
    color: #fff;
}

/* Styles for the new intuitive bar */
#addStoryModal .modal-body .btn-link {
    color: #ffd700 !important; /* Gold color for icons */
    transition: color 0.2s ease-in-out;
}

#addStoryModal .modal-body .btn-link:hover {
    color: #fff !important; /* White on hover */
}

/* --- Add Image Upload Modal --- */
#addImageUploadModal .modal-content {
    background-color: #000; /* Black background */
    color: #fff;
    border: 1px solid rgba(255, 215, 0, 0.5); /* Gold border */
}

#addImageUploadModal .modal-header {
    border-bottom: 1px solid rgba(255, 215, 0, 0.5);
}

#addImageUploadModal .modal-footer {
    border-top: 1px solid rgba(255, 215, 0, 0.5);
}

#addImageUploadModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

#addImageUploadModal .image-upload-box {
    padding: 1.5rem;
    border: 1px solid #495057;
    border-radius: 5px;
    background-color: #1a1a1a;
}

#addImageUploadModal #image-upload-container {
    display: flex;
    justify-content: center; /* Center the slots */
    gap: 15px;
    flex-wrap: wrap;
}

#addImageUploadModal .image-upload-slot {
    flex: 0 1 calc(33.333% - 15px); /* Three slots per row with gap */
    max-width: 150px; /* Max size for slots */
    aspect-ratio: 1 / 1; /* Make it a square */
}

#addImageUploadModal .image-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%; /* Fill the square slot */
    border: 2px dashed #6c757d;
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background-color: #343a40;
    transition: border-color 0.2s, background-color 0.2s;
}

#addImageUploadModal .image-upload-label:hover {
    border-color: #ffd700;
    background-color: #3c4248;
}

#addImageUploadModal .image-upload-label img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensure image covers the slot */
    z-index: 1;
}

#addImageUploadModal .image-upload-label i {
    font-size: 2.5rem; /* Larger icon */
    color: #6c757d;
    z-index: 0;
}

#addImageUploadModal .image-upload-label.has-image {
    border-style: solid;
    border-color: #ffd700;
}

#addImageUploadModal .image-upload-label.has-image i {
    display: none; /* Hide icon when image is present */
}

/* Style for completed state in intuitive bar */
#addStoryModal .d-flex.justify-content-around .btn.completed i {
    color: #dc3545 !important; /* Bootstrap's danger color */
}

/* Mobile specific adjustments for the new modal header */
@media (max-width: 576px) {
    #addStoryModal .modal-header {
        padding-top: 1rem;
        padding-bottom: 0.5rem;
    }
    #addStoryModal #add-story-profile-img {
        width: 50px;
        height: 50px;
    }
    #addStoryModal .modal-title {
        font-size: 1.2rem; /* Adjust title size for mobile */
    }
}

/* --- Map Picker Modal Styles --- */
#mapPickerModal .modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #212529;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#mapPickerModal .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

#mapPickerModal .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

#mapPickerModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

#mapPickerModal .modal-body {
    flex-grow: 1; /* Allows the body to expand */
    padding: 0;
}

#map-picker {
    height: 100%;
    width: 100%;
}

/* --- Map Picker Modal Custom Styles --- */
#mapPickerModal .modal-content {
    border: 2px solid #000; /* Black border */
    padding-bottom: 1rem; /* Padding at the bottom */
}

/* --- Admin Page Responsive Table --- */
@media (max-width: 767px) {
    #admin-grid-container table,
    #admin-grid-container thead,
    #admin-grid-container tbody,
    #admin-grid-container th,
    #admin-grid-container td,
    #admin-grid-container tr {
        display: block;
    }

    #admin-grid-container thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    #admin-grid-container tr {
        border: 1px solid #495057;
        border-radius: 5px;
        margin-bottom: 1rem;
    }

    #admin-grid-container td {
        border: none;
        border-bottom: 1px solid #343a40;
        position: relative;
        padding-left: 50%;
        text-align: right;
    }

    #admin-grid-container td:before {
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
    }

    #admin-grid-container td:nth-of-type(1):before { content: "Título:"; }
    #admin-grid-container td:nth-of-type(2):before { content: "Autor:"; }
    #admin-grid-container td:nth-of-type(3):before { content: "Fecha de Envío:"; }
    #admin-grid-container td:nth-of-type(4):before { content: "Acciones:"; }

    #admin-grid-container td:last-child {
        border-bottom: 0;
    }
}

/* --- Leaflet Controls Position Fix --- */
.leaflet-top.leaflet-right {
    margin-top: 70px;
}
.leaflet-top.leaflet-left {
    margin-top: 70px !important;
}

/* --- Story Image Overlay --- */
.story-image-container {
    position: relative;
    cursor: pointer;
    margin: 0.5rem;
    overflow: hidden;
    border-radius: 0.25rem;
    box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16), 0 2px 10px 0 rgba(0,0,0,0.12);
    display: inline-block;
    line-height: 0; /* Removes extra space under the image */
}

.story-image-container img {
    max-height: 200px;
    width: auto;
    transition: transform 0.3s ease;
}

.story-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 0.25rem;
}

.story-image-container:hover img {
    transform: scale(1.1);
}

.story-image-container:hover .story-image-overlay {
    opacity: 1;
}

/* --- Story Feed Styles --- */
.story-card {
    background-color: #212529; /* Dark background */
    border: 1px solid #495057; /* Subtle border */
    border-radius: 8px;
    cursor: pointer;
}

.story-card .card-body {
    padding: 1.5rem;
}

.story-card .card-title {
    color: #fff;
}

.story-card .card-text {
    color: #adb5bd;
}

.story-card .read-more {
    background-color: #3b5998;
    border-color: #3b5998;
}

.story-card .read-more:hover {
    background-color: #324a80;
    border-color: #324a80;
}

/* --- Carousel Item Icon --- */
.carousel-item-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    z-index: 3; /* Above the overlay and caption */
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
}

/* --- New Story List Styles --- */
.story-list-header {
    display: flex;
    align-items: flex-start;
}

.story-list-image {
    width: 150px;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 15px;
}

.story-list-details p {
    margin-bottom: 0.25rem;
}

/* --- Story Modal Image Preview Styles --- */
#storyModal .story-images-container {
    display: flex;
    flex-wrap: nowrap; /* Ensure single line */
    gap: 10px;
    justify-content: center; /* Center the images */
    overflow-x: auto; /* Enable horizontal scrolling */
    padding-bottom: 10px; /* Space for scrollbar */
}

#storyModal .story-image-item {
    position: relative;
    cursor: pointer;
    flex: 0 0 100px; /* Don't grow, don't shrink, base width of 100px */
    width: 100px;
    height: 100px;
    border-radius: 0.25rem;
    overflow: hidden; /* Ensures image respects the border-radius */
    transition: transform 0.3s ease;
}

#storyModal .story-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Make image square without distortion */
}

#storyModal .story-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#storyModal .story-image-item:hover .story-image-overlay {
    opacity: 1;
}

/* --- Floating Action Button Icon --- */
#add-story-fab img {
    width: 32px; /* Slightly larger icon */
    height: 32px;
    filter: none; /* Keep original colors */
}

/* --- Carousel Label --- */
.carousel-label-container {
    position: absolute;
    bottom: 160px; /* carousel height */
    left: 0;
    width: 100%;
    /* padding-left: 20px; */ /* Removed for centering */
    text-align: center; /* Added for centering */
    z-index: 5;
    pointer-events: none;
}
.carousel-label-container #toggle-carousel-btn {
    font-size: 1.25rem; /* Reduced by half from 2.5rem */
    color: #fff; /* Changed to white */
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 1); /* Re-added text shadow */
    margin: 0;
    font-weight: normal;
    letter-spacing: 2px; /* Re-added letter spacing */
    background-color: rgba(20, 20, 20, 0.7); /* Re-added semi-transparent background */
    display: inline-block;
    padding: 5px 15px;
    border: none;
    cursor: pointer;
    pointer-events: auto; /* Enable click events */
    /* Gold Button Style */
    background-color: #D4AF37 !important; /* Gold background */
    color: #000000 !important; /* Black text */
    border-color: #000000 !important; /* Black border */
    font-weight: bold;
    transition: all 0.3s ease;
    border-radius: 5px; /* Rounded corners for the button */
}

.carousel-label-container #toggle-carousel-btn:hover {
    background-color: #212529 !important; /* Dark background on hover */
    color: #FFFFFF !important; /* White text on hover */
    border-color: #D4AF37 !important; /* Gold border on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}


/* --- Mobile Navigation & Header --- */
.bottom-nav-mobile {
    display: none; /* Hidden by default */
}

.header-hidden {
    top: -60px; /* Adjust to header height */
}

/* Responsive Navbar adjustments */
@media (max-width: 991.98px) {
    header {
        display: none !important;
    }

    /* Removed global overflow: hidden for mobile */
    body {
        /* padding-top: 56px; /* Header height */
        padding-bottom: 60px; /* Bottom nav height */
    }

    /* Apply overflow: hidden only to the map page in mobile */
    body.map-page {
        overflow: hidden !important;
    }

    .navbar .container-fluid {
        min-height: 56px;
    }

    .navbar-brand img {
        height: 25px !important;
    }

    /* Hide original mobile menu */
    .navbar-toggler,
    .navbar-collapse {
        display: none !important;
    }

    /* Show and style bottom nav */
    .bottom-nav-mobile {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background-color: rgba(33, 37, 41, 0.9);
        backdrop-filter: blur(10px);
        z-index: 1030;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .bottom-nav-mobile .nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #fff;
        font-size: 0.7rem;
        flex-grow: 1;
    }

    .bottom-nav-mobile .nav-link i {
        font-size: 1.2rem;
        margin-bottom: 4px;
    }

    .bottom-nav-mobile .nav-link.active {
        color: #ffd700;
    }

    #carousel-container {
        position: fixed;
        bottom: 65px; /* Lifted slightly above the 60px bottom nav */
    }

    .carousel-label-container {
        position: fixed; /* Change to fixed for mobile */
        bottom: 205px; /* Adjust based on final carousel height */
        /* padding-left: 15px; */ /* Removed for centering */
        text-align: center; /* Added for centering */
    }

    .carousel-label-container #toggle-carousel-btn {
        font-family: 'Roboto', sans-serif; /* Ensure Roboto on mobile */
        font-size: 0.9rem; /* Reduced by half from 1.8rem */
        color: #fff; /* Ensure white color on mobile */
        padding: 3px 10px;
        background-color: rgba(20, 20, 20, 0.7); /* Re-added background on mobile */
        text-shadow: 2px 2px 5px rgba(0, 0, 0, 1); /* Re-added text shadow on mobile */
        letter-spacing: 2px; /* Re-added letter spacing on mobile */
    }

    body.map-page #add-story-fab {
        /* nav (60) + carousel (140) + label (40) + margin (15) = ~255px */
        bottom: var(--fab-bottom-mobile-visible); /* Use CSS variable */
    }

    .youtube-button-container {
        bottom: 140px !important; /* Above carousel and bottom nav */
        z-index: 1029; /* Slightly lower than add-story-fab (1030) */
    }
    .leaflet-top.leaflet-right,
    .leaflet-top.leaflet-left {
        margin-top: 15px !important;
    }
}

/* Media Queries for Tablet */
@media (max-width: 768px) {
    #carousel-container {
        height: 140px;
    }

    .carousel-item {
        width: 180px;
        height: 110px;
    }
}

/* Media Queries for Mobile */
@media (max-width: 576px) {
    .navbar-brand img {
        max-height: 30px;
    }

    #carousel-container {
        height: 85px; /* Reduced height for smaller carousel items */
    }

    .carousel-label-container {
        bottom: 150px; /* Adjusted to move it higher, preventing overlap with carousel */
    }

    body.map-page #add-story-fab {
        /* nav (60) + carousel (85) + label (35) + margin (15) = ~195px */
        bottom: var(--fab-bottom-mobile-visible); /* Use CSS variable */
    }

    .carousel-item {
        width: 105px; /* Reduced by 30% from 150px */
        height: 63px; /* Reduced by 30% from 90px */
    }

    .carousel-caption h5 {
        font-size: 0.7rem;
    }

    .carousel-caption p { /* Hide story text */
        display: none;
    }

    #addStoryModal .modal-dialog {
        max-width: 95%; /* Ensure it doesn't take full width, leaving some margin */
        margin-top: 2rem; /* Move modal higher */
        margin-bottom: 0.5rem; /* Keep some margin at the bottom */
    }

    #addStoryModal .modal-content {
        max-height: calc(100vh - 1rem); /* Max height of viewport minus margins */
        overflow-y: auto; /* Enable scrolling for content if it exceeds max-height */
    }
}

/* Mobile layout for story list */
@media (max-width: 767px) {
    .story-list-header {
        display: grid;
        grid-template-columns: 80px 1fr; /* 80px for image, rest for title */
        grid-template-rows: auto auto auto auto;
        grid-template-areas:
            "image title"
            "author author"
            "family family"
            "type type";
        gap: 0 10px; /* No row gap, 10px column gap */
        align-items: center; /* Vertically align image and title in the first row */
    }

    .story-list-image {
        grid-area: image;
        width: 80px;
        height: 60px;
        margin-right: 0;
    }

    .story-list-title {
        grid-area: title;
        font-size: 1.1rem; /* Keep title size reasonable */
        margin-bottom: 0;
    }

    .story-list-author {
        grid-area: author;
        font-size: 1rem; /* Keep author size reasonable */
        margin-top: 10px; /* Space after title/image row */
        margin-bottom: 0.5rem !important;
    }

    .story-list-family {
        grid-area: family;
        font-size: 0.8rem !important; /* Smaller font as requested */
        margin-bottom: 0 !important;
    }
    
    .story-list-type {
        grid-area: type;
        font-size: 0.8rem !important; /* Smaller font as requested */
        margin-bottom: 0 !important;
    }
}

/* Mobile-specific overrides for story image previews */
@media (max-width: 767px) {
    #storyModal .story-images-container {
        display: flex;
        flex-wrap: nowrap; /* Ensure single line */
        justify-content: center; /* Center the items */
        overflow-x: auto; /* Enable horizontal scrolling */
        padding-bottom: 10px; /* Space for scrollbar */
        gap: 10px; /* Space between images */
    }

    #storyModal .story-image-item {
        flex: 0 0 80px; /* Don't grow, don't shrink, base width of 80px */
        width: 80px;
        height: 80px;
        border-radius: 0.25rem; /* Ensure rounded corners */
        overflow: hidden; /* Ensure image respects the border-radius */
    }

    #storyModal .story-image-item img {
        width: 100%;
        height: 100%;
        object-fit: cover; /* Make image square without distortion */
    }

    #storyModal .story-image-overlay {
        font-size: 1.5rem;
    }
}

/* --- Unified Map Control Button Styles --- */
.leaflet-bar a.map-control-button {
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    background-color: #D4AF37; /* Gold background */
    color: #000000; /* Black text */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border: none;
    font-size: 22px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    transition: background-color 0.3s ease, color 0.3s ease; /* Include color in transition */
    flex-shrink: 0; /* Prevent shrinking */
}

.leaflet-bar a.map-control-button:hover {
    background-color: #212529; /* Dark background on hover */
    color: #FFFFFF; /* White text on hover */
    /* text-shadow: none; /* Optional: remove text shadow on hover */
}

/* Container for the custom filter buttons */
.filter-control-container {
    display: flex; /* Make it a flex container */
    flex-direction: column; /* Stack items vertically */
    align-items: center; /* Center items horizontally */
    margin-bottom: 10px;
    border: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

/* --- Notifications Control Button --- */
.notifications-control-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
    border: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    position: relative; /* For badge positioning */
}

.notifications-control-container .map-control-button {
    position: relative;
}

.notifications-control-container .badge-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

/* --- Notifications Modal Styles --- */
#notificationsModal .modal-content {
    background-color: #212529; /* Dark background */
    color: #fff; /* White text */
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#notificationsModal .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

#notificationsModal .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

#notificationsModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

#notificationsModal .list-group-item {
    background-color: #343a40; /* Darker background for list items */
    border-color: #495057; /* Subtle border */
    color: #fff;
    margin-bottom: 5px;
    border-radius: 5px;
}

#notificationsModal .list-group-item.bg-primary-subtle {
    background-color: #495057 !important; /* Medium gray for unread */
}

#notificationsModal .list-group-item:hover {
    background-color: #495057;
}

#notificationsModal .list-group-item img {
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.filter-control-container .leaflet-control-custom-label {
    display: block;
    font-size: 0.7em; /* Smaller font for label */
    color: #fff;
    text-align: center;
    margin-top: 2px; /* Small margin from the button */
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px; /* Limit width to prevent stretching the container too much */
}

/* Specific styles for the Geocoder (search) button */
.leaflet-control-geocoder.leaflet-bar a.leaflet-control-geocoder-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #D4AF37; /* Gold background */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E"); /* Black search icon */
    background-size: 24px 24px;
    background-repeat: no-repeat;
    background-position: center;
    border: none;
}

.leaflet-control-geocoder.leaflet-bar a.leaflet-control-geocoder-icon:hover {
    background-color: #212529; /* Dark background on hover */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E"); /* White search icon */
}

.leaflet-touch .leaflet-control-geocoder.leaflet-bar a.leaflet-control-geocoder-icon {
    width: 50px;
    height: 50px;
}



/* --- Mini Profile Pop-up Styles --- */
/* --- Mini Profile Pop-up Styles --- */
.mini-profile-popup {
    position: absolute;
    background-color: #212529; /* Dark background */
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 9999; /* Increased z-index to ensure it's on top */
    min-width: 300px; /* Adjusted size */
    pointer-events: auto; /* Allow interaction with the popup */
    opacity: 1; /* Start visible, JS will handle show/hide */
    transform: translateY(0); /* Start in place, JS will handle transform */
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.mini-profile-popup .mini-profile-header img {
    border: 2px solid #ffd700; /* Gold border for avatar */
    width: 80px; /* Adjusted size */
    height: 80px; /* Adjusted size */
    object-fit: cover;
}

.mini-profile-popup .mini-profile-header h5 {
    font-size: 1.2rem;
    margin-bottom: 0;
}

.mini-profile-popup .mini-profile-stats p {
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

/* --- Story Modal Author Avatar Styling --- */
#storyModal .comment-user-info img {
    object-fit: cover;
    object-position: center;
}

#citySelectorModal .modal-content,
#countrySelectorModal .modal-content {
    background-color: #1a1a1a; /* Black background */
    color: #fff;
    border: 1px solid rgba(255, 215, 0, 0.5); /* Gold border */
}

#citySelectorModal .modal-header,
#countrySelectorModal .modal-header {
    border-bottom: 1px solid rgba(255, 215, 0, 0.5);
}

#citySelectorModal .btn-close,
#countrySelectorModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

#citySelectorModal .form-control,
#countrySelectorModal .form-control {
    background-color: #333;
    color: #fff;
    border-color: #555;
}

#city-list-container .list-group-item,
#country-list-container .list-group-item {
    background-color: transparent;
    color: #fff;
    border-color: #444;
}

#city-list-container .list-group-item:hover,
#country-list-container .list-group-item:hover {
    background-color: #333;
}

    #city-list-container,
    #country-list-container {
        height: 400px;
        overflow-y: auto;
    }
    
    /* --- Loading Spinner --- */
    .loading-spinner {
        display: none; /* Hidden by default */
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
    }
    
    /* --- Contact Page Styles --- */
    .contact-page {
        background-image: url('https://www.transparenttextures.com/patterns/dark-matter.png'), linear-gradient(rgba(0,0,0,0.8), rgba(0,0,0,0.8));
        background-blend-mode: overlay;
        background-size: auto, cover;
        background-position: center;
        min-height: 100vh;
    }
    
    .contact-card {
        background-color: rgba(33, 37, 41, 0.85);
        backdrop-filter: blur(10px);
        border-radius: 15px;
        padding: 2rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    }
    
    .contact-page .form-control,
    .contact-page .form-select {
        background-color: rgba(0, 0, 0, 0.2);
        color: #fff;
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    .contact-page .form-control:focus,
    .contact-page .form-select:focus {
        background-color: rgba(0, 0, 0, 0.3);
        color: #fff;
        border-color: #ffd700;
        box-shadow: 0 0 0 0.25rem rgba(255, 215, 0, 0.25);
    }
    
    .contact-page .form-label {
        color: #adb5bd;
    }
    
    .contact-page .form-select option {
        background-color: #212529;
        color: #fff;
    }
    
    .contact-info-box {
        text-align: center;
    }
    
    .contact-info-box img {
        max-width: 120px; /* Reduced size for UFO image */
        margin-bottom: 1.5rem;
        filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.5));
    }
    
    /* Apply top spacing for larger screens on main content areas */
    @media (min-width: 768px) {
        main.container {
            margin-top: 3rem !important;
            padding-top: 3rem !important;
        }
    }
    
    /* Increase YouTube button size by 50% for desktop */
    @media (min-width: 992px) {
        .youtube-button-desktop-lg {
            width: 80px !important; /* Doubled from 72px */
            height: 80px !important; /* Doubled from 72px */
            font-size: 1.875rem !important; /* Doubled from 1.875rem */
        }
    
            .youtube-button-desktop-lg .fab {
                font-size: 1.875rem !important; /* Reduced icon size */
            }    
        .youtube-button-container {
            bottom: 170px !important;
            padding-bottom: 0 !important; /* Remove padding if any, as bottom now defines the space */
        }
    }    
    .creepy-font {
        font-family: 'Creepster', cursive !important;
    }
    
    .product-img {
        aspect-ratio: 1 / 1; /* Makes the image square */
        object-fit: cover; /* Ensures the image covers the area, cropping if necessary */
        width: 100%; /* Ensures it takes the full width of its container */
        height: auto; /* Maintains aspect ratio */
    }

    .blog-subscribe-button-container {
        position: fixed;
        bottom: 0; /* Aligns to the very bottom */
        left: 0; /* Aligns to the very left */
        z-index: 1000;
        padding: 1rem; /* p-3 in Bootstrap is 1rem */
    }

    /* Specific styling for the button inside the container, similar to the main YouTube button */
    .blog-subscribe-button-container .btn {
        border-radius: 50% !important; /* Make it circular */
        width: 60px; /* Adjust size as needed */
        height: 60px; /* Adjust size as needed */
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem; /* Adjust icon size */
    }

    /* Responsive adjustment for mobile to lift it above the bottom nav */
    @media (max-width: 991.98px) {
        .blog-subscribe-button-container {
            bottom: 75px !important; /* Above the mobile bottom navigation (60px height + some margin) */
            padding: 0.5rem !important; /* Smaller padding for mobile */
        }
    }
    
    /* Style for the "Enviar Mensaje" button in contact form */
    #contact-form .btn-primary {
        background-color: #D4AF37; /* Gold background */
        color: #000000; /* Black text */
        border-color: #000000; /* Black border */
        font-weight: bold;
        transition: all 0.3s ease;
    }

    #contact-form .btn-primary:hover {
        background-color: #212529; /* Dark background on hover */
        color: #FFFFFF; /* White text on hover */
        border-color: #D4AF37; /* Gold border on hover */
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }

    /* Styles for buttons within modals in index.html */
    .modal .btn-primary {
        background-color: #D4AF37; /* Gold background */
        color: #000000; /* Black text */
        border-color: #000000; /* Black border */
        font-weight: bold;
        transition: all 0.3s ease;
    }

    .modal .btn-primary:hover {
        background-color: #212529; /* Dark background on hover */
        color: #FFFFFF; /* White text on hover */
        border-color: #D4AF37; /* Gold border on hover */
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }

    .modal .btn-secondary {
        background-color: #212529; /* Dark background */
        color: #D4AF37; /* Gold text */
        border-color: #D4AF37; /* Gold border */
        font-weight: bold;
        transition: all 0.3s ease;
    }

    .modal .btn-secondary:hover {
        background-color: #D4AF37; /* Gold background on hover */
        color: #000000; /* Black text on hover */
        border-color: #000000; /* Black border on hover */
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }

    /* For btn-success, treating it as primary gold theme */
    .modal .btn-success {
        background-color: #D4AF37; /* Gold background */
        color: #000000; /* Black text */
        border-color: #000000; /* Black border */
        font-weight: bold;
        transition: all 0.3s ease;
    }

    .modal .btn-success:hover {
        background-color: #212529; /* Dark background on hover */
        color: #FFFFFF; /* White text on hover */
        border-color: #D4AF37; /* Gold border on hover */
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }

    /* For btn-link in the intuitive bar */
    #addStoryModal .modal-body .btn-link {
        background-color: #212529 !important; /* Dark background */
        border: 1px solid #D4AF37; /* Gold border */
        color: #D4AF37 !important; /* Gold icon color */
        border-radius: 5px;
        font-weight: bold;
        transition: all 0.3s ease;
    }

    #addStoryModal .modal-body .btn-link:hover {
        background-color: #D4AF37 !important; /* Gold background on hover */
        color: #000000 !important; /* Black icon on hover */
        border-color: #000000 !important; /* Black border on hover */
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }

/* YouTube Subscribe Banner Styles */
.youtube-button-container {
    /* Existing z-index, but ensure display flex and align items */
    display: flex;
    align-items: center;
    padding: 0; /* Override any padding from p-3 utility class in HTML */
    /* Position fixed, bottom, and left are already in HTML for container */
}

#subscribe-banner {
    /* No background-color */
    color: #ff0000; /* Red text */
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 5px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px); /* Start slightly to the left */
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, visibility 0.3s ease-out;
    margin-left: 10px; /* Space between button and banner */
}

#subscribe-banner.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0); /* Slide into view */
}

/* Adjust for mobile if the container's left/bottom need to be different */
@media (max-width: 991.98px) {
    .youtube-button-container {
        left: 15px; /* Adjust for mobile if different from desktop default */
    }
    #subscribe-banner {
        padding: 6px 10px;
        font-size: 0.8em;
    }
}

/* Override existing youtube-button-container styles which might conflict */
@media (min-width: 992px) {
    .youtube-button-container {
        bottom: var(--fab-bottom-desktop-visible) !important; /* Ensure desktop bottom is correct */
        left: 25px !important; /* Ensure desktop left is correct */
    }
}

@media (max-width: 991.98px) {
    .youtube-button-container {
        bottom: 140px !important; /* Mobile bottom position from before */
        /* bottom: calc(var(--fab-bottom-mobile-visible) - 20px) !important; */ /* Alternative if fab-bottom is too high */
    }
}