#user-photos-container {
    margin: 30px 0;
}

#user-photos-container.photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.user-photos-gallery .gallery-item-container {
    width: 100%;
    height: 220px;
    object-fit: cover;
}
.user-photos-gallery .gallery-item-container:hover {
    opacity: .93;
    brightness: 1.03;
}

.user-photos-gallery a.gallery-item {
    width: 100%;
}

.user-photos-gallery .gallery-item-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Estilos para la modal de imagen */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.8);
}

.image-modal-content {
    display: flex;
    height: 90%;
    width: 90%;
    max-width: 1200px;
    margin: 50px auto;
    background-color: #1a1a1a;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.image-slider {
    flex: 0 0 70%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: black;
    border-radius: 10px 0 0 10px;
}

.image-display {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    overscroll-behavior: contain;
    touch-action: none;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.18s ease;
    will-change: transform;
}

.modal-image.is-zooming {
    transition: none;
}

.image-display.is-zoomed {
    cursor: grab;
}

.image-display.is-zoomed:active {
    cursor: grabbing;
}

.image-counter {
    position: absolute;
    z-index: 25;
    top: 10px;
    right: 10px;
    color: white;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 14px;
    font-weight: bold;
    display: none;
}

.image-modal-info {
    position: relative;
    z-index: 3;
    flex: 0 0 30%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    background-color: #ffffff;
    color: #333;
    border-left: 1px solid #e1e1e1;
    border-radius: 0 10px 10px 0;
}

.modal-post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.modal-user-info {
    display: flex;
    align-items: center;
    max-width: 85%;
    width: 100%;
}

.modal-user-avatar {
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    max-width: initial;
}

.modal-user-author-info {
    display: flex;
    flex-direction: column;
    align-items: baseline;
    width: 100%;
}

.modal-author-name {
    font-weight: bold;
    color: #1e293b;
    font-size: 16.5px;
    cursor: pointer;
}

a.modal-name-link {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 54px);
}

.modal-post-date {
    font-size: 13.5px;
    color: #888;
    margin-left: 10px;
    margin-top: -3px;
}

.modal-user-rating {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background-color: #1e293b;
    padding: 5px 7px 6px 5px;
    text-align: center;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    border-radius: calc(32px / 5.5) calc(32px / 5.5) calc(32px / 5.5) 0;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s, transform 0.3s;
}

.modal-user-rating::before {
    content: '★';
    color: #ffc107;
    margin-right: 2px;
    font-size: 17.5px;
}

.modal-post-title {
    font-weight: bold;
    margin-top: 10px;
    margin-bottom: 5px;
    font-size: 17px;
    color: #1e293b;
    word-break: break-word;
}

.modal-post-title a {
    color: #333;
    transition: color 0.3s;
}

.modal-post-title a:hover {
    text-decoration: underline;
    color: #045cb4;
}

.modal-post-content {
    font-size: 16px;
    color: #333;
    line-height: 1.6;
    word-break: break-word;
    white-space: break-spaces;
}

.image-modal .close-button {
    display: inline-flex;
    z-index: 139;
    position: absolute;
    top: -21px;
    left: -19px;
    height: 40px;
    width: 40px;
    padding: 8px;
    background: white;
    border-radius: 100%;
    font-size: 18px;
    cursor: pointer;
    color: #1e293b;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.24);
    align-items: center;
    justify-content: center;
}
.image-modal .close-button:hover {
    color: #cc0000;
}

.prev-button,
.next-button {
    position: absolute;
    z-index: 20;
    top: 50%;
    width: auto;
    margin-top: -22px;
    line-height: 10px;
    padding: 18px;
    color: white;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    user-select: none;
    background-color: rgba(0, 0, 0, 0.4);
    border: none;
    border-radius: 50%;
    transition: background-color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}
.next-button {
    right: 10px;
}
.prev-button {
    left: 10px;
}

.prev-button:focus, .next-button:focus {
    background-color: rgba(0, 0, 0, 0.4) !important;
}
.prev-button:hover, .next-button:hover {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

.no-scroll {
    overflow: hidden;
}

/* Contenedor botones en la modal de imagen */
.modal-buttons-container {
    margin-top: 10px;
}

.modal-buttons-container button {
    font-weight: 700;
}

@keyframes modalOpen {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Estilos para el tooltip de usuario */
.user-tooltip {
    display: none;
    position: absolute;
    z-index: 1001;
    width: 300px;
    background-color: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 15px;
    font-family: 'Arial', sans-serif;
    color: #333;
    transition: opacity 0.3s ease;
}

.tooltip-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tooltip-user-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    margin-bottom: 2px;
}

.tooltip-user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.tooltip-author-name {
    font-weight: bold;
    color: #1e293b;
    font-size: 16.5px;
}

.tooltip-nicename {
    font-size: 13.5px;
    color: #888;
    margin-top: -4px
}

.tooltip-profile-stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin: 8px 0 12px 0;
    gap: 15px;
}

.tooltip-profile-stats span {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1; /* Asigna un espacio igual a cada elemento */
    text-align: center;
}

.tooltip-stats-number {
    line-height: 16px;
}

.tooltip-profile-stats span:first-child {
    font-size: 16.5px;
    font-weight: bold;
    color: #161823;
}

.tooltip-profile-stats span:last-child {
    font-size: 14px;
    color: #919191;
    font-weight: 300;
}

/* Reutilizar estilos de botones del perfil */
.tooltip-follow-button {
    color: #fff;
    background: #046bd2;
    border: none;
    padding: 10px 0;
    cursor: pointer;
    border-radius: 5px;
    font-size: 14.5px;
    white-space: nowrap;
    width: 135px;
    min-width: 135px;
    transition: background-color 0.3s ease;
}
.tooltip-follow-button:focus {
    background-color: #046bd2;
}
.tooltip-follow-button:hover {
    background-color: #0060c1;
}
.tooltip-follow-button:active {
    background-color: #0056b3;
}

.tooltip-follow-button.following {
    background-color: #f20000;
}
.tooltip-follow-button.following:focus {
    background-color: #f20000;
}
.tooltip-follow-button.following:hover {
    background-color: #df0000;
}
.tooltip-follow-button.following:active {
    background-color: #cc0000;;
}

@media screen and (max-width: 768px) {
    #user-photos-container.photos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .user-photos-gallery .gallery-item-container {
        height: 150px;
    }
}

/* Modal imagen: mobile + tablet */
@media screen and (max-width: 1024px) {
    .image-modal {
        background-color: #000;
        overflow: hidden;
    }

    .image-modal-content {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 100dvh;
        max-width: none;
        margin: 0;
        border-radius: 0;
        background-color: #000;
    }

    @supports not (height: 100dvh) {
        .image-modal-content {
            height: 100vh;
        }
    }

    .image-slider {
        flex: 0 0 64dvh;
        width: 100%;
        height: 64dvh;
        max-height: 64dvh;
        min-height: 240px;
        border-radius: 0;
        background-color: #000;
    }

    .image-display {
        touch-action: none;
        background-color: #000;
    }

    .modal-image {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        user-select: none;
        -webkit-user-drag: none;
        -webkit-touch-callout: none;
    }

    .image-modal-info {
        flex: 1 1 auto;
        width: 100%;
        height: auto;
        min-height: 0;
        padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border-left: 0;
        border-top: 1px solid #e1e1e1;
        border-radius: 0;
        background-color: #fff;
    }

    .modal-post-header {
        align-items: flex-start;
        gap: 12px;
    }

    .modal-user-info {
        min-width: 0;
        max-width: calc(100% - 54px);
    }

    .modal-user-author-info {
        min-width: 0;
    }

    a.modal-name-link {
        max-width: 100%;
    }

    .modal-post-title {
        font-size: 16.7px;
    }

    .modal-post-content {
        font-size: 15.1px;
        line-height: 1.55;
    }

    .image-modal .close-button {
        top: calc(8px + env(safe-area-inset-top));
        right: 8px;
        left: auto;
        z-index: 140;
        height: 37px;
        width: 37px;
        padding: 11px;
        border: 1px solid rgba(255, 255, 255, 0.85) !important;
        border-radius: 999px;
        background: rgba(0, 0, 0, 0.32);
        color: #fff;
        line-height: 1;
        font-size: 16px;
        transition: background-color .15s ease, color .15s ease, border-color .15s ease;
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
    }

    .image-modal .close-button:hover {
        background: rgba(255, 255, 255, 0.18);
        color: #fff;
        border-color: #fff !important;
    }

    .image-counter {
        top: calc(8px + env(safe-area-inset-top));
        left: 8px;
        right: auto;
        z-index: 130;
        border-radius: 999px;
        background-color: rgba(0, 0, 0, 0.58);
    }

    .prev-button,
    .next-button {
        z-index: 130;
        width: 42px;
        height: 42px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background-color: rgba(0, 0, 0, 0.38);
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
    }

    .prev-button {
        left: 8px;
    }

    .next-button {
        right: 8px;
    }

    .modal-buttons-container {
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 12px;
    }
}

/* Pantallas bajas o móvil horizontal */
@media screen and (max-width: 1024px) and (max-height: 560px) {
    .image-slider {
        flex-basis: 58dvh;
        height: 58dvh;
        max-height: 58dvh;
        min-height: 185px;
    }

    .image-modal-info {
        padding-top: 12px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }

    .modal-post-content {
        font-size: 14.5px;
        line-height: 1.45;
    }
}