* {
    box-sizing: border-box;
}

:root {
    --texto: #2f3440;
    --blanco: rgba(255, 255, 255, 0.94);
    --borde: rgba(70, 70, 90, 0.12);
    --sombra: 0 10px 28px rgba(48, 52, 78, 0.10);
    --corazon: #e15d7d;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--texto);
    font-family: Arial, Helvetica, sans-serif;
    transition: background-color 0.35s ease, background-image 0.35s ease;
}

body.vista-1 {
    background-color: #dcefff;
    background-image: linear-gradient(135deg, #e7f5ff 0%, #cfe8fb 100%);
}

body.vista-2 {
    background-color: #ece2f8;
    background-image: none;
}

.barra-superior {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    padding: 16px 28px;
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 1px solid var(--borde);
    backdrop-filter: blur(10px);
}

.barra-superior h1 {
    margin: 0;
    font-size: clamp(22px, 4vw, 30px);
}

button {
    min-height: 44px;
    padding: 10px 18px;
    border: 0;
    border-radius: 11px;
    color: white;
    background: #7064bd;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.contenedor {
    width: min(900px, 100%);
    margin: 0 auto;
    padding: 36px 20px 72px;
}

.crear-nota {
    margin-bottom: 36px;
    padding: 22px;
    background: var(--blanco);
    border: 1px solid var(--borde);
    border-radius: 18px;
    box-shadow: var(--sombra);
}

.etiqueta {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
}

#textoNota {
    display: block;
    width: 100%;
    min-height: 120px;
    max-height: none;
    padding: 16px;
    overflow: hidden;
    resize: none;
    border: 1px solid #cfd3df;
    border-radius: 12px;
    outline: none;
    background: rgba(255, 255, 255, 0.96);
    color: var(--texto);
    font: inherit;
    font-size: 17px;
    line-height: 1.6;
}

#textoNota:focus {
    border-color: #8277ce;
    box-shadow: 0 0 0 3px rgba(130, 119, 206, 0.14);
}

.acciones {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

#mensaje {
    min-height: 20px;
    margin: 10px 0 0;
    color: #5a5f6d;
}

.lista-notas {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.fila-nota {
    position: relative;

    display: grid;

    grid-template-columns:
        55px
        minmax(0, 1fr)
        55px;

    align-items: center;

    gap: 10px;

    margin-bottom: 25px;
}

/* ===================================
   LIRIOS DE LA VISTA 2
=================================== */

body.vista-2 .fila-nota::before,
body.vista-2 .fila-nota::after {

    content: "";

    position: absolute;

    width: 190px;
    height: 240px;

    background-repeat: no-repeat;

    background-position: center;

    background-size: contain;

    /* Qué tan visibles son los lirios */
    opacity: 0.28;

    /* No interfieren con botones ni texto */
    pointer-events: none;

    /* Se mantienen detrás de las notas */
    z-index: 0;
}


/* ===================================
   LIRIO IZQUIERDO
=================================== */

body.vista-2 .fila-nota::before {

    left: -200px;

    top: 50%;

    transform:
        translateY(-50%);
}


/* ===================================
   LIRIO DERECHO
=================================== */

body.vista-2 .fila-nota::after {

    right: -200px;

    top: 50%;

    transform:
        translateY(-50%)
        scaleX(-1);
}


/* ===================================
   NOTAS 1, 3, 5, 7...
=================================== */

body.vista-2
.fila-nota:nth-child(odd)::before {

    background-image:
        url("/static/img/lirio_1_transparente.png");
}


body.vista-2
.fila-nota:nth-child(odd)::after {

    background-image:
        url("/static/img/lirio_2_transparente.png");
}


/* ===================================
   NOTAS 2, 4, 6, 8...
=================================== */

body.vista-2
.fila-nota:nth-child(even)::before {

    background-image:
        url("/static/img/lirio_2_transparente.png");
}


body.vista-2
.fila-nota:nth-child(even)::after {

    background-image:
        url("/static/img/lirio_1_transparente.png");
}

.corazones {
    position: relative;

    z-index: 2;

    display: flex;

    flex-direction: column;

    align-items: center;

    gap: 12px;

    user-select: none;
}

.corazones span {
    display: inline-block;
    color: var(--corazon);
    font-size: 24px;
    animation: latido 1.7s infinite ease-in-out;
}

.corazones span:nth-child(2) {
    animation-delay: 0.22s;
}

.corazones span:nth-child(3) {
    animation-delay: 0.44s;
}

@keyframes latido {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.22); }
}

.nota {
    position: relative;
    z-index: 2;

    width: 100%;
    min-height: 130px;

    padding: 24px;

    display: flex;
    flex-direction: column;

    background:
        rgba(
            255,
            255,
            255,
            0.95
        );

    border-radius: 18px;

    box-shadow:
        0 7px 20px
        rgba(
            0,
            0,
            0,
            0.08
        );

    transition:
        transform 0.2s ease;
}

.contenido-nota {
    margin: 0;
    color: #30333d;
    font-size: 17px;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.fecha-nota {
    align-self: flex-start;
    margin-top: 20px;
    color: #7b7f89;
    font-size: 13px;
}

.estado-vacio,
.estado-error {
    margin: 0;
    padding: 22px;
    text-align: center;
    background: rgba(255, 255, 255, 0.70);
    border-radius: 14px;
}

.estado-error {
    color: #9a3045;
}

@media (max-width: 600px) {
    .barra-superior {
        padding: 12px 14px;
    }

    .barra-superior button {
        padding: 9px 13px;
        font-size: 14px;
    }

    .contenedor {
        padding: 24px 8px 60px;
    }

    .crear-nota {
        margin-inline: 4px;
        padding: 16px;
    }

    .fila-nota {
        grid-template-columns: 26px minmax(0, 1fr) 26px;
        gap: 3px;
    }

    .corazones span {
        font-size: 17px;
    }

    .nota {
        padding: 18px;
    }

    /* ===================================
    LIRIOS EN CELULAR
    =================================== */

    body.vista-2 .fila-nota::before,
    body.vista-2 .fila-nota::after {

        width: 90px;
        height: 120px;

        opacity: 0.16;
    }


    body.vista-2 .fila-nota::before {

        left: -35px;
    }


    body.vista-2 .fila-nota::after {

        right: -35px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
