/**
 * Voice Filters Styling - Specific selectors to prevent WordPress core CSS overrides
 */

/* Improve voice filter layout */
.mementor-tts-voice-filters {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 20px;
}

.mementor-tts-voice-filters .mementor-tts-filter-group {
    padding-right: 5px;
    width: 20%; /* Each filter takes 20% width (5 filters) */
    box-sizing: border-box;
}

.mementor-tts-voice-filters .mementor-tts-filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.mementor-tts-voice-filters .mementor-tts-filter-group select,
.mementor-tts-voice-filters .mementor-tts-filter-group input {
    width: 100%;
    min-height: 30px;
    box-sizing: border-box;
}

/* Make sure filter inputs are the same height */
.mementor-tts-voice-filters .mementor-tts-filter-group input[type="text"] {
    height: 30px;
}

/* General header styling for all section headers */
.mementor-tts-section .mementor-tts-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border-bottom: 1px solid #c3c4c7;
    margin-bottom: 10px;
    line-height: 1.4;
    box-sizing: border-box;
}

/* PRO Voice upgrade button styling */
.mementor-tts-voice-use-button.button.button-primary.disabled.pro-upgrade-button,
.wp-core-ui .button-primary.disabled.pro-upgrade-button,
.wp-core-ui .button.pro-upgrade-button,
.pro-upgrade-button {
    background: var(--tts-purple-bg) !important;
    color: var(--tts-purple-text) !important;
    line-height: 1.5 !important;
    min-height: 33px !important;
    margin-bottom: 0 !important;
    border: 0.5px solid var(--tts-purple-border) !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

.upgrade-link {
    margin-bottom: 0 !important;
}

.mementor-tts-voice-use-button.button.button-primary.disabled.pro-upgrade-button:hover,
.wp-core-ui .button-primary.disabled.pro-upgrade-button:hover,
.wp-core-ui .button.pro-upgrade-button:hover,
.pro-upgrade-button:hover {
    background: var(--tts-purple-border) !important;
    border-color: var(--tts-purple) !important;
}

.pro-upgrade-button .upgrade-link,
.upgrade-link.mementor-tts-upgrade-button {
    color: var(--tts-purple-text) !important;
    font-weight: bold;
    text-decoration: underline;
}

.pro-upgrade-button .upgrade-link:hover,
.upgrade-link.mementor-tts-upgrade-button:hover {
    text-decoration: none;
}

/* Ensure all upgrade buttons have consistent styling */
.mementor-tts-upgrade-button {
    color: white !important;
    font-weight: bold;
}

/* Voice count badge styling */
.mementor-tts-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

/* Different states for the voice count badge */
.mementor-tts-count-badge.count-normal {
    background-color: #e7f5ea;
    color: #0a7d33;
}

.mementor-tts-count-badge.count-warning {
    background-color: #fff8e5;
    color: #996600;
}

.mementor-tts-count-badge.count-critical {
    background-color: #fde8e8;
    color: #cc0000;
}

.mementor-tts-section .mementor-tts-section-header h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    flex-grow: 1;
    display: inline-block;
    font-size: 1.3em;
    line-height: 1.4;
    font-weight: 600;
}

/* Preview header styling - matching player preview exactly */
.mementor-tts-preview-header {
    padding: 16px;
    background: #fff;
    border-bottom: 1px solid #c3c4c7;
}

.mementor-tts-preview-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mementor-tts-preview-actions h2 {
    margin: 0;
    padding: 0;
    font-size: 1.3em;
    line-height: 1.4;
    font-weight: 600;
}

.mementor-tts-preview-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mementor-tts-preview-buttons .button {
    margin: 0;
    height: 32px;
    line-height: 30px;
    display: inline-flex;
    align-items: center;
}

/* Style for buttons in section headers - matching preview style */
.mementor-tts-section .mementor-tts-section-header .mementor-tts-header-flex {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mementor-tts-section .mementor-tts-section-header .mementor-tts-header-flex button,
.mementor-tts-section .mementor-tts-section-header .mementor-tts-header-flex .button,
.mementor-tts-section .mementor-tts-section-header .mementor-tts-header-flex .button-primary,
.mementor-tts-section .mementor-tts-section-header .mementor-tts-header-flex .button-secondary {
    margin: 0;
    height: 32px;
    line-height: 30px;
    display: inline-flex;
    align-items: center;
}

/* Specific styling for the refresh voices button */
.mementor-tts-section .mementor-tts-section-header .mementor-tts-header-flex #clear-voice-cache {
    display: inline-flex;
    align-items: center;
}

.mementor-tts-section .mementor-tts-section-header .mementor-tts-header-flex #clear-voice-cache .dashicons {
    margin-right: 5px;
}

/* Button group styling */
.mementor-tts-section .mementor-tts-section-header .button-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* PRO Voice Badge Styling */
/* Badge for PRO features in general */
.mementor-tts-pro-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    background-color: #6c5ce7;
    color: #ffffff;
    margin-left: 8px;
    vertical-align: middle;
}

/* Disabled Voice Button Styling */
.mementor-tts-voice-use-button.disabled {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

/* Style for PRO voice buttons */
.pro-voice .mementor-tts-voice-use-button:not(.selected) {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

/* PRO Voice Upgrade Button */
.mementor-tts-voice-use-button.disabled.pro-upgrade {
    background-color: #f5f5f5;
    border-color: #6c5ce7;
    color: #6c5ce7;
}

.mementor-tts-voice-use-button.disabled.pro-upgrade:hover {
    background-color: #f0f0f0;
    color: #5649c9;
}

/* PRO Voice Badge on avatars */
.pro-voice-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #6c5ce7;
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* Make sure the avatar container has position relative for badge positioning */
.mementor-tts-voice-avatar {
    position: relative;
}

/* PRO Voice Row Highlight */
.mementor-tts-voice-row.pro-voice, tr.pro-voice {
    background-color: rgba(108, 92, 231, 0.05);
}

/* Mobile responsiveness for filters */
@media screen and (max-width: 1200px) {
    .mementor-tts-voice-filters {
        flex-wrap: wrap;
    }
    
    .mementor-tts-voice-filters .mementor-tts-filter-group {
        width: calc(50% - 10px) !important;
    }
}

@media screen and (max-width: 782px) {
    .mementor-tts-voice-filters .mementor-tts-filter-group {
        width: 100% !important;
    }
}
