@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@500;600;700;800&display=swap');

:root {
    --bg-cream: #FFF8F0;
    --bg-card: #FFFFFF;
    --candy-red: #C81D25;
    --candy-red-dark: #9E1118;
    --candy-red-soft: #FFE8EA;
    --pine-green: #1B5E20;
    --pine-green-light: #E8F5E9;
    --gold: #D98A00;
    --gold-light: #FFF4D6;
    --text-dark: #231815;
    --text-muted: #4E3B35;
    --border-candy: #F2D5C4;
    --shadow-soft: 0 8px 24px rgba(139, 38, 29, 0.10);
    --radius-lg: 22px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Nunito', sans-serif;
    font-size: 19px; /* Duży, czytelny font podstawowy dla seniorów */
    line-height: 1.5;
    color: var(--text-dark);
    background-color: var(--bg-cream);
    background-image:
        radial-gradient(#f7d6d0 1.5px, transparent 1.5px),
        radial-gradient(#d7ecd9 1.5px, var(--bg-cream) 1.5px);
    background-size: 44px 44px;
    background-position: 0 0, 22px 22px;
    min-height: 100vh;
    padding-bottom: 105px; /* miejsce na elfa i dolne menu */
    overflow-x: hidden;
}

h1, h2, h3, .brand-title {
    font-family: 'Fredoka', sans-serif;
    margin-top: 0;
    color: var(--candy-red-dark);
    letter-spacing: 0.3px;
}

/* Cukierkowy pasek u góry (laska cukrowa) */
.candy-stripe-bar {
    height: 12px;
    width: 100%;
    background: repeating-linear-gradient(
        -45deg,
        #C81D25,
        #C81D25 14px,
        #FFFFFF 14px,
        #FFFFFF 28px,
        #1B5E20 28px,
        #1B5E20 42px,
        #FFFFFF 42px,
        #FFFFFF 56px
    );
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* Opadający śnieg w tle (pointer-events: none, żeby nie blokował klikania!) */
.snow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -30px;
    color: #ffffff;
    text-shadow: 0 0 6px rgba(200, 29, 37, 0.25);
    user-select: none;
    animation: fall linear infinite;
}

@keyframes fall {
    0% { transform: translateY(-30px) rotate(0deg); }
    100% { transform: translateY(105vh) rotate(360deg); }
}

.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 16px;
    position: relative;
    z-index: 5;
}

/* Nagłówek aplikacji */
.app-header {
    background: var(--bg-card);
    border: 3px solid var(--border-candy);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--candy-red-soft);
    border: 3px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: var(--candy-red-dark);
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-lg {
    width: 120px;
    height: 120px;
    font-size: 56px;
    margin: 0 auto 14px auto;
    border-width: 5px;
    box-shadow: 0 8px 20px rgba(217, 138, 0, 0.3);
}

/* Duża, wyraźna nawigacja zakładek */
.nav-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 14px 10px;
    background: var(--bg-card);
    border: 3px solid var(--border-candy);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 800;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.15s ease, background 0.15s ease;
}

.nav-tab .tab-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.nav-tab:hover {
    transform: translateY(-2px);
    border-color: var(--candy-red);
}

.nav-tab.active {
    background: var(--candy-red);
    color: #FFFFFF;
    border-color: var(--candy-red-dark);
    box-shadow: 0 6px 16px rgba(200, 29, 37, 0.32);
}

.nav-tab.admin-tab.active {
    background: var(--pine-green);
    border-color: #0f3d13;
}

/* Karty treści */
.card {
    background: var(--bg-card);
    border: 3px solid var(--border-candy);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
}

.card-header-festive {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 2px dashed var(--border-candy);
    padding-bottom: 12px;
    margin-bottom: 18px;
}

/* Formularze przyjazne seniorom */
.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    font-weight: 800;
    font-size: 19px;
    margin-bottom: 6px;
    color: var(--text-dark);
}

input[type="text"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 19px;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    color: var(--text-dark);
    background: #FFFDFB;
    border: 3px solid #D8B8A8;
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--candy-red);
    background: #FFFFFF;
}

.checkbox-large {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 19px;
    font-weight: 700;
    padding: 8px 0;
}

.checkbox-large input[type="checkbox"] {
    width: 26px;
    height: 26px;
    accent-color: var(--candy-red);
    cursor: pointer;
}

/* Przyciski */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 22px;
    font-size: 19px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s, box-shadow 0.12s;
    min-height: 54px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(180deg, #E0242D 0%, #B8141C 100%);
    color: #FFFFFF;
    box-shadow: 0 5px 0 #800B11;
}

.btn-green {
    background: linear-gradient(180deg, #257A2B 0%, #17521B 100%);
    color: #FFFFFF;
    box-shadow: 0 5px 0 #0D3310;
}

.btn-gold {
    background: linear-gradient(180deg, #F5A623 0%, #D48400 100%);
    color: #231815;
    box-shadow: 0 5px 0 #995F00;
}

.btn-outline {
    background: #FFF8F0;
    color: var(--text-dark);
    border: 3px solid #D8B8A8;
}

.btn-sm {
    padding: 10px 14px;
    font-size: 17px;
    min-height: 44px;
}

/* Alerty */
.alert {
    padding: 16px 18px;
    border-radius: var(--radius-md);
    font-weight: 700;
    margin-bottom: 18px;
    border: 3px solid;
}

.alert-success {
    background: var(--pine-green-light);
    border-color: var(--pine-green);
    color: #103B14;
}

.alert-error {
    background: var(--candy-red-soft);
    border-color: var(--candy-red);
    color: #7D0C12;
}

.alert-info {
    background: var(--gold-light);
    border-color: var(--gold);
    color: #5C3A00;
}

/* Lista potraw */
.category-block {
    margin-bottom: 24px;
}

.category-title {
    background: var(--pine-green-light);
    color: var(--pine-green);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border-left: 6px solid var(--pine-green);
    font-size: 21px;
    margin-bottom: 12px;
}

.dish-item {
    background: #FFFDFB;
    border: 2px solid var(--border-candy);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dish-item.own-dish {
    border-color: var(--gold);
    background: #FFFDF4;
}

.dish-author {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 700;
    color: var(--pine-green);
    background: var(--pine-green-light);
    padding: 4px 10px;
    border-radius: 20px;
    margin-top: 6px;
}

/* LOTERIA PREZENTOWA I ANIMACJA PUDEŁKA */
.lottery-stage {
    text-align: center;
    padding: 24px 12px;
}

.gift-box-wrapper {
    position: relative;
    width: 190px;
    height: 190px;
    margin: 20px auto 28px auto;
    cursor: pointer;
    user-select: none;
}

.gift-box {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.3s ease;
}

.gift-box:hover {
    transform: scale(1.05);
}

.gift-body {
    position: absolute;
    bottom: 0;
    left: 15px;
    width: 160px;
    height: 130px;
    background: linear-gradient(135deg, #E0242D, #A81018);
    border-radius: 0 0 16px 16px;
    box-shadow: 0 14px 28px rgba(168, 16, 24, 0.35);
}

.gift-body::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 100%;
    background: linear-gradient(90deg, #F7C948, #D98A00);
}

.gift-lid {
    position: absolute;
    top: 25px;
    left: 5px;
    width: 180px;
    height: 42px;
    background: linear-gradient(135deg, #F02E38, #B8141C);
    border-radius: 10px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    z-index: 2;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s;
}

.gift-lid::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 100%;
    background: linear-gradient(90deg, #F7C948, #D98A00);
}

.gift-bow {
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 46px;
    z-index: 3;
    transition: transform 0.6s ease, opacity 0.5s;
}

/* Animacja trzęsienia pudełka podczas losowania */
.gift-shaking {
    animation: giftShake 0.45s infinite ease-in-out;
}

@keyframes giftShake {
    0% { transform: rotate(0deg) scale(1); }
    20% { transform: rotate(-7deg) scale(1.06); }
    40% { transform: rotate(7deg) scale(1.08); }
    60% { transform: rotate(-6deg) scale(1.06); }
    80% { transform: rotate(6deg) scale(1.08); }
    100% { transform: rotate(0deg) scale(1); }
}

/* Otwarcie pudełka */
.gift-opened .gift-lid {
    transform: translateY(-90px) rotate(-25deg);
    opacity: 0;
}

.gift-opened .gift-bow {
    transform: translate(-50%, -110px) rotate(35deg);
    opacity: 0;
}

/* Karta wylosowanej osoby */
.reveal-card {
    background: linear-gradient(180deg, #FFFDF5 0%, #FFF3D1 100%);
    border: 4px solid var(--gold);
    border-radius: var(--radius-lg);
    padding: 26px 20px;
    margin-top: 16px;
    box-shadow: 0 12px 32px rgba(217, 138, 0, 0.25);
    animation: popInCard 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes popInCard {
    0% { opacity: 0; transform: scale(0.4) translateY(40px); }
    70% { opacity: 1; transform: scale(1.04) translateY(-6px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.wishlist-box {
    background: #FFFFFF;
    border: 2px dashed var(--candy-red);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
    text-align: left;
}

/* Pasek postępu loterii */
.progress-bar-bg {
    width: 100%;
    height: 22px;
    background: #EFE2D8;
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0;
    border: 2px solid #D8B8A8;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--pine-green), #389E3F);
    transition: width 0.5s ease;
}

/* SPACERUJĄCY ŚWIĄTECZNY ELF */
#walking-elf {
    position: fixed;
    bottom: 6px;
    left: -140px;
    z-index: 90;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    transition: transform 0.2s;
}

#walking-elf.walking-right {
    animation: elfWalkRight 16s linear forwards;
}

#walking-elf.walking-left {
    animation: elfWalkLeft 16s linear forwards;
}

#walking-elf.walking-left .elf-sprite {
    transform: scaleX(-1);
}

.elf-sprite {
    font-size: 46px;
    line-height: 1;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.25));
    animation: elfBounce 0.5s infinite alternate ease-in-out;
}

.elf-bubble {
    background: #FFFFFF;
    border: 2px solid var(--pine-green);
    color: var(--text-dark);
    font-size: 15px;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    white-space: nowrap;
    margin-bottom: 18px;
}

@keyframes elfBounce {
    from { transform: translateY(0); }
    to { transform: translateY(-7px); }
}

@keyframes elfWalkRight {
    0% { left: -160px; }
    100% { left: 105vw; }
}

@keyframes elfWalkLeft {
    0% { left: 105vw; }
    100% { left: -220px; }
}

/* Konfetti */
.confetti-piece {
    position: fixed;
    width: 12px;
    height: 12px;
    z-index: 999;
    pointer-events: none;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(85vh) rotate(720deg); opacity: 0; }
}

@media (max-width: 600px) {
    .nav-tabs {
        grid-template-columns: repeat(2, 1fr);
    }
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
