/* WebSpeak WP TTS - Text to Speech for WordPress */
:root {
    --player-color: #3B82F6;
    --player-color-rgb: 59, 130, 246;
}

.webspeak-player {
    max-width: 100%;
    margin: 35px 0;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.webspeak-player:hover {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    transform: translateY(-3px);
}

.audio-player-wrapper {
    padding: 22px 28px;
    position: relative;
    overflow: hidden;
}

/* Modern Gradient Style */
.player-style-modern .audio-player-wrapper {
    background: linear-gradient(135deg, var(--player-color) 0%, #1D4ED8 100%);
    color: #ffffff;
}

.player-style-modern .audio-title,
.player-style-modern .audio-subtitle,
.player-style-modern .audio-time-info {
    color: #ffffff;
}

.player-style-modern .audio-icon-box {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.player-style-modern .audio-wave-icon {
    color: #ffffff;
}

.player-style-modern .audio-progress-track {
    background: rgba(255, 255, 255, 0.25);
}

.player-style-modern .audio-progress-filled {
    background: linear-gradient(90deg, #ffffff 0%, rgba(255, 255, 255, 0.9) 100%);
}

.player-style-modern .audio-stop-button {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.player-style-modern .audio-speed-button {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.player-style-modern .audio-speed-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Minimal Style */
.player-style-minimal .audio-player-wrapper {
    background: #ffffff;
    border: 2px solid #e5e7eb;
}

.player-style-minimal .audio-icon-box {
    background: #f3f4f6;
}

.player-style-minimal .audio-wave-icon {
    color: var(--player-color);
}

.player-style-minimal .audio-progress-track {
    background: #e5e7eb;
}

.player-style-minimal .audio-progress-filled {
    background: linear-gradient(90deg, var(--player-color) 0%, #1D4ED8 100%);
}

/* Classic Style */
.player-style-classic .audio-player-wrapper {
    background: #fffbeb;
    border: 2px solid #fbbf24;
}

.player-style-classic .audio-icon-box {
    background: #fbbf24;
}

.player-style-classic .audio-wave-icon {
    color: #78350f;
}

.player-style-classic .audio-progress-track {
    background: #fde68a;
}

.player-style-classic .audio-progress-filled {
    background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
}

/* Glassmorphism Style */
.player-style-glassmorphism .audio-player-wrapper {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.player-style-glassmorphism .audio-icon-box {
    background: rgba(var(--player-color-rgb), 0.15);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--player-color-rgb), 0.2);
}

.player-style-glassmorphism .audio-wave-icon {
    color: var(--player-color);
}

/* SINGLE LINE LAYOUT */
.audio-header-section {
    display: flex;
    align-items: center;
    gap: 18px;
    width: 100%;
}

.audio-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--player-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(var(--player-color-rgb), 0.3);
}

.webspeak-player:not(.player-style-modern) .audio-icon-box {
    background: var(--player-color);
}

.webspeak-player.playing .audio-icon-box {
    animation: pulse 2s infinite;
    box-shadow: 0 0 20px rgba(var(--player-color-rgb), 0.5);
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(var(--player-color-rgb), 0.3);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 6px 25px rgba(var(--player-color-rgb), 0.4);
    }
}

.audio-icon-box:hover {
    transform: scale(1.08) rotate(5deg);
}

.audio-wave-icon {
    color: #ffffff;
    width: 24px;
    height: 24px;
}

.audio-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    min-width: 0;
    flex: 1;
}

.audio-title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.audio-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    font-weight: 500;
    opacity: 0.85;
}

/* Controls Section */
.audio-controls-section {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.audio-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--player-color);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(var(--player-color-rgb), 0.3);
    position: relative;
    overflow: hidden;
}

.audio-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.audio-btn:hover::before {
    opacity: 1;
}

.audio-btn svg {
    position: relative;
    z-index: 1;
}

.audio-btn:hover {
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 8px 25px rgba(var(--player-color-rgb), 0.4);
}

.audio-btn:active {
    transform: translateY(0) scale(0.98);
}

.audio-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.audio-play-button {
    width: 48px;
    height: 48px;
}

.audio-play-button svg {
    width: 22px;
    height: 22px;
}

.icon-play,
.icon-pause {
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.audio-stop-button {
    background: rgba(0, 0, 0, 0.08);
    color: #374151;
    width: 44px;
    height: 44px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.audio-stop-button svg {
    width: 18px;
    height: 18px;
}

.webspeak-player:not(.player-style-modern) .audio-stop-button {
    background: #f3f4f6;
}

/* Progress Section */
.audio-progress-section {
    flex: 1;
    min-width: 180px;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audio-progress-track {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: height 0.2s;
}

.audio-progress-track:hover {
    height: 10px;
}

.audio-progress-filled {
    height: 100%;
    width: 0%;
    background: var(--player-color);
    border-radius: 999px;
    transition: width 0.1s linear, height 0.2s;
    position: relative;
    box-shadow: 0 2px 10px rgba(var(--player-color-rgb), 0.3);
}

.audio-progress-filled::after {
    content: "";
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: var(--player-color);
    border: 4px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.audio-progress-track:hover .audio-progress-filled::after {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.audio-time-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    white-space: nowrap;
}

.time-separator {
    opacity: 0.5;
}

/* Speed Control */
.audio-speed-wrapper {
    position: relative;
    flex-shrink: 0;
}

.audio-speed-button {
    background: rgba(0, 0, 0, 0.06);
    border: none;
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    color: #374151;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 80px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
}

.audio-speed-button:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #d1d5db;
}

.audio-speed-button svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.audio-speed-wrapper.active .audio-speed-button svg {
    transform: rotate(180deg);
}

.speed-dropdown {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
    padding: 10px;
    display: none;
    min-width: 100px;
    z-index: 1000;
    animation: dropdownSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e5e7eb;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.speed-dropdown.show {
    display: block;
}

.speed-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 14px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.speed-item:hover {
    background: #f3f4f6;
    transform: translateX(-2px);
}

.speed-item.active {
    background: var(--player-color);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(var(--player-color-rgb), 0.3);
}

/* Compatibility Warning */
.audio-compatibility-warning {
    margin-top: 15px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fbbf24;
    border-radius: 12px;
    font-size: 14px;
    color: #92400e;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.audio-compatibility-warning p {
    margin: 0;
    line-height: 1.6;
}

.audio-compatibility-warning strong {
    font-weight: 700;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(-15px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .audio-player-wrapper {
        padding: 20px 24px;
    }
    
    .audio-header-section {
        gap: 16px;
    }
    
    .audio-progress-section {
        min-width: 160px;
    }
}

@media (max-width: 1024px) {
    .webspeak-player {
        margin: 30px 0;
    }
    
    .audio-player-wrapper {
        padding: 18px 22px;
    }
    
    .audio-controls-section {
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .webspeak-player {
        margin: 25px 0;
        border-radius: 14px;
    }
    
    .audio-player-wrapper {
        padding: 16px 20px;
    }
    
    .audio-header-section {
        gap: 14px;
        flex-wrap: wrap;
    }
    
    .audio-icon-box {
        width: 44px;
        height: 44px;
    }
    
    .audio-wave-icon {
        width: 22px;
        height: 22px;
    }
    
    .audio-title {
        font-size: 15px;
    }
    
    .audio-subtitle {
        font-size: 12px;
    }
    
    .audio-controls-section {
        gap: 12px;
        width: 100%;
        justify-content: space-between;
        margin-top: 15px;
    }
    
    .audio-btn {
        width: 44px;
        height: 44px;
    }
    
    .audio-stop-button {
        width: 40px;
        height: 40px;
    }
    
    .audio-progress-section {
        flex: 1;
        min-width: 140px;
    }
    
    .audio-speed-button {
        padding: 10px 15px;
        min-width: 70px;
        height: 44px;
        font-size: 13px;
    }
    
    .speed-dropdown {
        bottom: calc(100% + 8px);
    }
}

@media (max-width: 640px) {
    .audio-player-wrapper {
        padding: 14px 18px;
    }
    
    .audio-header-section {
        gap: 12px;
    }
    
    .audio-info {
        flex: 1;
        min-width: 0;
    }
    
    .audio-title {
        font-size: 14px;
        white-space: normal;
        line-height: 1.3;
    }
    
    .audio-subtitle {
        display: none;
    }
    
    .audio-controls-section {
        gap: 10px;
    }
    
    .audio-icon-box {
        width: 40px;
        height: 40px;
    }
    
    .audio-btn {
        width: 40px;
        height: 40px;
    }
    
    .audio-play-button svg {
        width: 20px;
        height: 20px;
    }
    
    .audio-stop-button {
        width: 38px;
        height: 38px;
    }
    
    .audio-stop-button svg {
        width: 16px;
        height: 16px;
    }
    
    .audio-progress-section {
        min-width: 120px;
    }
    
    .audio-time-info {
        font-size: 12px;
    }
    
    .audio-speed-button {
        padding: 8px 12px;
        min-width: 65px;
        height: 40px;
        font-size: 12px;
    }
    
    .speed-item {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .audio-compatibility-warning {
        padding: 12px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .webspeak-player {
        margin: 20px 0;
    }
    
    .audio-player-wrapper {
        padding: 12px 16px;
    }
    
    .audio-controls-section {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .audio-progress-section {
        order: 3;
        width: 100%;
        margin-top: 10px;
    }
    
    .audio-speed-wrapper {
        order: 2;
    }
    
    .audio-play-button {
        order: 1;
    }
    
    .audio-stop-button {
        order: 1;
        margin-left: 10px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .player-style-minimal .audio-player-wrapper {
        background: #1f2937;
        border-color: #374151;
    }
    
    .player-style-classic .audio-player-wrapper {
        background: #78350f;
        border-color: #92400e;
    }
    
    .player-style-glassmorphism .audio-player-wrapper {
        background: rgba(31, 41, 55, 0.85);
        border-color: rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(24px) saturate(180%);
    }
    
    .audio-title {
        color: #f9fafb;
    }
    
    .audio-subtitle,
    .audio-time-info {
        color: #9ca3af;
    }
    
    .audio-progress-track {
        background: #374151;
    }
    
    .audio-speed-button {
        background: rgba(255, 255, 255, 0.1);
        color: #f9fafb;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .speed-dropdown {
        background: #374151;
        border-color: #4b5563;
    }
    
    .speed-item {
        color: #f9fafb;
    }
    
    .speed-item:hover {
        background: #4b5563;
    }
    
    .audio-stop-button {
        background: rgba(255, 255, 255, 0.1);
        color: #f9fafb;
    }
    
    .audio-compatibility-warning {
        background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
        border-color: #b45309;
        color: #fef3c7;
    }
}

/* Premium Badge for Player */
.webspeak-player::before {
    content: 'TTS';
    position: absolute;
    top: -8px;
    right: 20px;
    background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 12px;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Loading Animation */
@keyframes wave {
    0%, 100% { 
        transform: scaleY(0.5); 
        opacity: 0.6; 
    }
    50% { 
        transform: scaleY(1); 
        opacity: 1; 
    }
}

.webspeak-player.loading .audio-wave-icon line {
    animation: wave 1.2s infinite ease-in-out;
}

.webspeak-player.loading .audio-wave-icon line:nth-child(2) { animation-delay: -1.1s; }
.webspeak-player.loading .audio-wave-icon line:nth-child(3) { animation-delay: -1.0s; }
.webspeak-player.loading .audio-wave-icon line:nth-child(4) { animation-delay: -0.9s; }
.webspeak-player.loading .audio-wave-icon line:nth-child(5) { animation-delay: -0.8s; }

/* Active State Enhancements */
.webspeak-player.playing {
    box-shadow: 0 15px 50px rgba(var(--player-color-rgb), 0.15);
}

.webspeak-player.playing .audio-progress-filled {
    background: linear-gradient(90deg, var(--player-color) 0%, #8b5cf6 100%);
}