/* Form Elements */
#google-azure-tts-generator-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

#google-azure-tts-generator-form textarea,
#google-azure-tts-generator-form select,
#google-azure-tts-generator-form input[type="number"],
#google-azure-tts-generator-form input[type="range"] { /* Added input[type="range"] */
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

/* Dropdowns Container */
.ga-tts-dropdown-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}
span#ga-google-speed-value,
span#ga-azure-speed-value {
    float: right;
}
.ga-tts-dropdown {
    width: 100%; /* Ensures two per row with gap */
}

#google-azure-tts-generator-form button,
button#ga-generate-tts {
    padding: 10px 20px;
    background-color: #0274be;
    color: white;
    border: none;
    cursor: pointer;
    display: block;
    width: 100%;
}

/* Audio Output and History */
#ga-tts-audio-output { /* If you use this ID */
    margin-top: 20px;
}

h2.ga-history-heading {
    margin-top: 20px;
}

ul.ga-tts-history-list {
    padding: 0;
    list-style: none;
}

.ga-tts-history-list li {
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.ga-tts-history-list li p {
    margin-top: 0;
    margin-bottom: 5px;
}

.ga-tts-history-list li audio {
    width: 100%;
    margin-bottom: 10px;
}

p.ga-history-timestamp {
    font-size: 0.9em;
    color: #777;
}

div#ga-tts-generation-history {
    max-height: 420px;
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Character Count */
#ga-tts-char-count {
    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#ga-generate-tts:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Voice Selector Dropdown */
.ga-voice-dropdown .ga-voice-selector {
    position: relative;
    cursor: pointer;
}

.ga-voice-dropdown .ga-voice-selector-display {
    padding: 7px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ga-voice-dropdown .ga-voice-selector-display input.ga-voice-search-input {
    border: none;
    padding: 5px;
    margin-right: 8px;
    flex-grow: 1; /* Take available space */
    outline: none;
    -webkit-appearance: none; /* Remove clear button on Chrome on macOS */
    -moz-appearance: none;    /* Remove clear button on Firefox */
    appearance: none;         /* Remove clear button in general */
}
.ga-voice-dropdown .ga-voice-selector-display input.ga-voice-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}


.ga-voice-dropdown.active .ga-voice-selector-display {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

button.ga-voice-sample-button.play {
    background: transparent !important;
    width: 20% !important;
}

.ga-voice-dropdown .ga-voice-options-container {
    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; /* Increased height to accommodate search bar and more voices */
    overflow-y: auto;   /* Added scrollbar */
    padding-top: 5px; /* Add padding to visually separate search input */
}

.ga-voice-dropdown.active .ga-voice-options-container {
    display: block;
}

.ga-voice-dropdown .ga-voice-option {
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.ga-voice-dropdown .ga-voice-option:hover,
.ga-voice-dropdown .ga-voice-option.selected {
    background-color: #f0f0f0;
}

.ga-voice-dropdown .ga-voice-option:not(:last-child) {
    border-bottom: 1px solid #eee;
}

.ga-voice-dropdown .ga-voice-sample-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    color: #333;
}

.ga-voice-dropdown .ga-voice-sample-button:focus {
    outline: none;
}

.ga-voice-dropdown .ga-voice-sample-button .dashicons {
    font-size: 20px;
    color: #6495ED;
    float: right;
    line-height: 1;
    width: 20px;
    height: 20px;
}

/* Download Buttons */
.ga-download-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 5px;
}

.ga-download-buttons button {
    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;
}

.ga-download-buttons button.ga-download-audio {
    background-color: #4CAF50;
    color: white;
}

.ga-download-buttons button.ga-download-text {
    background-color: #2196F3;
    color: white;
}

.ga-download-buttons button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.ga-download-buttons button:active {
    transform: translateY(0);
}

.ga-download-buttons .dashicons {
    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) {
    .ga-tts-dropdown {
        width: 100%;
    }
    .ga-voice-dropdown .ga-voice-options-container {
        position: static;
        width: 100%;
        box-shadow: none;
        border-radius: 0;
        overflow-y: visible;
    }
    .ga-voice-dropdown.active .ga-voice-selector-display {
        border-radius: 4px 4px 0 0;
    }
    .ga-voice-dropdown .ga-voice-selector-display {
        border-radius: 4px;
    }
    .ga-download-buttons {
        flex-direction: column;
    }
    .ga-download-buttons button {
        width: 100%;
    }
}

/* Loading States */
.processing {
    opacity: 0.7;
}

/* Scrollbar Styling for Voice Dropdown */
.ga-voice-dropdown .ga-voice-options-container::-webkit-scrollbar {
    width: 6px;
}

.ga-voice-dropdown .ga-voice-options-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ga-voice-dropdown .ga-voice-options-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.ga-voice-dropdown .ga-voice-options-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Scrollbar Styling for History */
div#ga-tts-generation-history::-webkit-scrollbar {
    width: 6px;
}

div#ga-tts-generation-history::-webkit-scrollbar-track {
    background: #f1f1f1;
}

div#ga-tts-generation-history::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

div#ga-tts-generation-history::-webkit-scrollbar-thumb:hover {
    background: #555;
}