/* Archivo: css/estilos.css */

/* Reinicio básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Inter, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #F8F8F8;
    color: #333;
    min-height: 100vh;
    padding: 0;
}

/* Encabezado */
.header {
    background: linear-gradient(150deg, #fdfbfa, #e2d1c4);
    padding: 2rem 0;
    margin-bottom: 2rem;
    text-align: left;
}

.header h1 {
    font-size: 2rem;
    color: #1A1A1A;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header p {
    color: #d1b594;
    font-size: 1rem;
    margin-bottom: 2rem;
}

.header .acciones {
    margin: 0;
    text-align: left;
}

/* Contenedor principal */
.contenedor {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
}

/* Sección de acciones (botón nueva aventura, etc.) */
.acciones {
    text-align: right;
    margin-bottom: 1.5rem;
}

/* Botones */
.boton {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background-color: #d1b594;
    color: #000;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
}
.boton:hover {
    background-color: #c1a584;
}

.boton-generar {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    margin-left: 1rem;
    background-color: #2196F3;
    color: #fff;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
    font-weight: bold;
}
.boton-generar:hover {
    background-color: #1976D2;
}

.boton-generar svg {
    color: #fff;
}

/* Secciones de la lista de aventuras */
.aventuras-pendientes, .aventuras-completadas {
    margin-bottom: 2rem;
}

.aventuras-pendientes h2, .aventuras-completadas h2 {
    margin-bottom: 1rem;
}

/* Tarjetas de aventura */
.aventura-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
}

.aventura-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.aventura-info p {
    margin: 0;
}

.aventura-actions {
    display: flex;
    align-items: center;
}

.boton-eliminar {
    display:none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #e74c3c;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-left: 1rem;
}

.boton-eliminar:hover {
    opacity: 1;
    transform: scale(1.1);
    background-color: rgba(231, 76, 60, 0.1);
}

.boton-eliminar svg {
    width: 20px;
    height: 20px;
}

.etiqueta-pendiente {
    padding: 0.3rem 0.6rem;
    background-color: #ffa726;
    color: #fff;
    border-radius: 3px;
    font-size: 0.8rem;
}

.etiqueta-completada {
    padding: 0.3rem 0.6rem;
    background-color: #66bb6a;
    color: #fff;
    border-radius: 3px;
    font-size: 0.8rem;
}

/* Formulario en nueva_aventura.php */
.form-aventura {
    margin-bottom: 2rem;
}

.form-aventura .campo {
    margin-bottom: 1.5rem;
}

.form-aventura label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #666;
}

.form-aventura input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
}

.form-aventura input[type="text"]:focus {
    outline: none;
    border-color: #D4B69B;
    box-shadow: 0 0 0 2px rgba(212, 182, 155, 0.2);
}

/* Sección de grabaciones */
.grabaciones {
    text-align: center;
    margin: 3rem 0;
}

.grabaciones h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #1A1A1A;
}

.no-grabaciones {
    color: #666;
    margin-bottom: 2rem;
}

.boton-circular {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    background-color: #D4B69B;
    color: #000;
    transition: transform 0.2s;
}

.boton-circular:hover {
    transform: scale(1.05);
}

.campo-ayuda {
    display: block;
    color: #666;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.lista-audios {
    margin-top: 2rem;
}

.lista-audios ul {
    list-style: none;
    display: grid;
    gap: 1rem;
}

.lista-audios li {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
}

.lista-audios audio {
    flex: 1;
    height: 40px;
}

.form-header {
    display: flex;
    justify-content: flex-end;
}

/* Estilos para la grabación */
.grabacion-botones {
    margin: 2rem 0;
    display: flex;
    justify-content: center;
}

.boton-grabacion {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #D4B69B;
    border: none;
    color: #1A1A1A;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}

.boton-grabacion:hover {
    transform: scale(1.05);
}

.boton-grabacion.grabando {
    background-color: #e74c3c;
    animation: pulsar 2s infinite;
}

@keyframes pulsar {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

/* Estilos para la página principal */
.boton-nueva-aventura {
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border-radius: 2rem;
    transition: transform 0.2s, background-color 0.2s;
}

.aventura-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.aventura-card a {
    color: #1A1A1A;
    text-decoration: none;
}

.aventura-card a:hover {
    color: #D4B69B;
}

.aventura-card small {
    color: #666;
    font-size: 0.85rem;
}

.etiqueta-pendiente,
.etiqueta-completada {
    padding: 0.3rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

.etiqueta-pendiente {
    background-color: #ffeeba;
    color: #856404;
}

.etiqueta-completada {
    background-color: #d4edda;
    color: #155724;
}

/* Estilos responsivos */
@media (max-width: 767px) {
    .header {
        padding: 1.5rem 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .aventura-card {
        padding: 1rem;
        position: relative;
        touch-action: pan-y;
        transform: translateX(0);
        transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    }

    .aventura-card::after {
        content: "Desliza para eliminar";
        position: absolute;
        left: 100%;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: #e74c3c;
        color: white;
        display: flex;
        align-items: center;
        padding-left: 1rem;
        font-size: 0.9rem;
        opacity: 0;
        transition: opacity 0.2s;
    }

    .aventura-card.swiping::after {
        opacity: 1;
        left: 0;
    }

    .aventura-card.swipe-delete {
        transform: translateX(-80%);
        opacity: 0;
    }

    .etiqueta-pendiente,
    .etiqueta-completada {
        position: absolute;
        top: 0.8rem;
        right: 1rem;
    }

    .campo {
        margin-bottom: 1rem;
    }

    .campo label {
        font-size: 0.9rem;
        margin-bottom: 0.3rem;
    }

    .campo input,
    .campo textarea {
        font-size: 1rem;
        padding: 0.5rem;
    }

    .boton {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .boton-grabacion {
        width: 56px;
        height: 56px;
    }

    .boton-grabacion svg {
        width: 20px;
        height: 20px;
    }

    audio {
        max-width: 100%;
        margin-right: 0.5rem;
    }

    ul {
        padding-left: 0;
    }

    li {
        margin-bottom: 1rem;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    li audio {
        flex: 1;
        min-width: 200px;
    }

    .lista-audios ul {
        gap: 0;
    }

    .aventura-actions {
        display: none; /* Ocultar botón de eliminar en móvil */
    }
    
    .etiqueta-pendiente,
    .etiqueta-completada {
        align-self: flex-start;
    }
}

/* Meta viewport tag */
@media screen and (max-width: 320px) {
    html {
        font-size: 14px;
    }
}

/* Ejemplo de onda como separador
   Puedes usar un SVG de onda (wave) e insertarlo como background 
   o en una pseudo-clase ::after o ::before, si quieres 
*/
.header {
    position: relative;
    z-index: 1;
}

.header::after {
    content: "";
    display: block;
    position: absolute;
    bottom: -20px; /* Ajusta según altura de la onda */
    left: 0;
    width: 100%;
    height: 40px;  /* Ajusta según el SVG */
    background: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwMCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMCAwIDE2MDAgNDAiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTAgMjBjNjAgMCAxMjUtMzUgMTg2LTMycyA3MCAzMiAxMzYgMzJjMzQgMCA1OC0xMiA5OC0xMiAzNCAwIDcwIDggMTAwIDEyczUxIDEyIDc2IDEyIDUzLTggOTYtMTIgMTQ1LTEyIDI1IDIwLTQ1IDI0LTcwIDI0Yy0xMDUgMC0xMzMtNDUtMjI0LTQ1cy0xMzggNDUtMjAwIDQ1Yy00MCAwLTcwLTI0LTEzMS0yNC0zOCAwLTYwIDIzLTgwIDI0cy0yMi0yNC00Mi0yNC03MCAxMi0xMDEgMTItNTIgMC0xMDMtMjQtMTYzLTI0LTIyMCAwLTIzNyA0MC0yODAgNDAiIGZpbGw9IiNmZmYiIG9wYWNpdHk9IjAuNCIvPjwvc3ZnPg==") repeat-x;
    background-size: contain;
}

/* Añadir estilos para el modal de carga */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.5rem;
}

.modal-content p {
    color: #666;
    margin-bottom: 1.5rem;
}

/* Loader moderno estilo AI */
.ai-loader {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    position: relative;
}

.ai-loader::before {
    content: '';
    width: 48px;
    height: 48px;
    border: 2px solid #6e9ecc;
    border-right-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Añadir al archivo de estilos */
.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    max-width: 600px;  /* Mismo ancho que .contenedor */
    margin: 0 auto;    /* Centrar */
    padding: 0 2rem;   /* Mismo padding que .contenedor */
}

.header-flex h1 {
    font-size: 1.4rem;
    margin: 0;
}

.boton-volver {
    background-color: #f0f0f0;
    color: #333;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    transition: background-color 0.2s;
}

.boton-volver:hover {
    background-color: #e0e0e0;
}

/* En pantallas pequeñas, ajustamos el diseño */
@media (max-width: 600px) {
    .header-flex {
        padding: 0 1rem;
    }
    
    .header-flex h1 {
        font-size: 1.3rem;
    }

    .aventura-content{
        max-width: 68%;
    }
}

/* En el media query para desktop (min-width: 768px) */
@media (min-width: 768px) {
    .aventura-card {
        align-items: flex-start;
        position: relative;
    }
    
    .aventura-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .etiqueta-pendiente,
    .etiqueta-completada {
        position: absolute;
        top: 1.5rem;
        right: 4rem;
    }
    
    .boton-eliminar {
        margin-left: 1.5rem;
        display: flex;
    }
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.modal-acciones {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.boton-primario {
    background-color: #d1b594;
    color: #000;
}

/* Controles de grabación */
.controles-grabacion {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

/* Botón grabar */
.boton-grabar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #d1b594; /* Color principal */
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.boton-grabar:hover {
    background-color: #c4a27d;
    transform: scale(1.05);
}

.boton-grabar.grabando {
    background-color: #e74c3c; /* Rojo cuando está grabando */
}

.boton-grabar.grabando:hover {
    background-color: #c0392b;
}

/* Botón generar artículo */
.boton-generar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #2196F3;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.boton-generar:hover {
    background-color: #1976D2;
    transform: scale(1.05);
}

.boton-generar svg {
    color: white; /* Icono en blanco */
}

/* Modal de confirmación */
.modal-confirmacion {
    text-align: center;
    padding: 2rem;
}

.modal-confirmacion .botones-confirmacion {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.boton-confirmar, .boton-cancelar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.boton-confirmar {
    background-color: #d1b594;
}

.boton-cancelar {
    background-color: #e0e0e0;
}

.pending-label {
    color: #666;
    font-size: 0.8em;
    margin-left: 1rem;
    font-style: italic;
}

[data-pending="true"] {
    opacity: 0.7;
    background: #f8f8f8;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 6px;
}

.etiqueta-tag {
    background-color: #f7f5f4;
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    white-space: nowrap;
    color: #666;
}

.etiqueta-pendiente,
.etiqueta-completada {
    align-self: flex-start;
}

/* Estilos para el artículo generado */
.article-section {
    margin-top: 2rem;
    padding: 1rem;
}

.article-card {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}