/* =========================================================================
   Für meine Sandra ❤️ – Stylesheet
   Romantisch, warm, mobile first. Creme / Rosé / sanftes Rot.
   ========================================================================= */

:root {
    --cream:      #fff7f2;
    --cream-2:    #ffeede;
    --rose:       #f7c9c9;
    --rose-deep:  #e79aa3;
    --red:        #c8536b;
    --red-deep:   #a83b54;
    --ink:        #5a3d42;
    --ink-soft:   #8a6a70;
    --white:      #fffdfb;
    --shadow:     0 18px 40px -18px rgba(168, 59, 84, 0.45);
    --radius:     22px;
    --font:       "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    color: var(--ink);
    min-height: 100vh;
    background:
        radial-gradient(120% 90% at 50% -10%, var(--rose) 0%, transparent 55%),
        radial-gradient(100% 80% at 100% 100%, var(--cream-2) 0%, transparent 60%),
        linear-gradient(160deg, var(--cream) 0%, #ffe9e4 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

.hidden { display: none !important; }
.muted  { color: var(--ink-soft); }
.center { text-align: center; }

/* ---------- Schwebende Herzchen ---------------------------------------- */
.hearts {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
.hearts span {
    position: absolute;
    bottom: -40px;
    font-size: 18px;
    color: var(--rose-deep);
    opacity: 0;
    animation: float-up 14s linear infinite;
}
.hearts span:nth-child(1) { left: 8%;  animation-delay: 0s;   font-size: 14px; }
.hearts span:nth-child(2) { left: 28%; animation-delay: 4s;   font-size: 22px; }
.hearts span:nth-child(3) { left: 52%; animation-delay: 8s;   font-size: 16px; }
.hearts span:nth-child(4) { left: 73%; animation-delay: 2s;   font-size: 20px; }
.hearts span:nth-child(5) { left: 90%; animation-delay: 6s;   font-size: 13px; }

/* Nach dem Login: ruhiger Hintergrund, keine schwebenden Herzchen */
.page-player .hearts { display: none; }
.page-player {
    background:
        linear-gradient(170deg, var(--cream) 0%, #ffeee9 100%);
}

@keyframes float-up {
    0%   { transform: translateY(0) rotate(0deg);    opacity: 0; }
    10%  { opacity: .7; }
    90%  { opacity: .5; }
    100% { transform: translateY(-110vh) rotate(40deg); opacity: 0; }
}

/* ---------- Karten ----------------------------------------------------- */
.card {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(231, 154, 163, 0.25);
    z-index: 1;
}

/* =========================================================================
   LOGIN
   ========================================================================= */
.login-wrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 40px 30px 34px;
    text-align: center;
    overflow: hidden;
    animation: pop-in .6s cubic-bezier(.2,.8,.3,1.2) both;
}

.card-glow {
    position: absolute;
    inset: -40% -40% auto -40%;
    height: 220px;
    background: radial-gradient(closest-side, rgba(247,201,201,.6), transparent);
    filter: blur(10px);
}

@keyframes pop-in {
    0%   { opacity: 0; transform: translateY(18px) scale(.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.kicker {
    margin: 0 0 4px;
    font-size: 15px;
    letter-spacing: .3px;
    color: var(--red);
}
.title {
    margin: 0 0 6px;
    font-size: 34px;
    font-weight: 800;
    color: var(--red-deep);
    line-height: 1.1;
}
.subtitle {
    margin: 0 0 26px;
    color: var(--ink-soft);
    font-size: 15px;
}

.beat { display: inline-block; animation: beat 1.4s ease-in-out infinite; }
@keyframes beat {
    0%, 100% { transform: scale(1); }
    15%      { transform: scale(1.25); }
    30%      { transform: scale(1); }
}

.login-form { display: flex; flex-direction: column; gap: 12px; }

.login-form input {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1.5px solid var(--rose);
    background: var(--cream);
    font-size: 16px;
    color: var(--ink);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.login-form input:focus {
    border-color: var(--rose-deep);
    box-shadow: 0 0 0 4px rgba(231,154,163,.25);
}
.login-form input.input-error {
    border-color: var(--red);
    animation: shake .4s;
}
@keyframes shake {
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.login-form button {
    padding: 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .3px;
    box-shadow: 0 10px 22px -10px var(--red-deep);
    transition: transform .15s, box-shadow .15s;
}
.login-form button:hover { transform: translateY(-2px); }
.login-form button:active { transform: translateY(0); }

.error-msg {
    margin: 16px 0 0;
    color: var(--red-deep);
    font-size: 14px;
}

/* =========================================================================
   PLAYER
   ========================================================================= */
.player-wrap {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 14px 130px;   /* unten Platz für die Player-Leiste */
}

/* ---------- Hero / Header --------------------------------------------- */
.hero {
    position: relative;
    margin: 14px 0 18px;
    height: 220px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.hero-placeholder {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 100% at 30% 20%, var(--rose) 0%, transparent 60%),
        linear-gradient(135deg, var(--rose-deep) 0%, var(--red) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-heart {
    font-size: 64px;
    color: rgba(255,255,255,.85);
    animation: beat 1.6s ease-in-out infinite;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,.15));
}
.hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .6s ease;
}
.hero-img.is-loaded { opacity: 1; }

.hero-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 28px 20px 16px;
    color: #fff;
    background: linear-gradient(to top, rgba(120,30,50,.65), transparent);
}
.hero-overlay h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.hero-overlay p {
    margin: 4px 0 0;
    font-size: 14px;
    opacity: .95;
}
.logout {
    position: absolute;
    top: 12px; right: 12px;
    background: rgba(255,255,255,.85);
    color: var(--red-deep);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
}

/* ---------- Controls / Filter ----------------------------------------- */
.controls {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}
.filter-toggle {
    display: inline-flex;
    background: var(--white);
    padding: 5px;
    border-radius: 999px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(231,154,163,.25);
}
.chip {
    border: none;
    background: transparent;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 999px;
    transition: background .2s, color .2s;
}
.chip.is-active {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
    color: #fff;
}
.count {
    display: inline-block;
    min-width: 18px;
    font-size: 12px;
    background: rgba(255,255,255,.35);
    border-radius: 999px;
    padding: 0 5px;
    margin-left: 2px;
}

/* ---------- Playlist --------------------------------------------------- */
.playlist-card { padding: 8px; }
.empty-card    { padding: 30px 24px; text-align: center; margin-top: 10px; }
.empty-card code, .muted code {
    background: var(--cream-2);
    padding: 1px 6px;
    border-radius: 6px;
    font-size: .9em;
}

.playlist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.song {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 14px;
    transition: background .2s;
    cursor: pointer;
    user-select: none;
}
.song + .song { border-top: 1px solid rgba(231,154,163,.18); }
.song:hover { background: var(--cream); }

.song.is-playing {
    background: linear-gradient(135deg, rgba(247,201,201,.55), rgba(255,233,228,.55));
    border-top-color: transparent;
}
.song.is-playing .song-title { color: var(--red-deep); font-weight: 700; }

/* Drag-Zustände */
.song.dragging { opacity: .4; }
.song.drag-over { box-shadow: inset 0 2px 0 var(--red); }

.drag-handle {
    color: var(--rose-deep);
    font-size: 18px;
    cursor: grab;
    line-height: 1;
    touch-action: none;
}
.drag-handle:active { cursor: grabbing; }

.play-icon {
    flex: 0 0 38px;
    width: 38px; height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--cream-2);
    color: var(--red);
    font-size: 14px;
    transition: background .2s, color .2s, transform .15s;
}
.song:hover .play-icon { transform: scale(1.06); }
.song.is-playing .play-icon {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
    color: #fff;
}

.song-main { flex: 1 1 auto; min-width: 0; }
.song-title {
    display: block;
    font-size: 15px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.song-dur {
    display: block;
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 2px;
}

/* Herz-Checkbox */
.fav {
    flex: 0 0 auto;
    position: relative;
    width: 34px; height: 34px;
}
.fav input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.fav .fav-heart {
    display: grid;
    place-items: center;
    width: 100%; height: 100%;
    font-size: 22px;
    color: var(--rose-deep);
    opacity: .55;
    transition: transform .15s, opacity .2s, color .2s;
}
.fav input:hover + .fav-heart { transform: scale(1.15); opacity: .8; }
.fav input:checked + .fav-heart {
    color: var(--red);
    opacity: 1;
    animation: beat .5s;
}

/* =========================================================================
   PLAYER-LEISTE (sticky unten)
   ========================================================================= */
.player-bar {
    position: fixed;
    z-index: 5;
    left: calc(12px + env(safe-area-inset-left, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
    background: rgba(255, 253, 251, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(231,154,163,.35);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 12px 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "info    buttons"
        "seek    seek";
    align-items: center;
    gap: 8px 12px;
    animation: pop-in .4s ease both;
}
.pb-info { grid-area: info; min-width: 0; }
.pb-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--red-deep);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pb-time { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.pb-buttons {
    grid-area: buttons;
    display: flex;
    align-items: center;
    gap: 6px;
}
.pb-buttons button {
    background: transparent;
    color: var(--red);
    font-size: 20px;
    width: 40px; height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    transition: background .2s, transform .15s;
}
.pb-buttons button:hover { background: var(--cream-2); }
.pb-buttons button:active { transform: scale(.92); }
.pb-play {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%) !important;
    color: #fff !important;
    box-shadow: 0 8px 18px -8px var(--red-deep);
}

.pb-seek {
    grid-area: seek;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: var(--cream-2);
    outline: none;
    cursor: pointer;
}
.pb-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 2px 6px rgba(168,59,84,.5);
    cursor: pointer;
}
.pb-seek::-moz-range-thumb {
    width: 16px; height: 16px;
    border: none;
    border-radius: 50%;
    background: var(--red);
    cursor: pointer;
}

/* ---------- Etwas mehr Luft auf grösseren Screens --------------------- */
@media (min-width: 560px) {
    .hero { height: 260px; }
    .hero-overlay h1 { font-size: 28px; }
    .song { padding: 14px; }
}

/* Reduzierte Bewegung respektieren */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
