/* widget-voicepicker.css
 *
 * Styles for the VoicePickerWidget - a selectable table of voices with tags and filtering.
 */

/* *******************************************************
 * Widget container
 * ******************************************************* */

.vp-widget {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 200px;
    gap: 10px;
}

/* *******************************************************
 * Filter bar
 * ******************************************************* */

.vp-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vp-filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.vp-filter-input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.88rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.vp-filter-input:focus {
    outline: none;
    border-color: #667eea;
}

.vp-filter-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 1.1rem;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    display: none;
}

.vp-filter-clear.visible {
    display: block;
}

.vp-filter-clear:hover {
    color: #555;
    background: #f0f0f0;
}

/* *******************************************************
 * Table
 * ******************************************************* */

.vp-table-container {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow-y: auto;
    max-height: 360px;
}

.vp-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.vp-table thead {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 10;
}

.vp-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    font-size: 0.85rem;
}


.vp-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.vp-table tbody tr:hover {
    background-color: #f8f9fa;
}

.vp-table tbody tr.selected {
    background-color: #e3f2fd;
}

.vp-table tbody tr.vp-row-default {
    background-color: #faf5ff;
}

.vp-table tbody tr.vp-row-default:hover {
    background-color: #f3e8ff;
}

.vp-table tbody tr.vp-row-default.selected {
    background-color: #ddd6fe;
}

.vp-table tbody tr.vp-hidden {
    display: none;
}

.vp-table td {
    padding: 10px 12px;
    vertical-align: middle;
}


/* *******************************************************
 * Name / description cell
 * ******************************************************* */

.vp-name-cell {
    font-size: 0.92rem;
    color: #333;
    font-weight: 500;
}

.vp-description {
    display: block;
    font-size: 0.75rem;
    color: #888;
    font-weight: 400;
    margin-top: 2px;
}

/* *******************************************************
 * Tags cell
 * ******************************************************* */

.vp-tags-cell {
    min-width: 140px;
    max-width: 260px;
}

.vp-tags-area {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 24px;
    align-items: center;
}

/* Individual tag pill */
.vp-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    cursor: default;
    user-select: none;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.vp-tag.vp-tag-user {
    cursor: context-menu;
}

/* *******************************************************
 * Context menu
 * ******************************************************* */

.vp-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 99999;
    min-width: 150px;
    padding: 4px 0;
    animation: vp-menu-appear 0.1s ease;
}

@keyframes vp-menu-appear {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.vp-context-menu-item {
    padding: 8px 16px;
    font-size: 0.88rem;
    color: #333;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s ease;
}

.vp-context-menu-item:hover {
    background: #f0f4ff;
    color: #333;
}

.vp-context-menu-item.danger {
    color: #dc3545;
}

.vp-context-menu-item.danger:hover {
    background: #fff0f0;
}

.vp-context-menu-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

/* *******************************************************
 * Add / Edit tag overlay (inline small dialog)
 * ******************************************************* */

.vp-tag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

.vp-tag-dialog {
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    width: 300px;
    overflow: hidden;
}

.vp-tag-dialog-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.vp-tag-dialog-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    flex: 1;
}

.vp-tag-dialog-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 1.4rem;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.vp-tag-dialog-close:hover {
    background: rgba(255,255,255,0.35);
}

.vp-tag-dialog-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.vp-tag-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.vp-tag-form-group label {
    font-size: 0.83rem;
    font-weight: 600;
    color: #444;
}

.vp-tag-form-group input[type="text"] {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    box-sizing: border-box;
    width: 100%;
    transition: border-color 0.2s;
}

.vp-tag-form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.vp-tag-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vp-color-swatches {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.vp-color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    box-sizing: border-box;
    transition: transform 0.1s, border-color 0.1s;
}

.vp-color-swatch:hover {
    transform: scale(1.2);
    border-color: rgba(0,0,0,0.3);
}

.vp-tag-preview-group {
    align-items: flex-start;
}

.vp-tag-color-input {
    width: 38px;
    height: 30px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    background: white;
}

.vp-tag-preview {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    min-width: 40px;
    justify-content: center;
}

.vp-tag-dialog-footer {
    padding: 12px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.vp-tag-btn {
    padding: 7px 18px;
    border-radius: 6px;
    border: none;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.vp-tag-btn-primary {
    background: #667eea;
    color: white;
}

.vp-tag-btn-primary:hover {
    background: #5a6fd6;
}

.vp-tag-btn-secondary {
    background: white;
    color: #666;
    border: 1px solid #ccc;
}

.vp-tag-btn-secondary:hover {
    background: #f5f5f5;
}

/* *******************************************************
 * Sample player column
 * ******************************************************* */

.vp-sample-col {
    width: 48px;
    text-align: center;
}

.vp-sample-cell {
    width: 48px;
    text-align: center;
    padding: 6px 8px;
}

.vp-sample-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.vp-sample-btn:active:not(:disabled) {
    transform: scale(0.92);
}

.vp-sample-btn-play {
    background: #28a745;
    color: white;
}

.vp-sample-btn-play:hover:not(:disabled) {
    background: #218838;
}

.vp-sample-btn-stop {
    background: #007bff;
    color: white;
}

.vp-sample-btn-stop:hover:not(:disabled) {
    background: #0056b3;
}

.vp-sample-btn-loading {
    background: #aaa;
    color: white;
    cursor: default;
}

.vp-sample-icon {
    width: 16px;
    height: 16px;
    display: none;
    flex-shrink: 0;
}

.vp-sample-btn-play .vp-sample-icon-play,
.vp-sample-btn-stop .vp-sample-icon-stop {
    display: block;
}

.vp-sample-btn-loading .vp-sample-icon-loading {
    display: block;
    animation: vp-spin 0.9s linear infinite;
}

@keyframes vp-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* *******************************************************
 * States
 * ******************************************************* */

.vp-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 1rem;
}

.vp-loading-state {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-size: 1rem;
}
