/* ==============================================================================
   REDACTOR FONÉTICO SONODIT PRO - UI/UX ULTRA PREMIUM (ESTILO SUNO / LEONARDO AI)
   ============================================================================== */

/* Fondo oscuro difuminado */
.redactor-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 9, 13, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #f1f5f9;
    font-family: 'Google Sans', system-ui, -apple-system, sans-serif;
}

.redactor-modal-backdrop.hidden {
    display: none !important;
}

/* Contenedor Principal Estilo Studio */
.redactor-container {
    width: 92%;
    max-width: 780px;
    max-height: 86vh;
    background: #0d0f17;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85),
                0 0 40px rgba(99, 102, 241, 0.12);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Encabezado */
.redactor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.redactor-title-area h2 {
    margin: 0.4rem 0 0.2rem 0;
    font-size: 1.35rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.redactor-subtitle {
    font-size: 0.85rem;
    color: #94a3b8;
    margin: 0;
}

.redactor-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #a855f7;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.25);
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.redactor-counter {
    background: #181b29;
    border: 1px solid #2a2e45;
    padding: 0.4rem 0.8rem;
    border-radius: 10px;
    font-size: 0.78rem;
    color: #818cf8;
    font-weight: 600;
}

/* Cuerpo / Lienzo de Texto */
.redactor-body {
    overflow-y: auto;
    margin: 0.5rem 0 1.5rem 0;
    padding-right: 6px;
    flex: 1;
}

.redactor-canvas {
    background: #121420;
    border: 1px solid #212538;
    border-radius: 14px;
    padding: 1.8rem;
    font-size: 1.12rem;
    line-height: 2.2;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Chips Interactivas en el Texto */
.phonetic-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(99, 102, 241, 0.18);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.4);
    padding: 2px 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 2px;
    user-select: none;
}

.phonetic-chip:hover {
    background: rgba(99, 102, 241, 0.32);
    border-color: #6366f1;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.phonetic-chip.configured {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.4);
}

.phonetic-chip.active {
    background: #6366f1;
    color: #ffffff;
    border-color: #818cf8;
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.5);
}

.phonetic-chip .chip-arrow {
    font-size: 0.72rem;
    opacity: 0.75;
    transition: transform 0.2s ease;
}

.phonetic-chip.active .chip-arrow {
    transform: rotate(180deg);
}

/* Popover Flotante de Opciones */
.phonetic-popover {
    position: absolute;
    z-index: 10000;
    width: 290px;
    background: #161826;
    border: 1px solid #2e334d;
    border-radius: 12px;
    padding: 0.9rem;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75),
                0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    animation: popoverFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.phonetic-popover.hidden {
    display: none !important;
}

@keyframes popoverFadeIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.popover-header {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.6rem;
    font-weight: 700;
}

.popover-options {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.popover-option-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f101a;
    border: 1px solid #23273b;
    color: #cbd5e1;
    padding: 0.55rem 0.8rem;
    border-radius: 8px;
    font-size: 0.86rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.popover-option-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: #6366f1;
    color: #ffffff;
}

.popover-option-btn.selected {
    background: #6366f1;
    border-color: #6366f1;
    color: #ffffff;
    font-weight: 600;
}

.popover-custom-wrap {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid #23273b;
}

.popover-custom-input {
    width: 100%;
    background: #090a12;
    border: 1px solid #2d324a;
    border-radius: 8px;
    padding: 0.52rem 0.7rem;
    color: #ffffff;
    font-size: 0.82rem;
    outline: none;
    box-sizing: border-box;
}

.popover-custom-input:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
}

/* Pie de Panel / Footer */
.redactor-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 1.2rem;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #ffffff;
    border: none;
    padding: 0.78rem 1.6rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: transparent;
    color: #64748b;
    border: 1px solid #262a3d;
    padding: 0.78rem 1.3rem;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    color: #94a3b8;
    border-color: #3b425e;
    background: rgba(255, 255, 255, 0.02);
}