:root {
    --voice-accent-color: #ff6600;
    /* Toneart Orange */
    --voice-accent-hover: #e65c00;
    --voice-glow: 0 0 15px rgba(255, 102, 0, 0.4);
    --voice-text-color: #fff;
    --voice-bg-dark: #1a1a1a;
    --voice-accent-strong: #ff5b00;
    --voice-accent-soft: #ffb168;
    --voice-surface: #fff7f0;
    --voice-font: var(--font-family, 'Syne', Arial, sans-serif);
}

.voice-enabled-block {
    position: relative !important;
    /* Force relative to contain absolute buttons */
}

.voice-player-container {
    /* position: absolute; */
    top: 0;
    right: 0;
    z-index: 20;
    font-family: var(--voice-font);
    letter-spacing: 0.2px;
}

.voice-controls-wrapper {
    display: flex;
    align-items: center;
    /* justify-content: flex-end; */
}

/* --- Play Button (StoryVoice X CTA) --- */
.voice-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
    gap: 0;
    background: linear-gradient(135deg, #ff8a1f 0%, #ff6a00 45%, #ff4a00 100%) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 999px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(255, 106, 0, 0.4), 0 12px 26px rgba(255, 106, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    white-space: normal;
    text-transform: none;
    min-width: 220px;
}

.voice-play-btn::before {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 60%);
    opacity: 0.65;
    pointer-events: none;
}

.voice-play-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 28px rgba(255, 106, 0, 0.5), 0 16px 30px rgba(255, 106, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    filter: saturate(1.05);
}

.voice-play-btn:active {
    transform: translateY(0);
    box-shadow: 0 10px 18px rgba(255, 106, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* New Stacked Layout Styles */
.voice-play-btn .voice-btn-text {
    display: flex;
    flex-direction: column;
    text-align: left;
    margin-left: 12px;
    line-height: 1.2;
    position: relative;
    z-index: 1;
}

.voice-play-btn .voice-btn-title {
    font-size: 17px;
    font-weight: 600;
    display: block;
}

.voice-play-btn .voice-btn-subtitle {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
    display: block;
}

.voice-play-btn.is-disabled .voice-btn-subtitle.voice-subtitle-limit {
    opacity: 1;
    font-weight: 500;
}

/* .voice-play-btn:hover {
    background: linear-gradient(135deg, #ff7700 0%, #ff6600 100%);
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 0 25px rgba(255, 102, 0, 0.8), 0 6px 15px rgba(0, 0, 0, 0.25);
}

.voice-play-btn:active {
    transform: translateY(0) scale(0.99);
    box-shadow: 0 0 10px rgba(255, 102, 0, 0.5);
} */

.voice-btn-icon svg {
    width: 33px;
    height: 33px;
    fill: #ffffff;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.2));
}

/* --- Active Controls Container --- */
.voice-active-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    row-gap: 8px;
    background: var(--secondary-background-color, #1f1f1f);
    padding: 8px 14px;
    border-radius: 22px;
    box-shadow: 0 10px 24px rgba(22, 12, 2, 0.12);
    border: 1px solid var(--border-color, rgba(255, 102, 0, 0.2));
    animation: voice-fade-in 0.3s ease-out;
    min-height: 52px;
}

.voice-active-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-strong-color, #fff);
    padding-right: 16px;
    position: relative;
    min-width: 0;
    white-space: nowrap;
}

.voice-active-status::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 22px;
    background: var(--border-color, rgba(255, 102, 0, 0.2));
}

.voice-active-status svg {
    width: 18px;
    height: 18px;
    animation: voice-pulse 2s infinite;
    color: var(--toneart-orange, #fb8500);
}

.voice-status-text {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
}

.voice-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* --- Waveform (Playing Indicator) --- */
.voice-waveform {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 6px;
    margin-left: 6px;
    opacity: 0.35;
}

.voice-waveform span {
    width: 3px;
    height: 8px;
    border-radius: 999px;
    background: var(--toneart-orange, #fb8500);
    box-shadow: 0 0 12px rgba(251, 133, 0, 0.4);
    transform-origin: center bottom;
    animation: voice-wave 1s ease-in-out infinite;
    animation-play-state: paused;
}

.voice-active-controls.is-playing .voice-waveform {
    opacity: 1;
}

.voice-active-controls.is-playing .voice-waveform span {
    animation-play-state: running;
}

.voice-active-controls.is-paused .voice-waveform span {
    animation-play-state: paused;
    opacity: 0.5;
}

.voice-waveform span:nth-child(1) { animation-delay: 0s; }
.voice-waveform span:nth-child(2) { animation-delay: 0.12s; }
.voice-waveform span:nth-child(3) { animation-delay: 0.24s; }
.voice-waveform span:nth-child(4) { animation-delay: 0.36s; }
.voice-waveform span:nth-child(5) { animation-delay: 0.48s; }
.voice-waveform span:nth-child(6) { animation-delay: 0.36s; }
.voice-waveform span:nth-child(7) { animation-delay: 0.24s; }
.voice-waveform span:nth-child(8) { animation-delay: 0.12s; }

@keyframes voice-wave {
    0% { transform: scaleY(0.5); opacity: 0.55; }
    50% { transform: scaleY(1.6); opacity: 1; }
    100% { transform: scaleY(0.7); opacity: 0.7; }
}

/* --- Control Buttons (Pause/Stop) --- */
.voice-control-btn {
    appearance: none;
    background: transparent !important;
    border: 1px solid var(--border-color, rgba(255, 102, 0, 0.2));
    color: var(--toneart-orange, #fb8500);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 8px 18px rgba(22, 12, 2, 0.16), var(--inset-shadow, inset 0 1px 1px rgba(255, 255, 255, 0.7));
}

.voice-control-btn:hover {
    background: var(--orange-gradient, #fb8500);
    color: var(--text-strong-color, #fff);
    border-color: var(--border-color, rgba(255, 102, 0, 0.2)) !important;
}

.voice-control-btn:active {
    transform: translateY(1px);
    box-shadow: 0 4px 10px rgba(22, 12, 2, 0.18);
}

.voice-control-btn svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

/* --- Hover Overlay --- */
.voice-hover-overlay {
    position: absolute;
    bottom: 120%;
    right: auto;
    left: 0;
    width: 280px;
    background: linear-gradient(180deg, var(--simple-bg, #000), var(--secondary-background-color, #1f1f1f));
    color: var(--text-strong-color, #fff);
    padding: 14px 16px;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), 0 0 30px rgba(255, 138, 31, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-out;
    z-index: 1000;
    pointer-events: none;
    text-align: left;
    border: 1px solid var(--border-color, rgba(245, 166, 35, 0.5));
    backdrop-filter: blur(6px);
}

.voice-hover-overlay.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(-5px);
}

.voice-hover-overlay::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 20px;
    right: auto;
    border-width: 6px;
    border-style: solid;
    border-color: #FF9800 transparent transparent transparent;
}

.voice-overlay-headline {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 9px;
    color: var(--text-strong-color, #fff);
    /* border-bottom: 1px solid #FF8A1F; */
    /* padding-bottom: 9px; */
    /* position: relative; */
}

/* .voice-overlay-headline:after {
    content: "";
    bottom: -2.1px;
    position: absolute;
    height: 3.8px;
    width: 100%;
    background: #FF8A1F;
    left: 0;
    right: 0;
    max-width: 50px;
    margin: 0 auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 18px rgba(255, 138, 0, 0.25);
    display: block;
} */

.voice-overlay-subline {
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-color, #b3b3b3);
    font-weight: 500;
}


/* .light-mode .voice-overlay-subline,
.light-mode .voice-overlay-headline {
    color: #000;
} */

svg.headphone-svg {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    position: relative;
    top: 3px;
    fill: var(--toneart-orange, #F5A623);
}

/* .light-mode svg.headphone-svg {
    fill: #000;
} */


@media screen and (min-width:769px) {
    .toneart-testimonials .voice-player-container {
    top: 15px;
    right: 15px;
}
    .product.attribute.overview .voice-player-container {
        top: 15px;
        right: 15px;
    }
    .product.attribute.description .value {
        padding-top: 15px;
    }
}

/* --- Loading State --- */
.voice-loading-state {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    background: var(--secondary-background-color) !important;
    border-radius: 50px;
    border: 1px solid var(--border-color, rgba(255, 102, 0, 0.18));
    box-shadow: 0 10px 24px rgba(22, 12, 2, 0.12);
}

.voice-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top: 2px solid #333;
    border-top-color: var(--voice-accent-color);
    border-radius: 50%;
    animation: voice-spin 1s linear infinite;
    flex-shrink: 0;
}

.voice-loading-text {
    font-size: 12px;
    color: var(--text-color, #b3b3b3);
    line-height: 1.3;
}

.voice-countdown {
    font-size: 14px;
    font-weight: 600;
    color: var(--voice-accent-color);
    width: 20px;
    text-align: center;
}

/* --- Animations --- */
@keyframes voice-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes voice-fade-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes voice-pulse {
    0% {
        opacity: 0.6;
        transform: scale(0.95);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    100% {
        opacity: 0.6;
        transform: scale(0.95);
    }
}

/* --- Mobile / Responsive Tweaks --- */
@media (max-width: 768px) {
    .voice-play-btn.is-disabled.has-custom-tooltip:hover::before {
        right: -130px !important;
    }
    .voice-player-container {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        margin-bottom: 25px;
        /* Push content down */
    }

    .voice-play-btn {
        justify-content: center;
        padding: 14px 20px;
        /* Larger touch area */
    }

    .voice-active-controls {
        width: auto;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .voice-active-controls {
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 18px;
    }

    .voice-active-status {
        flex: 1 1 100%;
        padding-right: 0;
        font-size: 12px;
    }

    .voice-active-status::after {
        display: none;
    }

    .voice-actions {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        gap: 10px;
        margin-left: 0;
    }

    .voice-control-btn {
        width: 50px;
        height: 50px;
    }
}

.product.attribute.description .voice-hover-overlay {
    top: 130%;
    bottom: auto;
    background: linear-gradient(180deg, var(--simple-bg, #000), var(--secondary-background-color, #1f1f1f));
}

/* .light-mode .product.attribute.description .voice-hover-overlay {
    background: #fff;
} */

.product.attribute.description .voice-hover-overlay::after {
    content: '';
    top: -13px;
    border-color: transparent transparent #FF8A1F transparent;
}

/* .product.attribute.description .voice-play-btn:hover {
    transform: translateY(0px) scale(1);
} */

.catalog-product-view:not(.light-mode) .product.attribute.overview .voice-btn-text span {
    color: #fff !important;
}

.ein-moment {
    border-block: 1px solid var(--border-color, rgba(0, 0, 0, 0.2));
    margin-block: 9px !important;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-color, #b3b3b3);
    padding: 6px 0;
}

.ein-moment-arrow {
    color: var(--toneart-orange, #fb8500);
    font-size: 20px;
    line-height: 1;
}

/* --- Disabled State (Daily Limit) --- */
.voice-play-btn.is-disabled {
    background: linear-gradient(135deg, #ff8a1fe0 0%, #ff6a00a3 45%, #ff4a00d1 100%) !important; /* Keep background but faded */
    opacity: 1;
    cursor: not-allowed;
    filter: grayscale(35%);
    pointer-events: auto; /* keep tooltip working */
    box-shadow: none;
}

.voice-play-btn.is-disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Lock overlay on play icon */
.voice-play-btn.is-disabled .voice-btn-icon {
    position: relative;
    z-index: 10;
}

.voice-play-btn.is-disabled .voice-btn-icon,
.voice-play-btn.is-disabled .voice-btn-text {
    opacity: 0.7;
}

.voice-play-btn.is-disabled .voice-btn-icon::after {
    content: "🔒";
    position: absolute;
    bottom: -6px;
    right: -8px;
    font-size: 14px;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.5));
}

/* --- Custom Tooltip (Hover) --- */
.voice-play-btn.is-disabled.has-custom-tooltip {
    position: relative; /* Anchor for absolute tooltip */
    overflow: visible; /* Allow tooltip to render outside button */
    z-index: 5;
}

/* Tooltip Background/Text */
.voice-play-btn.is-disabled.has-custom-tooltip:hover::before {
    content: "Heute bereits angehört – morgen wieder verfügbar";
    position: absolute;
    bottom: 100%;
    left: auto;
    right: 0;
    transform: none;
    margin-bottom: 12px;
    background-color: #222;
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    animation: voice-fade-in 0.2s forwards;
    text-transform: none;
    line-height: 1.4;
    height: 20px;
    top: -44px;
}

/* Tooltip Arrow */
.voice-play-btn.is-disabled.has-custom-tooltip:hover::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: auto;
    right: 30px; /* Position arrow near the right */
    transform: none;
    margin-bottom: 4px; /* Adjust based on bubble */
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: #222 transparent transparent transparent;
    z-index: 100;
    pointer-events: none;
    /* Fade In */
    opacity: 0;
    animation: voice-fade-in 0.2s forwards;
}

.voice-actions {
    display: flex;
    gap:10px;
}
