.aiw-tts-box {
    margin-bottom: 24px;
    padding: 13px 15px;
    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;
    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);
}

.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-player {
    flex: 1;
    min-width: 250px;
    height: 40px;
    border-radius: 10px;
    outline: none;
}

.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;
    }

    .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;
        background: rgba(255,255,255,0.5);
        padding: 8px 15px;
        border-radius: 30px;
        border: 1px solid rgba(0,0,0,0.05);
    }

    .aiw-tts-time {
        font-size: 13px;
        font-variant-numeric: tabular-nums;
        font-weight: 500;
       color: #ffffffd4;
        min-width: 35px;
    }

    .aiw-tts-progress-bar {
        -webkit-appearance: none;
        appearance: none;
        width: 100%;
        height: 6px;
        background: rgba(0,0,0,0.1);
        border-radius: 8px;
        outline: none;
        cursor: pointer;
        direction: ltr;
        --aiw-progress-val: 0%;
        background-image: linear-gradient(currentColor, currentColor);
        background-size: var(--aiw-progress-val) 100%;
        background-repeat: no-repeat;
    }

    .aiw-tts-progress-bar::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: currentColor;
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        transition: transform 0.1s ease;
    }

    .aiw-tts-progress-bar::-webkit-slider-thumb:hover {
        transform: scale(1.2);
    }

    .aiw-tts-progress-bar::-moz-range-thumb {
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: currentColor;
        cursor: pointer;
        border: none;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        transition: transform 0.1s ease;
    }
    
    .aiw-tts-progress-bar::-moz-range-thumb:hover {
        transform: scale(1.2);
    }

    .aiw-tts-speed-control,.aiw-tts-speed-control:focus {
        padding: 8px 12px;
        border-radius: 20px;
        border: 1px solid rgba(0,0,0,0.1);
        background: var(--aiw-tts-speed-color);
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        outline: none;
        transition: all 0.2s ease;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        color: #fff;
        text-align: center;
    }

    .aiw-custom-player-wrapper svg {
        width: 24px;
        height: 24px;
        display: block;
        color: #ffffff;
    }

@media (max-width: 600px) {
    .aiw-tts-box {
        flex-direction: column;
        align-items: stretch;
    }
    .aiw-tts-player, .aiw-tts-btn {
        width: 100%;
    }
    .aiw-custom-player-wrapper {
        flex-wrap: wrap;
    }
    .aiw-tts-progress-container {
        order: 3;
        width: 100%;
        margin-top: 10px;
    }
}
