.aiw-tts-box {
    margin-bottom: 15px;
    padding: 5px 10px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-image: linear-gradient(to right, rgba(255,255,255,0.05), rgba(255,255,255,0));
}

.aiw-tts-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 auto;
    padding: 12px 24px;
    border-radius: 50px; /* Pillow shape for modern look */
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.aiw-tts-btn svg {
    width: 20px;
    height: 20px;
}

.aiw-tts-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    filter: brightness(1.05); /* Slightly lighter on hover */
}

.aiw-tts-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Backend specific adjustments for the generate button */
#aiw_tts_meta_box .aiw-tts-btn {
    width: 100% !important;
    height: auto !important;
    padding: 12px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    margin-top: 5px;
}

.aiw-tts-btn.is-loading {
    opacity: 0.8;
    pointer-events: none;
    cursor: not-allowed;
}

.aiw-tts-btn .dashicons.spin {
    animation: aiw-spin 1s linear infinite;
}


.aiw-tts-error {
    color: #ef4444;
    font-size: 13px;
    font-weight: 600;
    background: #fef2f2;
    padding: 8px 12px;
    border-radius: 8px;
    display: none;
}

@keyframes aiw-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

    .aiw-tts-player-hidden {
        display: none;
    }

    .aiw-custom-player-wrapper {
        display: flex;
        align-items: center;
        gap: 15px;
        width: 100%;
        padding: 5px;
    }
html[dir*='ltr'] .aiw-custom-player-wrapper{
    flex-direction: row;
}
html[dir*='rtl'] .aiw-custom-player-wrapper{
    flex-direction: row-reverse;
}

html[dir*='ltr'] .aiw-tts-progress-fill {float: right;}
html[dir*='rtl'] .aiw-tts-progress-fill {float: left;}
    .aiw-tts-play-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        border: none;
        cursor: pointer;
        background: var(--aiw-tts-btn-color); /* Will use custom color eventually */
        color: inherit;
        transition: all 0.2s ease;
        flex-shrink: 0;
    }

    .aiw-tts-play-btn:hover {
        transform: scale(1.05);
    }
    .aiw-tts-play-btn:focus {
        background: var(--aiw-tts-btn-color);
        transform: scale(0.9);
    }
    .aiw-tts-progress-container {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-grow: 1;
    }

    .aiw-tts-time {
        font-size: 13px;
        font-variant-numeric: tabular-nums;
        font-weight: 500;
       color: #ffffffd4;
        min-width: 35px;
    }

    .aiw-tts-progress-bar {
        position: relative;
        width: 100%;
        height: 6px;
        background:rgba(255,255,255,0.5);
        border-radius: 8px;
        cursor: pointer;
        overflow: hidden;
    }

    .aiw-tts-progress-fill {
        height: 100%;
        background: var(--aiw-tts-btn-color);
        width: 0%;
        border-radius: inherit;
        transition: width 0.1s linear;
    }

    .aiw-tts-progress-bar:hover .aiw-tts-progress-fill {
        filter: brightness(1.2);
    }

    .aiw-tts-speed-control,
    .aiw-tts-speed-control:focus {
        padding: 8px 12px;
        border-radius: 20px;
        background: var(--aiw-tts-speed-color);
    font-size: 13px !important;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    color: #fff;
    text-align: center;
    line-height: 0.5px;
    height: 36px !important;
    min-width: 36px;
    }

    .aiw-tts-speed-control:hover {
        filter: brightness(1.1);
        transform: scale(1.05);
    }
    
    .aiw-tts-speed-control:active {
        transform: scale(0.95);
    }

    .aiw-custom-player-wrapper svg {
        width: 24px;
        height: 24px;
        display: block;
        color: #ffffff;
    }

    .time-display {
        display: flex;
        align-items: center;
        gap: 3px;
        color: rgba(255, 255, 255, 0.6);
        font-size: 13px;
        font-weight: 500;
        margin: 0 10px;
        white-space: nowrap;
    }

