/* Estilos para mensajes multimedia */

/* Estilos base para medios */
.media-image,
.media-sticker,
.media-document,
.media-audio,
.media-voice,
.media-video,
.media-contact,
.media-location,
.media-vcard,
.media-reaction,
.media-revoked {
    margin: 0.5rem 0;
}

/* Error de media */
.media-error {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
}

.dark-theme .media-error,
html.dark .media-error {
    background-color: #7f1d1d;
    color: #fecaca;
}

/* Placeholders para medios */
.media-placeholder {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 280px;
}

.media-placeholder:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}

.dark-theme .media-placeholder,
html.dark .media-placeholder {
    background-color: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}

.dark-theme .media-placeholder:hover,
html.dark .media-placeholder:hover {
    background-color: #334155;
    border-color: #64748b;
}

.placeholder-icon {
    font-size: 2rem;
    flex-shrink: 0;
    opacity: 0.8;
}

.placeholder-info {
    flex: 1;
    min-width: 0;
}

.placeholder-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.placeholder-date {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

.placeholder-action {
    font-size: 0.75rem;
    opacity: 0.6;
    font-style: italic;
}

/* Ocultar elementos */
.hidden {
    display: none !important;
}

/* Imágenes */
.media-image {
    position: relative;
}

.message-image {
    display: block;
    max-width: 250px;
    max-height: 250px;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    background-color: #fff;
    background-image:
      linear-gradient(45deg, #ccc 25%, transparent 25%),
      linear-gradient(-45deg, #ccc 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, #ccc 75%),
      linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.message-image:hover {
    opacity: 0.9;
}

.image-caption {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Stickers */
.media-sticker {
    text-align: center;
}

.sticker-static,
.sticker-animated {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
}

/* Documentos */
.media-document {
    max-width: 300px;
}

.document-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background-color: #f3f4f6;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
}

.dark-theme .document-container,
html.dark .document-container {
    background-color: #374151;
    border-color: #4b5563;
}

/* Document container en modo claro debe tener texto negro */
.light-theme .document-container {
    color: #000000;
}

.light-theme .document-name {
    color: #000000;
}

.light-theme .document-size {
    color: #000000;
}

.document-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.document-size {
    font-size: 0.75rem;
    opacity: 0.7;
}

.download-button {
    background-color: #3b82f6;
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.download-button:hover {
    background-color: #2563eb;
    color: white;
    text-decoration: none;
}

/* Audio y Voice */
.media-audio,
.media-voice {
    max-width: 300px;
}

.audio-player,
.voice-player {
    display: none; /* Ocultar reproductor nativo */
}

.audio-controls,
.voice-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: #f3f4f6;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
}

.dark-theme .audio-controls,
.dark-theme .voice-controls,
html.dark .audio-controls,
html.dark .voice-controls {
    background-color: #374151;
    border-color: #4b5563;
}

.play-pause-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: #25D366;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.play-pause-button:hover {
    background-color: #128C7E;
}

.audio-progress,
.voice-progress {
    flex: 1;
    height: 4px;
    background-color: #e5e7eb;
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.dark-theme .audio-progress,
.dark-theme .voice-progress,
html.dark .audio-progress,
html.dark .voice-progress {
    background-color: #4b5563;
}

.progress-bar {
    width: 100%;
    height: 100%;
    position: relative;
}

.progress-fill {
    height: 100%;
    background-color: #25D366;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s ease;
}

.speed-button {
    background-color: transparent;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 32px;
}

.dark-theme .speed-button,
html.dark .speed-button {
    border-color: #4b5563;
    color: #e5e7eb;
    background-color: #000000;
}

/* Speed button en modo claro debe tener fondo blanco */
.light-theme .speed-button {
    background-color: #ffffff;
}

.speed-button:hover {
    background-color: #f3f4f6;
}

.dark-theme .speed-button:hover,
html.dark .speed-button:hover {
    background-color: #4b5563;
}

.audio-time,
.voice-time {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* Voice específico */
.voice-icon {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

/* Videos */
.media-video {
    max-width: 300px;
}

.media-video video {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.video-caption {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Contactos */
.media-contact,
.media-vcard {
    width: 330px;
    max-width: 100%;
}

.contact-card,
.vcard-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background-color: #f3f4f6;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
}

.dark-theme .contact-card,
.dark-theme .vcard-container,
html.dark .contact-card,
html.dark .vcard-container {
    background-color: var(--urutienda-dark-2);
    border-color: #4b5563;
}

.contact-avatar,
.vcard-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.dark-theme .contact-avatar,
.dark-theme .vcard-avatar,
html.dark .contact-avatar,
html.dark .vcard-avatar {
    background-color: #4b5563;
}

.contact-info,
.vcard-info {
    flex: 1;
    min-width: 0;
}

.contact-name,
.vcard-name {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-number,
.vcard-phone,
.vcard-email {
    font-size: 0.75rem;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.light-theme .contact-name,
.light-theme .vcard-name,
.light-theme .contact-number,
.light-theme .vcard-phone,
.light-theme .vcard-email {
    color: #000000;
}

.contact-chat-button,
.vcard-chat-button {
    background-color: #25D366;
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.contact-chat-button:hover,
.vcard-chat-button:hover {
    background-color: #128C7E;
    color: white;
    text-decoration: none;
}

/* Ubicaciones */
.media-location {
    max-width: 280px;
}

.location-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background-color: #f3f4f6;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
}

.dark-theme .location-card,
html.dark .location-card {
    background-color: #374151;
    border-color: #4b5563;
}

.location-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.location-info {
    flex: 1;
    min-width: 0;
}

.location-address {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.location-coordinates {
    font-size: 0.75rem;
    opacity: 0.7;
    font-family: 'Courier New', monospace;
}

.maps-button {
    background-color: #ea4335;
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.maps-button:hover {
    background-color: #d33b2c;
    color: white;
    text-decoration: none;
}

/* Reacciones */
.media-reaction {
    position: absolute;
    top: -10px;
    right: -10px;
    z-index: 10;
}

.reaction-bubble {
    background-color: white;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dark-theme .reaction-bubble,
html.dark .reaction-bubble {
    background-color: #374151;
    border-color: #4b5563;
}

.reaction-emoji {
    font-size: 1rem;
    line-height: 1;
}

/* Mensajes revocados */
.media-revoked {
    max-width: 300px;
}

.revoked-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 0.5rem;
    font-style: italic;
}

.dark-theme .revoked-container,
html.dark .revoked-container {
    background-color: #2d3748;
    border-color: #4a5568;
}

.revoked-text {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Lightbox para imágenes */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
}

.lightbox-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    background-color: #fff;
    background-image:
      linear-gradient(45deg, #ccc 25%, transparent 25%),
      linear-gradient(-45deg, #ccc 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, #ccc 75%),
      linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.lightbox-close:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .media-image .message-image {
        max-width: 200px;
        max-height: 200px;
    }
    
    .media-document,
    .media-audio,
    .media-voice,
    .media-video,
    .media-contact,
    .media-location,
    .media-vcard {
        max-width: 240px;
    }
    
    .document-container,
    .audio-controls,
    .voice-controls,
    .contact-card,
    .vcard-container,
    .location-card {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 1.25rem;
    }
}
