/* ═══════════════════════════════════════════════════════
   Josefina's Habit Tracker — Pastelový design
   ═══════════════════════════════════════════════════════ */

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

body {
    font-family: 'Nunito', sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #fce4ec, #e8d5f5, #d5e8f5, #fce4ec);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
    color: #4a3f5c;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hidden { display: none !important; }

/* ─── SCREENS ─────────────────────────────────────── */
.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ─── LOGIN ───────────────────────────────────────── */
#login-screen {
    justify-content: center;
}

.login-row {
    display: flex;
    align-items: center;
    gap: 40px;
    max-width: 700px;
    width: 95%;
}

@media (max-width: 640px) {
    .login-row {
        flex-direction: column;
        gap: 16px;
    }
    .peppi-container {
        width: 160px !important;
        height: 260px !important;
    }
    .peppi-container svg {
        width: 160px !important;
        height: 260px !important;
    }
}

/* ─── PEPPI ──────────────────────────────────────── */
.peppi-container {
    width: 220px;
    height: 360px;
    flex-shrink: 0;
}

/* === Celá figurka — hlavní skok (5.5s loop) === */
.peppi-figure {
    animation: peppiDance 5.5s ease-in-out infinite;
    transform-origin: 110px 340px;
}

@keyframes peppiDance {
    0%   { transform: translateY(0) rotate(0deg); }
    6%   { transform: translateY(-30px) rotate(-3deg); }
    12%  { transform: translateY(0) rotate(0deg); }
    18%  { transform: translateY(-20px) rotate(4deg); }
    24%  { transform: translateY(0) rotate(0deg); }
    30%  { transform: translateY(-35px) rotate(-2deg); }
    36%  { transform: translateY(0) rotate(2deg); }
    42%  { transform: translateY(-15px) rotate(0deg); }
    48%  { transform: translateY(0) rotate(-3deg); }
    54%  { transform: translateY(-25px) rotate(3deg); }
    60%  { transform: translateY(0) rotate(0deg); }
    66%  { transform: translateY(-40px) rotate(-4deg); }
    72%  { transform: translateY(0) rotate(0deg); }
    78%  { transform: translateY(-18px) rotate(2deg); }
    84%  { transform: translateY(0) rotate(-2deg); }
    90%  { transform: translateY(-28px) rotate(3deg); }
    96%  { transform: translateY(-5px) rotate(0deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

/* === Levá ruka — mávání === */
.peppi-arm-left {
    animation: peppiArmLeft 5.5s ease-in-out infinite;
    transform-origin: 65px 190px;
}

@keyframes peppiArmLeft {
    0%   { transform: rotate(0deg); }
    8%   { transform: rotate(-25deg); }
    16%  { transform: rotate(10deg); }
    24%  { transform: rotate(-15deg); }
    32%  { transform: rotate(20deg); }
    40%  { transform: rotate(-30deg); }
    48%  { transform: rotate(5deg); }
    56%  { transform: rotate(-20deg); }
    64%  { transform: rotate(25deg); }
    72%  { transform: rotate(-10deg); }
    80%  { transform: rotate(15deg); }
    88%  { transform: rotate(-25deg); }
    96%  { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}

/* === Pravá ruka — mávání (protipohyb) === */
.peppi-arm-right {
    animation: peppiArmRight 5.5s ease-in-out infinite;
    transform-origin: 155px 190px;
}

@keyframes peppiArmRight {
    0%   { transform: rotate(0deg); }
    8%   { transform: rotate(20deg); }
    16%  { transform: rotate(-15deg); }
    24%  { transform: rotate(25deg); }
    32%  { transform: rotate(-20deg); }
    40%  { transform: rotate(30deg); }
    48%  { transform: rotate(-10deg); }
    56%  { transform: rotate(20deg); }
    64%  { transform: rotate(-25deg); }
    72%  { transform: rotate(15deg); }
    80%  { transform: rotate(-20deg); }
    88%  { transform: rotate(25deg); }
    96%  { transform: rotate(-5deg); }
    100% { transform: rotate(0deg); }
}

/* === Levá noha === */
.peppi-leg-left {
    animation: peppiLegLeft 5.5s ease-in-out infinite;
    transform-origin: 95px 295px;
}

@keyframes peppiLegLeft {
    0%   { transform: rotate(0deg); }
    10%  { transform: rotate(-12deg); }
    20%  { transform: rotate(8deg); }
    30%  { transform: rotate(-15deg); }
    40%  { transform: rotate(5deg); }
    50%  { transform: rotate(-8deg); }
    60%  { transform: rotate(12deg); }
    70%  { transform: rotate(-10deg); }
    80%  { transform: rotate(6deg); }
    90%  { transform: rotate(-12deg); }
    100% { transform: rotate(0deg); }
}

/* === Pravá noha === */
.peppi-leg-right {
    animation: peppiLegRight 5.5s ease-in-out infinite;
    transform-origin: 125px 295px;
}

@keyframes peppiLegRight {
    0%   { transform: rotate(0deg); }
    10%  { transform: rotate(12deg); }
    20%  { transform: rotate(-10deg); }
    30%  { transform: rotate(15deg); }
    40%  { transform: rotate(-6deg); }
    50%  { transform: rotate(10deg); }
    60%  { transform: rotate(-12deg); }
    70%  { transform: rotate(8deg); }
    80%  { transform: rotate(-8deg); }
    90%  { transform: rotate(10deg); }
    100% { transform: rotate(0deg); }
}

/* === Hlava — jemný náklon === */
.peppi-head {
    animation: peppiHead 5.5s ease-in-out infinite;
    transform-origin: 110px 150px;
}

@keyframes peppiHead {
    0%   { transform: rotate(0deg); }
    12%  { transform: rotate(-5deg); }
    25%  { transform: rotate(4deg); }
    37%  { transform: rotate(-6deg); }
    50%  { transform: rotate(3deg); }
    62%  { transform: rotate(-4deg); }
    75%  { transform: rotate(5deg); }
    87%  { transform: rotate(-3deg); }
    100% { transform: rotate(0deg); }
}

/* === Šaty — vlnění === */
.peppi-dress {
    animation: peppiDress 5.5s ease-in-out infinite;
    transform-origin: 110px 175px;
}

@keyframes peppiDress {
    0%   { transform: scaleX(1) skewX(0deg); }
    12%  { transform: scaleX(1.04) skewX(-2deg); }
    25%  { transform: scaleX(0.97) skewX(2deg); }
    37%  { transform: scaleX(1.05) skewX(-3deg); }
    50%  { transform: scaleX(0.98) skewX(1deg); }
    62%  { transform: scaleX(1.03) skewX(-2deg); }
    75%  { transform: scaleX(0.97) skewX(3deg); }
    87%  { transform: scaleX(1.04) skewX(-1deg); }
    100% { transform: scaleX(1) skewX(0deg); }
}

/* === Buřinka — lehký posun === */
.peppi-hat {
    animation: peppiHat 5.5s ease-in-out infinite;
    transform-origin: 110px 30px;
}

@keyframes peppiHat {
    0%   { transform: rotate(0deg) translateY(0); }
    15%  { transform: rotate(-4deg) translateY(-2px); }
    30%  { transform: rotate(3deg) translateY(-1px); }
    45%  { transform: rotate(-5deg) translateY(-3px); }
    60%  { transform: rotate(2deg) translateY(0px); }
    75%  { transform: rotate(-3deg) translateY(-2px); }
    90%  { transform: rotate(4deg) translateY(-1px); }
    100% { transform: rotate(0deg) translateY(0); }
}

.login-box {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px 40px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 40px rgba(180, 160, 200, 0.25);
}

.login-box h1 {
    font-size: 28px;
    font-weight: 800;
    color: #6b5b7b;
    margin-bottom: 4px;
}

.subtitle {
    color: #9b8aad;
    font-size: 14px;
    margin-bottom: 32px;
}

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

.login-form input {
    padding: 14px 18px;
    border: 2px solid #e8d5f5;
    border-radius: 14px;
    font-size: 16px;
    font-family: 'Nunito', sans-serif;
    outline: none;
    transition: border-color 0.2s;
    background: rgba(255, 255, 255, 0.7);
}

.login-form input:focus {
    border-color: #b8a0d0;
}

.login-buttons {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.error {
    color: #e57373;
    font-size: 13px;
    min-height: 20px;
}

/* ─── BUTTONS ─────────────────────────────────────── */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 14px;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #b8a0d0, #d4a0c0);
    color: white;
    flex: 1;
}

.btn-secondary {
    background: rgba(184, 160, 208, 0.15);
    color: #7b6b8b;
    flex: 1;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.6);
    color: #7b6b8b;
}

.btn-add {
    background: linear-gradient(135deg, #a8d8a0, #b8e0a0);
    color: white;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248, 200, 216, 0.6); }
    50% { box-shadow: 0 0 0 15px rgba(248, 200, 216, 0); }
}

/* ─── WAKE SCREEN ─────────────────────────────────── */
#wake-screen {
    justify-content: center;
}

.wake-box {
    text-align: center;
    padding: 40px;
}

.wake-box h2 {
    font-size: 26px;
    color: #6b5b7b;
    margin-bottom: 8px;
}

.wake-box p {
    color: #9b8aad;
    font-size: 16px;
    margin-bottom: 20px;
}

#sheep-box-container {
    margin: 20px auto;
    width: 260px;
    height: 220px;
}

.clickable-box {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.clickable-box:hover {
    transform: scale(1.03);
}

.clickable-box:active {
    transform: scale(0.97);
}

/* ─── HEADER ──────────────────────────────────────── */
header {
    width: 100%;
    max-width: 960px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    margin: 0 auto;
}

header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #6b5b7b;
}

#today-date {
    font-size: 13px;
    color: #9b8aad;
}

/* ─── MAIN LAYOUT ─────────────────────────────────── */
.main-layout {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px 40px;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

/* ─── PANELS ──────────────────────────────────────── */
.panel {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 24px rgba(180, 160, 200, 0.15);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: #6b5b7b;
}

/* ─── SHEEP PANEL ─────────────────────────────────── */
.sheep-display {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.sheep-lives {
    display: flex;
    gap: 4px;
}

.life-heart {
    font-size: 20px;
    transition: all 0.3s;
}

.life-heart.lost {
    opacity: 0.2;
    filter: grayscale(1);
}

.sheep-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.sheep-stat {
    background: rgba(184, 160, 208, 0.1);
    border-radius: 12px;
    padding: 10px 14px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: #9b8aad;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 800;
    color: #6b5b7b;
}

.sheep-food {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    min-height: 36px;
}

.food-item {
    font-size: 22px;
    animation: foodPop 0.4s ease;
}

@keyframes foodPop {
    0% { transform: scale(0); }
    70% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ─── HABITS LIST ─────────────────────────────────── */
.habits-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.habit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid transparent;
    transition: all 0.2s;
}

.habit-item:hover {
    border-color: rgba(184, 160, 208, 0.3);
}

.habit-item.completed {
    opacity: 0.65;
}

.habit-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.habit-name {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
}

.habit-name.crossed {
    text-decoration: line-through;
    color: #b0a0b8;
}

/* Simple checkbox */
.habit-check {
    width: 28px;
    height: 28px;
    border: 2px solid #d0c0e0;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    background: white;
}

.habit-check:hover {
    border-color: #b8a0d0;
}

.habit-check.checked {
    background: linear-gradient(135deg, #b8a0d0, #d4a0c0);
    border-color: transparent;
}

.habit-check.checked::after {
    content: '✓';
    color: white;
    font-size: 16px;
    font-weight: 800;
}

/* Half checkbox */
.habit-half {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.half-btn {
    width: 36px;
    height: 28px;
    border: 2px solid #d0c0e0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #9b8aad;
    background: white;
    transition: all 0.2s;
}

.half-btn:first-child {
    border-radius: 8px 0 0 8px;
}

.half-btn:last-child {
    border-radius: 0 8px 8px 0;
}

.half-btn:hover {
    border-color: #b8a0d0;
}

.half-btn.checked {
    background: linear-gradient(135deg, #b8a0d0, #d4a0c0);
    border-color: transparent;
    color: white;
}

/* Progress dots */
.habit-progress {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
    flex-wrap: wrap;
    max-width: 140px;
    justify-content: flex-end;
}

.progress-dot {
    width: 20px;
    height: 20px;
    border: 2px solid #b8d8f0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.progress-dot:hover {
    border-color: #89cff0;
    transform: scale(1.15);
}

.progress-dot.filled {
    background: linear-gradient(135deg, #89cff0, #a0d0f0);
    border-color: transparent;
}

/* Delete habit */
.habit-delete {
    opacity: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #d0a0a0;
    padding: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.habit-item:hover .habit-delete {
    opacity: 1;
}

.habit-delete:hover {
    color: #e57373;
}

/* ─── MODAL ───────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(100, 80, 120, 0.3);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 12px 48px rgba(100, 80, 120, 0.3);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #6b5b7b;
    font-size: 20px;
}

.modal-content input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e8d5f5;
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Nunito', sans-serif;
    outline: none;
    margin-bottom: 16px;
}

.modal-content input[type="text"]:focus {
    border-color: #b8a0d0;
}

.habit-type-select {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.habit-type-select label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #6b5b7b;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 10px;
    transition: background 0.2s;
}

.habit-type-select label:hover {
    background: rgba(184, 160, 208, 0.1);
}

.color-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.color-picker label {
    font-size: 14px;
    color: #6b5b7b;
    font-weight: 600;
}

.color-picker input[type="color"] {
    width: 40px;
    height: 32px;
    border: 2px solid #e8d5f5;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

/* ─── ANIMATIONS ──────────────────────────────────── */
@keyframes sheepBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.sheep-bounce {
    animation: sheepBounce 0.6s ease;
}

@keyframes sheepSleep {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-3px) rotate(-1deg); }
}

.sheep-sleeping {
    animation: sheepSleep 3s ease-in-out infinite;
}

/* ─── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 480px) {
    .login-box {
        padding: 32px 24px;
    }

    header {
        padding: 16px;
    }

    .main-layout {
        padding: 0 16px 24px;
        gap: 16px;
    }

    .panel {
        padding: 16px;
    }

    .habit-progress {
        max-width: 110px;
    }

    .progress-dot {
        width: 17px;
        height: 17px;
    }
}
