/**
 * Siete Audio - Embed Widgets Styles
 *
 * Styles for iVoox embeds and audio shortcode replacement
 *
 * @package Siete_Audio
 * @since   1.0.4
 */

/* === Variables === */
.siete-audio-embed {
    --embed-accent: var(--siete-audio-accent, #f7941d);
    --embed-secondary: var(--siete-audio-secondary, #ed1c24);
    --embed-text: var(--siete-audio-text, #1a1a1a);
    --embed-muted: var(--siete-audio-muted, #6b7280);
    --embed-bg: var(--siete-audio-bg, #ffffff);
    --embed-border: var(--siete-audio-border, #e5e7eb);
    --embed-radius: 12px;
}

/* === Reset === */
.siete-audio-embed,
.siete-audio-embed * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.siete-audio-embed {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* === Main Container === */
.siete-audio-embed {
    width: 100%;
    max-width: 100%;
    margin: 16px 0 20px;
    background: var(--embed-bg);
    border: 1px solid var(--embed-border);
    border-radius: var(--embed-radius);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.siete-audio-embed:hover {
    border-color: var(--embed-accent);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.siete-audio-embed.is-playing {
    border-color: var(--embed-accent);
    border-width: 2px;
    box-shadow: 0 0 0 3px rgba(247, 148, 29, 0.12),
                0 12px 32px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* === Inner Layout === */
.siete-audio-embed__inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 16px 14px;
    flex-wrap: wrap;
}

/* === Artwork === */
.siete-audio-embed__artwork {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.siete-audio-embed__artwork-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.siete-audio-embed__artwork--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--embed-accent), var(--embed-secondary));
}

.siete-audio-embed__artwork--audio.siete-audio-embed__artwork--placeholder {
    background: linear-gradient(135deg, var(--embed-accent), var(--embed-secondary));
}

.siete-audio-embed__placeholder-icon {
    width: 32px;
    height: 32px;
    color: rgba(255, 255, 255, 0.5);
}

/* === Play Overlay === */
.siete-audio-embed__play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background-color 0.2s ease;
}

.siete-audio-embed__artwork:hover .siete-audio-embed__play-overlay {
    background: rgba(0, 0, 0, 0.4);
}

.siete-audio-embed__play-overlay .siete-audio-embed__play-btn {
    opacity: 1;
    transform: scale(1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.siete-audio-embed__artwork:hover .siete-audio-embed__play-overlay .siete-audio-embed__play-btn {
    transform: scale(1.05);
}

/* Show play button on placeholder artwork */
.siete-audio-embed__artwork--placeholder .siete-audio-embed__play-overlay .siete-audio-embed__play-btn {
    opacity: 1;
    transform: scale(1);
}

.siete-audio-embed__artwork--placeholder .siete-audio-embed__placeholder-icon {
    opacity: 0.3;
}

.siete-audio-embed__artwork--placeholder:hover .siete-audio-embed__placeholder-icon {
    opacity: 0.1;
}

/* === Play Button === */
.siete-audio-embed__play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--embed-accent), var(--embed-secondary));
    color: white;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.siete-audio-embed__play-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.2);
    filter: brightness(1.05);
}

.siete-audio-embed__play-btn:active {
    transform: scale(0.94);
}

.siete-audio-embed__play-btn:focus-visible {
    outline: 2px solid var(--embed-accent);
    outline-offset: 2px;
}

.siete-audio-embed__play-btn svg {
    width: 24px;
    height: 24px;
}

.siete-audio-embed__play-btn .siete-audio-embed__icon--play {
    margin-left: 3px;
}

/* Right-aligned play button (no artwork) */
/* === Content === */
.siete-audio-embed__content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.siete-audio-embed__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--embed-text);
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.siete-audio-embed__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--embed-muted);
    margin-bottom: 6px;
}

.siete-audio-embed__separator {
    opacity: 0.5;
}

.siete-audio-embed__program {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.siete-audio-embed__source {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--embed-text);
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--embed-border);
    border-radius: 10px;
}

.siete-audio-embed__source svg {
    width: 14px;
    height: 14px;
}

.siete-audio-embed__ivoox-logo {
    color: var(--embed-accent);
}

.siete-audio-embed__audio-icon {
    color: var(--embed-accent);
}

.siete-audio-embed__duration {
    font-weight: 600;
}

/* === Playing State === */
.siete-audio-embed.is-playing .siete-audio-embed__icon--play {
    display: none;
}

.siete-audio-embed.is-playing .siete-audio-embed__icon--pause {
    display: block !important;
}

.siete-audio-embed.is-playing .siete-audio-embed__play-overlay .siete-audio-embed__play-btn {
    opacity: 1;
    transform: scale(1);
}

/* === iVoox Specific === */
.siete-audio-embed--ivoox .siete-audio-embed__artwork--placeholder {
    background: linear-gradient(135deg, #f97316, #ea580c);
}

/* === Audio Specific === */
.siete-audio-embed--audio .siete-audio-embed__play-btn {
    background: linear-gradient(135deg, var(--embed-accent), var(--embed-secondary));
}

/* === Dark Mode === */
@media (prefers-color-scheme: dark) {
    .siete-audio-embed {
        --embed-text: #ffffff;
        --embed-muted: #9ca3af;
        --embed-bg: #1f2937;
        --embed-border: #374151;
    }

    .siete-audio-embed__artwork {
        background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    }
}

/* Force dark mode when dock is dark */
.siete-audio-embed[data-theme="dark"] {
    --embed-text: #ffffff;
    --embed-muted: #9ca3af;
    --embed-bg: #1f2937;
    --embed-border: #374151;
}

/* === Responsive === */
@media (max-width: 480px) {
    .siete-audio-embed__inner {
        gap: 10px;
        padding: 12px;
        align-items: flex-start;
    }

    .siete-audio-embed__content {
        width: 100%;
    }

    .siete-audio-embed__artwork {
        width: 64px;
        height: 64px;
    }

    .siete-audio-embed__play-btn {
        width: 40px;
        height: 40px;
    }

    .siete-audio-embed__play-btn svg {
        width: 20px;
        height: 20px;
    }

    .siete-audio-embed__title {
        font-size: 14px;
    }

    .siete-audio-embed__meta {
        font-size: 12px;
    }

    .siete-audio-embed__program {
        max-width: 120px;
    }
}

/* === Animation for loading state === */
@keyframes siete-embed-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.siete-audio-embed.is-loading .siete-audio-embed__play-btn {
    animation: siete-embed-pulse 1.5s ease-in-out infinite;
}
