/* Form Elements */
#viettelai-tts-generator-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

#viettelai-tts-generator-form textarea,
#viettelai-tts-generator-form select,
#viettelai-tts-generator-form input[type="number"],
#viettelai-tts-generator-form input[type="range"] { /* Added input[type="range"] */
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

/* Dropdowns Container */
.vtai-tts-dropdown-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

span#vtai-speed-value {
    display: block;
    /* float: right; */
    font-size: 0.9em;
    color: #777;
    text-align: end;
    margin-bottom: 15px;
}

.vtai-tts-dropdown { /* Updated Class */
    width: calc(50% - 7.5px); /* Ensures two per row with gap */
}

#viettelai-tts-generator-form button, /* Updated ID */
button#vtai-generate-tts { /* Added specific button ID for more specificity */
    padding: 10px 20px;
    background-color: #0274be;
    color: white;
    border: none;
    cursor: pointer;
    display: block;
    width: 100%;
}

/* Audio Output and History */
#vtai-tts-audio-output { /* Updated ID - if you are using this, otherwise you might remove if not used */
    margin-top: 20px;
}

h2.vtai-history-heading { /* Updated Class */
    margin-top: 20px;
}

ul.vtai-tts-history-list { /* Updated Class */
    padding: 0;
    list-style: none;
}

.vtai-tts-history-list li { /* Updated Class */
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.vtai-tts-history-list li p { /* Updated Class */
    margin-top: 0;
    margin-bottom: 5px;
}

.vtai-tts-history-list li audio { /* Updated Class */
    width: 100%;
    margin-bottom: 10px;
}

p.vtai-history-timestamp { /* Updated Class */
    font-size: 0.9em;
    color: #777;
}

div#vtai-tts-generation-history { /* Updated ID */
    max-height: 420px;
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Character Count */
#vtai-tts-char-count { /* Updated ID */
    font-size: 0.9em;
    color: #777;
    margin-bottom: 10px;
    position: relative;
    top: -50px;
    text-align: right;
    right: 8px;
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    background-color: #f0f0f0;
    padding: 3px;
    border-radius: 3px;
    margin: 10px 0;
}

.progress-bar {
    height: 20px;
    background-color: #4CAF50;
    width: 0%;
    border-radius: 2px;
    transition: width 0.3s ease-in-out;
    position: relative;
}

.progress-bar-text {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 12px;
    line-height: 20px;
}

button#vtai-generate-tts:disabled { /* Updated ID */
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Voice Selector Dropdown */
.vtai-voice-dropdown .vtai-voice-selector { /* Updated Class */
    position: relative;
    cursor: pointer;
}

.vtai-voice-dropdown .vtai-voice-selector-display { /* Updated Class */
    padding: 7px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vtai-voice-dropdown.active .vtai-voice-selector-display { /* Updated Class */
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

button.vtai-voice-sample-button.play { /* Updated Class */
    background: transparent !important;
    width: 20% !important;
}

.vtai-voice-dropdown .vtai-voice-options-container { /* Updated Class */
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border: 1px solid #ccc;
    border-top: none;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    overflow: hidden;
    background-color: white;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    max-height: 316px; /* Reduced height */
    overflow-y: auto;   /* Added scrollbar */
}

.vtai-voice-dropdown.active .vtai-voice-options-container { /* Updated Class */
    display: block;
}

.vtai-voice-dropdown .vtai-voice-option { /* Updated Class */
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.vtai-voice-dropdown .vtai-voice-option:hover, /* Updated Class */
.vtai-voice-dropdown .vtai-voice-option.selected { /* Updated Class */
    background-color: #f0f0f0;
}

.vtai-voice-dropdown .vtai-voice-option:not(:last-child) { /* Updated Class */
    border-bottom: 1px solid #eee;
}

.vtai-voice-dropdown .vtai-voice-sample-button { /* Updated Class */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    color: #333;
}

.vtai-voice-dropdown .vtai-voice-sample-button:focus { /* Updated Class */
    outline: none;
}

.vtai-voice-dropdown .vtai-voice-sample-button .dashicons { /* Updated Class */
    font-size: 20px;
    color: #6495ED;
    float: right;
    line-height: 1;
    width: 20px;
    height: 20px;
}

/* Download Buttons */
.vtai-download-buttons { /* Updated Class */
    display: flex;
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 5px;
}

.vtai-download-buttons button { /* Updated Class */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    border: none;
    width: auto;
}

.vtai-download-buttons button.vtai-download-audio { /* Updated Class */
    background-color: #4CAF50;
    color: white;
}

.vtai-download-buttons button.vtai-download-text { /* Updated Class */
    background-color: #2196F3;
    color: white;
}

.vtai-download-buttons button:hover { /* Updated Class */
    opacity: 0.9;
    transform: translateY(-1px);
}

.vtai-download-buttons button:active { /* Updated Class */
    transform: translateY(0);
}

.vtai-download-buttons .dashicons { /* Updated Class */
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 18px;
}

/* Error States */
.error {
    color: #d32f2f;
    background-color: #ffebee;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
}

/* Responsive Styles */
@media (max-width: 600px) {
    .vtai-tts-dropdown { /* Updated Class */
        width: 100%;
    }

    .vtai-voice-dropdown .vtai-voice-options-container { /* Updated Class */
        position: static;
        width: 100%;
        box-shadow: none;
        border-radius: 0;
        overflow-y: visible; /* Disable scroll on small screens */
    }

    .vtai-voice-dropdown.active .vtai-voice-selector-display { /* Updated Class */
        border-radius: 4px 4px 0 0;
    }

    .vtai-voice-dropdown .vtai-voice-selector-display { /* Updated Class */
        border-radius: 4px;
    }

    .vtai-download-buttons { /* Updated Class */
        flex-direction: column;
    }

    .vtai-download-buttons button { /* Updated Class */
        width: 100%;
    }
}

/* Loading States */
.processing {
    opacity: 0.7;
}

/* Scrollbar Styling for Voice Dropdown - Webkit Browsers (Chrome, Safari) */
.vtai-voice-dropdown .vtai-voice-options-container::-webkit-scrollbar {
    width: 6px; /* Adjust scrollbar width as needed */
}

.vtai-voice-dropdown .vtai-voice-options-container::-webkit-scrollbar-track {
    background: #f1f1f1; /* Scrollbar track color */
}

.vtai-voice-dropdown .vtai-voice-options-container::-webkit-scrollbar-thumb {
    background: #888; /* Scrollbar thumb color */
    border-radius: 3px; /* Rounded corners for thumb */
}

.vtai-voice-dropdown .vtai-voice-options-container::-webkit-scrollbar-thumb:hover {
    background: #555; /* Darker thumb color on hover */
}

/* Scrollbar Styling for Voice Dropdown - Firefox */
.vtai-voice-dropdown .vtai-voice-options-container {
    scrollbar-color: #888 #f1f1f1; /* thumb and track color respectively */
    scrollbar-width: thin;  /* 'auto' or 'thin' */
}

/* Scrollbar Styling for History - Keep existing styling */
#vtai-tts-generation-history::-webkit-scrollbar {
    width: 6px;
}

#vtai-tts-generation-history::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#vtai-tts-generation-history::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#vtai-tts-generation-history::-webkit-scrollbar-thumb:hover {
    background: #555;
}