/* Estilos generales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    background-color: #f8f9fa;
}

/* Estilo del título principal */
h1 {
    text-align: center;
    font-size: 2.2em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    margin-bottom: 20px;
    cursor: default;
}

.upc {
    transition: all 0.3s ease;
    display: inline-block;
}

.upc:hover {
    text-transform: uppercase;
    transform: translateY(-2px);
    color: #764ba2;
    text-shadow: 0 0 5px rgba(118, 75, 162, 0.5);
}

/* Botón de recargar */
.recargar-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    opacity: 0.5;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.recargar-btn:hover {
    opacity: 1;
    transform: rotate(180deg);
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.4);
}

/* Filtros */
#filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding: 15px;
    background: linear-gradient(135deg, #f5f0ff 0%, #e8e0ff 100%);
    border-radius: 8px;
    border: 1px solid #d4c4ff;
}

.filtro-grupo {
    flex: 1;
    min-width: 250px;
}

.filtro-grupo label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #5a4a8a;
    font-size: 0.95em;
}

.filtro-grupo select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #c4b5fd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.filtro-grupo select:hover {
    border-color: #764ba2;
    box-shadow: 0 0 5px rgba(118, 75, 162, 0.3);
}

.filtro-grupo select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

/* Lista de audios */
#lista_audios {
    margin-bottom: 20px;
}

.audio-item {
    border: 1px solid #d4c4ff;
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    background-color: white;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.audio-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    border-color: #764ba2;
}

.audio-info {
    flex: 1;
}

.audio-detalles {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.9em;
    color: #666;
}

.audio-detalles span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Botón seleccionar */
.seleccionar-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.seleccionar-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(118, 75, 162, 0.4);
}

.icono-audio {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
}

/* Área de trabajo */
#area_trabajo {
    background: linear-gradient(135deg, #faf8ff 0%, #f0ebff 100%);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    border: 1px solid #d4c4ff;
}

#area_trabajo h3 {
    color: #5a4a8a;
    margin-top: 0;
    margin-bottom: 10px;
}

/* Reproductor de audio */
audio {
    width: 100%;
    margin: 10px 0;
    border-radius: 30px;
    outline: none;
}

audio::-webkit-media-controls-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 30px;
}

audio::-webkit-media-controls-play-button {
    background-color: white;
    border-radius: 50%;
}

audio::-webkit-media-controls-timeline {
    background-color: rgba(255,255,255,0.3);
    border-radius: 10px;
}

audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
    color: white;
    font-weight: bold;
}

/* Caja de texto */
textarea {
    width: 100%;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    padding: 12px;
    border: 2px solid #c4b5fd;
    border-radius: 8px;
    transition: all 0.3s;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 8px rgba(118, 75, 162, 0.3);
}

/* Botones de fonemas */
#teclado_fonemas {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 15px 0;
}

.fonema-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 18px;
    font-size: 18px;
    font-family: monospace;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.2s;
    min-width: 55px;
    position: relative;
}

.fonema-btn:active {
    cursor: grabbing;
}

.fonema-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.fonema-btn:hover::after {
    content: "✋ Arrastrable";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    margin-bottom: 5px;
    z-index: 1000;
}

/* Panel de instrucciones de arrastre (generado por JS) */
#instrucciones-arrastre {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

#info-audio {
    background: linear-gradient(135deg, #e8e0ff 0%, #ddd0ff 100%);
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid #764ba2;
}

/* Botón descargar */
#btn-descargar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-block;
    margin-top: 10px;
}

#btn-descargar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.4);
}

/* Mensaje flotante */
.mensaje-flotante {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 9999;
    font-size: 14px;
    pointer-events: none;
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Responsive */
@media (max-width: 768px) {
    #filtros {
        flex-direction: column;
        gap: 15px;
    }
    
    .filtro-grupo {
        min-width: auto;
    }
    
    .audio-item {
        flex-direction: column;
        text-align: center;
    }
    
    h1 {
        font-size: 1.5em;
    }
    
    .fonema-btn {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 45px;
    }
    
    .recargar-btn {
        width: 35px;
        height: 35px;
        font-size: 18px;
        bottom: 15px;
        left: 15px;
    }
}

/* Contenedor fijo para botón y créditos */
.fixed-buttons {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    z-index: 1000;
}

/* Botón de recargar - fijo en esquina inferior IZQUIERDA */
.recargar-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    opacity: 0.5;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
}

.recargar-btn:hover {
    opacity: 1;
    transform: rotate(180deg);
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.4);
}

/* Créditos - fijo en esquina inferior DERECHA */
.creditos {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 12px;
    color: #999;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 12px;
    backdrop-filter: blur(5px);
    transition: all 0.3s;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 1000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: center;
}

.creditos a {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
}

.creditos a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.creditos:hover {
    color: #333;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Forzar posición */
.recargar-btn,
.creditos {
    position: fixed !important;
}

.recargar-btn {
    bottom: 20px !important;
    left: 20px !important;
    right: auto !important;
}

.creditos {
    bottom: 20px !important;
    right: 20px !important;
    left: auto !important;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .recargar-btn {
        bottom: 15px;
        left: 15px;
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .creditos {
        bottom: 15px;
        right: 15px;
        font-size: 10px;
        padding: 3px 6px;
    }
}

/* Estilos para categorías colapsables de fonemas */
.categoria-fonemas {
    margin-bottom: 15px;
    border: 1px solid #d4c4ff;
    border-radius: 8px;
    overflow: hidden;
}

.categoria-header {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    padding: 10px 12px;
    transition: background 0.3s;
}

.categoria-header:hover {
    background: linear-gradient(135deg, #7b8cee 0%, #8b5cb2 100%);
}

.categoria-toggle {
    display: inline-block;
    width: 20px;
    font-size: 12px;
    color: white;
    transition: transform 0.3s;
    margin-right: 8px;
    transform: rotate(90deg);
}

.categoria-titulo {
    color: white;
    margin: 0;
    font-size: 14px;
    font-weight: bold;
    flex: 1;
}

.categoria-botones {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
    background: #faf8ff;
}

/* Botones dentro de categorías */
.categoria-botones .fonema-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 16px;
    font-family: monospace;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s;
    min-width: 45px;
}

.categoria-botones .fonema-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(118, 75, 162, 0.4);
}

/* Estilo para detalles del audio seleccionado */
.audio-detalles-seleccionado {
    background: linear-gradient(135deg, #e8e0ff 0%, #ddd0ff 100%);
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid #764ba2;
    font-size: 13px;
    line-height: 1.5;
}

/* Estilo para los detalles del audio en la lista */
.audio-detalles {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85em;
    color: #555;
    margin-top: 5px;
}

.audio-detalles span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Logo UAB en la parte superior derecha */
.uab-header {
    position: absolute;
    top: 20px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.uab-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    gap: 8px;
    transition: transform 0.3s ease;
}

.uab-link:hover {
    transform: scale(1.02);
}

.uab-logo {
    width: 60px;
    height: 60px;
    display: block;
    transition: all 0.3s;
}

.uab-link:hover .uab-logo {
    filter: brightness(1.05);
}

.uab-texto {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #177245;
    text-align: center;
    line-height: 1.3;
    max-width: 120px;
    letter-spacing: 0.3px;
}

/* Ajuste para pantallas móviles */
@media (max-width: 768px) {
    .uab-header {
        top: 10px;
        right: 10px;
    }
    
    .uab-logo {
        width: 45px;
        height: 45px;
    }
    
    .uab-texto {
        font-size: 9px;
        max-width: 90px;
    }
}

/* Para pantallas muy pequeñas, ajustar para que no se superponga con el título */
@media (max-width: 600px) {
    h1 {
        margin-top: 50px;
        font-size: 1.3em;
    }
}

/* Ajuste general para el título cuando hay logo fijo */
body {
    padding-top: 0;
}

@media (max-width: 600px) {
    h1 {
        padding-top: 50px;
    }
}

.ipa-chart-link {
    font-size: 0.7rem;
    margin-left: 30px;
    font-weight: bold;
}

.ipa-chart-link a {
    text-decoration: none;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    padding: 3px 10px;
    border-radius: 15px;
    transition: all 0.3s ease;
    display: inline-block;
}

.ipa-chart-link a:hover {
    background: rgba(102, 126, 234, 0.2);
    color: #764ba2;
    transform: scale(1.02);
    text-decoration: none;
}

/* Toolbar de botones de transcripción */
#toolbar-transcripcion {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 15px 0;
    padding: 10px 0;
    border-top: 1px solid #e0d4ff;
    align-items: center;
}

#toolbar-transcripcion button {
    white-space: nowrap;
}

@media (max-width: 600px) {
    #toolbar-transcripcion {
        flex-direction: column;
        align-items: stretch;
    }
    
    #toolbar-transcripcion button {
        width: 100%;
    }
}
