/* =========================================================
   Modern New Year Theme (City Hall DB + Public + Login)
   v4: Сгребание лежащего снега + 10% снеговик
   ========================================================= */

html.ny-theme nav.navbar {
    position: relative;
    overflow: visible !important;
}

/* 1. Мягкая микро-боке гирлянда по верхнему краю навбара */
html.ny-theme nav.navbar::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 12px;
    pointer-events: none;
    z-index: 1020;
    background-repeat: repeat-x;
    background-position: top left;
    background-size: 180px 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='12' viewBox='0 0 180 12'%3E%3Ccircle cx='20' cy='4' r='4.5' fill='%23fde68a' fill-opacity='0.35'/%3E%3Ccircle cx='20' cy='4' r='1.7' fill='%23fef3c7'/%3E%3Ccircle cx='65' cy='6' r='4.5' fill='%23bae6fd' fill-opacity='0.35'/%3E%3Ccircle cx='65' cy='6' r='1.7' fill='%23e0f2fe'/%3E%3Ccircle cx='110' cy='4' r='4.5' fill='%23ffffff' fill-opacity='0.35'/%3E%3Ccircle cx='110' cy='4' r='1.7' fill='%23ffffff'/%3E%3Ccircle cx='155' cy='6' r='4.5' fill='%23fbcfe8' fill-opacity='0.32'/%3E%3Ccircle cx='155' cy='6' r='1.7' fill='%23fce7f3'/%3E%3C/svg%3E");
    animation: nyBokehPulse 4.5s ease-in-out infinite;
}

/* 2. Контрастная двухслойная снежная шапка + сосульки под навбаром */
html.ny-theme nav.navbar::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 38px;
    pointer-events: none;
    z-index: 1020;
    background-repeat: repeat-x;
    background-position: top left;
    background-size: 240px 38px;
    filter: drop-shadow(0 3px 5px rgba(20, 65, 120, 0.22));
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='38' viewBox='0 0 240 38'%3E%3Cdefs%3E%3ClinearGradient id='snow' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23ffffff'/%3E%3Cstop offset='55%25' stop-color='%23eff8ff'/%3E%3Cstop offset='100%25' stop-color='%23cbe7ff'/%3E%3C/linearGradient%3E%3ClinearGradient id='ice' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23ffffff' stop-opacity='0.95'/%3E%3Cstop offset='55%25' stop-color='%2393c5fd' stop-opacity='0.82'/%3E%3Cstop offset='100%25' stop-color='%2360a5fa' stop-opacity='0.62'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M24,9 Q26,20 27.2,26 Q28,27.5 28.8,26 Q30,20 32,9 Z' fill='url(%23ice)' stroke='%2360a5fa' stroke-width='0.55' stroke-opacity='0.7'/%3E%3Cpath d='M26.8,11 L27.6,23' stroke='%23ffffff' stroke-width='0.9' stroke-linecap='round' stroke-opacity='0.85'/%3E%3Cpath d='M73,11 Q74.5,18 75.3,22.5 Q76,23.5 76.7,22.5 Q77.5,18 79,11 Z' fill='url(%23ice)' stroke='%2360a5fa' stroke-width='0.55' stroke-opacity='0.7'/%3E%3Cpath d='M123,7 Q125.5,23 127,33.5 Q128,35.5 129,33.5 Q130.5,23 133,7 Z' fill='url(%23ice)' stroke='%2360a5fa' stroke-width='0.55' stroke-opacity='0.7'/%3E%3Cpath d='M126.4,9 L127.4,29.5' stroke='%23ffffff' stroke-width='1' stroke-linecap='round' stroke-opacity='0.85'/%3E%3Cpath d='M182,11 Q184,19 185.3,25 Q186,26.2 186.7,25 Q188,19 190,11 Z' fill='url(%23ice)' stroke='%2360a5fa' stroke-width='0.55' stroke-opacity='0.7'/%3E%3Cpath d='M184.8,12.5 L185.5,22' stroke='%23ffffff' stroke-width='0.8' stroke-linecap='round' stroke-opacity='0.8'/%3E%3Cpath d='M219,7 Q220.2,13 221,16.5 Q221.5,17.3 222,16.5 Q222.8,13 224,7 Z' fill='url(%23ice)' stroke='%2360a5fa' stroke-width='0.55' stroke-opacity='0.65'/%3E%3Cpath d='M0,0 L240,0 L240,9 C220,9 205,15 182,13 C158,11 142,6 118,9 C95,12 78,16 52,13 C28,10 15,9 0,9 Z' fill='%23bae6fd' fill-opacity='0.75'/%3E%3Cpath d='M0,0 L240,0 L240,7 C218,7 202,13 176,11 C152,9 138,4 114,7 C90,10 72,14 48,11 C25,8 14,7 0,7 Z' fill='url(%23snow)' stroke='%237dd3fc' stroke-width='0.8'/%3E%3C/svg%3E");
}

/* 3. Векторный колпак поверх иконки в бренде */
html.ny-theme .navbar-brand {
    position: relative;
}

html.ny-theme .navbar-brand::after {
    content: "";
    position: absolute;
    top: -4px;
    left: -7px;
    width: 21px;
    height: 18px;
    pointer-events: none;
    background-repeat: no-repeat;
    background-size: contain;
    transform: rotate(-16deg);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 28'%3E%3Cpath d='M6,20 C7,10 15,4 25,6 C22,9 22,14 25,20 Z' fill='%23ef4444'/%3E%3Cpath d='M16,6 C19,5 22,5.5 25,6 C22,9 22,14 25,20 L20,20 C19,14 18,9 16,6 Z' fill='%23dc2626'/%3E%3Ccircle cx='27' cy='7.5' r='3.5' fill='%23ffffff' stroke='%23cbd5e1' stroke-width='0.6'/%3E%3Crect x='3.5' y='18.5' width='23.5' height='5.5' rx='2.75' fill='%23ffffff' stroke='%23cbd5e1' stroke-width='0.6'/%3E%3C/svg%3E");
}

/* 4. Пышные сугробы над футером (можно сгребать мышкой!) */
html.ny-theme footer {
    position: relative;
}

html.ny-theme footer::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 20px;
    pointer-events: auto;
    cursor: grab;
    z-index: 1;
    background-repeat: repeat-x;
    background-position: bottom left;
    background-size: 240px 20px;
    filter: drop-shadow(0 -2px 4px rgba(20, 65, 120, 0.16));
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='20' viewBox='0 0 240 20'%3E%3Cdefs%3E%3ClinearGradient id='fSnow' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23ffffff'/%3E%3Cstop offset='60%25' stop-color='%23eef7ff'/%3E%3Cstop offset='100%25' stop-color='%23cbe7ff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0,20 L0,10 C25,10 42,3 70,5 C98,7 115,13 145,8 C175,3 198,6 218,9 C228,10.5 234,10 240,10 L240,20 Z' fill='%23d2ebff' stroke='%237dd3fc' stroke-width='0.7'/%3E%3Cpath d='M0,20 L0,12 C20,12 32,7 55,9 C80,11 95,15 125,10 C155,5 178,12 204,11 C222,10 230,12 240,12 L240,20 Z' fill='url(%23fSnow)' stroke='%2393c5fd' stroke-width='0.75'/%3E%3C/svg%3E");
}

/* 5. Рандомизированные сугробы на плитках (сгребаются через --ny-snow) */
html.ny-theme main .row > :is(.col-sm-6, .col-md-3, .col-md-4, .col-md-6, .col-lg-3, .col-lg-4, .col-lg-6, .col-xl-3, .col-xl-4) > .card {
    position: relative;
}

html.ny-theme main .row > :is(.col-sm-6, .col-md-3, .col-md-4, .col-md-6, .col-lg-3, .col-lg-4, .col-lg-6, .col-xl-3, .col-xl-4) > .card::before {
    content: "";
    position: absolute;
    top: -11px;
    left: 6px;
    right: 6px;
    height: 21px;
    pointer-events: auto;
    cursor: grab;
    z-index: 2;
    transform-origin: center 55%;
    transform: scaleX(var(--ny-flip, 1)) scaleY(var(--ny-snow, 1));
    opacity: var(--ny-snow-op, 1);
    transition: transform 0.28s ease, opacity 0.28s ease;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    filter: drop-shadow(0 2px 3px rgba(20, 65, 120, 0.22));
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 22' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='cSnow1' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23ffffff'/%3E%3Cstop offset='55%25' stop-color='%23f0f9ff'/%3E%3Cstop offset='100%25' stop-color='%23cde8ff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M4,11 C22,5 54,4 96,7 C138,10 174,3 220,4 C264,5 298,4 316,11 C292,14 246,12 196,12 C144,12 94,14 44,12 C20,11 10,12 4,11 Z' fill='%23bae6fd'/%3E%3Cpath d='M239,12 Q241,19 242,20.5 Q243,19 245,12 Z' fill='%23bae6fd' stroke='%2360a5fa' stroke-width='0.5'/%3E%3Cpath d='M0,11 C16,5 48,3 88,7 C130,11 168,3 214,5 C258,7 294,4 320,11 C304,15 280,16 250,13 C220,10 190,17 154,13 C118,9 84,15 50,12 C24,10 10,13 0,11 Z' fill='url(%23cSnow1)' stroke='%237dd3fc' stroke-width='0.75'/%3E%3C/svg%3E");
}

html.ny-theme main .row > :is(.col-sm-6, .col-md-3, .col-md-4, .col-md-6, .col-lg-3, .col-lg-4, .col-lg-6, .col-xl-3, .col-xl-4) > .card[data-snow-empty="1"]::before {
    pointer-events: none;
}

html.ny-theme main .row > :is(.col-sm-6, .col-md-3, .col-md-4, .col-md-6, .col-lg-3, .col-lg-4, .col-lg-6, .col-xl-3, .col-xl-4):nth-child(3n+2) > .card::before {
    top: -12px;
    height: 22px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 22' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='cSnow2' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23ffffff'/%3E%3Cstop offset='55%25' stop-color='%23f0f9ff'/%3E%3Cstop offset='100%25' stop-color='%23cde8ff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M4,11 C26,3 64,2 104,6 C144,10 178,8 214,4 C252,1 290,4 316,11 Z' fill='%23bae6fd'/%3E%3Cpath d='M89,12 Q91,18.5 92,20 Q93,18.5 95,12 Z' fill='%23bae6fd' stroke='%2360a5fa' stroke-width='0.5'/%3E%3Cpath d='M0,11 C20,4 58,2 98,6 C138,10 174,8 210,4 C248,1 290,4 320,11 C304,14 276,16 246,13 C214,10 184,15 148,13 C114,11 82,16 48,13 C22,11 8,13 0,11 Z' fill='url(%23cSnow2)' stroke='%237dd3fc' stroke-width='0.75'/%3E%3C/svg%3E");
}

html.ny-theme main .row > :is(.col-sm-6, .col-md-3, .col-md-4, .col-md-6, .col-lg-3, .col-lg-4, .col-lg-6, .col-xl-3, .col-xl-4):nth-child(3n+3) > .card::before {
    top: -10px;
    height: 19px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 22' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='cSnow3' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23ffffff'/%3E%3Cstop offset='55%25' stop-color='%23f0f9ff'/%3E%3Cstop offset='100%25' stop-color='%23cde8ff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M4,11 C36,6 82,2 160,2 C238,2 284,6 316,11 Z' fill='%23bae6fd'/%3E%3Cpath d='M182,12 Q183.5,16.5 184.5,17.5 Q185.5,16.5 187,12 Z' fill='%23bae6fd' stroke='%2360a5fa' stroke-width='0.5'/%3E%3Cpath d='M0,11 C32,7 78,2 158,3 C238,4 286,7 320,11 C302,14 270,15 236,12 C204,9 172,16 138,13 C102,10 66,15 34,12 C16,10.5 6,12 0,11 Z' fill='url(%23cSnow3)' stroke='%237dd3fc' stroke-width='0.75'/%3E%3C/svg%3E");
}

html.ny-theme main .row > :is(.col-sm-6, .col-md-3, .col-md-4, .col-md-6, .col-lg-3, .col-lg-4, .col-lg-6, .col-xl-3, .col-xl-4):nth-child(2n) > .card {
    --ny-flip: -1;
}

/* 6. Карточка авторизации (login.php) */
html.ny-theme .login-form {
    position: relative;
}

html.ny-theme .login-form::before {
    content: "";
    position: absolute;
    top: -10px;
    left: -1px;
    right: -1px;
    height: 24px;
    pointer-events: none;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    filter: drop-shadow(0 2px 4px rgba(20, 65, 120, 0.2));
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 24' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='lSnow' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23ffffff'/%3E%3Cstop offset='100%25' stop-color='%23cbe7ff'/%3E%3C/linearGradient%3E%3ClinearGradient id='lIce' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23ffffff' stop-opacity='0.95'/%3E%3Cstop offset='100%25' stop-color='%2360a5fa' stop-opacity='0.7'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M34,10 Q36,18 37,22 Q37.5,23 38,22 Q39,18 41,10 Z' fill='url(%23lIce)' stroke='%2360a5fa' stroke-width='0.5'/%3E%3Cpath d='M160,9 Q162,19 163.2,23 Q164,24 164.8,23 Q166,19 168,9 Z' fill='url(%23lIce)' stroke='%2360a5fa' stroke-width='0.5'/%3E%3Cpath d='M256,10 Q257.5,16 258.5,19.5 Q259,20.3 259.5,19.5 Q260.5,16 262,10 Z' fill='url(%23lIce)' stroke='%2360a5fa' stroke-width='0.5'/%3E%3Cpath d='M0,11 Q2,2 14,2 C55,1 85,5 130,3 C175,1 225,5 286,2 Q298,2 300,11 C280,9 260,13 235,10 C205,7 175,12 145,10 C110,8 75,13 40,10 C20,8 8,12 0,11 Z' fill='url(%23lSnow)' stroke='%237dd3fc' stroke-width='0.75'/%3E%3C/svg%3E");
}

/* 7. Курсор-снежок + Снеговик */
#nySnowballCursor {
    position: fixed;
    top: 0;
    left: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    background: radial-gradient(circle at 32% 30%, #ffffff 0%, #e0f2fe 65%, #93c5fd 100%);
    box-shadow: 0 3px 10px rgba(30, 80, 140, 0.35), inset -2px -2px 4px rgba(147, 197, 253, 0.7);
    display: none;
    will-change: transform;
}

html.ny-theme.ny-has-snowball,
html.ny-theme.ny-has-snowball * {
    cursor: crosshair !important;
}

#nySnowman {
    position: fixed;
    width: 64px;
    height: 82px;
    z-index: 1025;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transform-origin: center bottom;
    filter: drop-shadow(0 3px 6px rgba(15, 50, 95, 0.24));
    animation: nySnowmanPop 0.55s cubic-bezier(0.22, 1.3, 0.36, 1) forwards;
    display: none;
}

html.ny-theme #nySnowman {
    display: block;
}

#nySnowman.ny-wobble {
    animation: nySnowmanWobble 0.55s ease;
}

@keyframes nyBokehPulse {
    0%, 100% { opacity: 0.6; }
    50%      { opacity: 1; }
}

@keyframes nySnowmanPop {
    from { transform: translateY(36px) scale(0.7); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes nySnowmanWobble {
    0%   { transform: rotate(0deg) scale(1); }
    20%  { transform: rotate(-12deg) scale(1.06, 0.94); }
    45%  { transform: rotate(10deg) scale(0.96, 1.05); }
    70%  { transform: rotate(-6deg) scale(1.02, 0.98); }
    100% { transform: rotate(0deg) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    html.ny-theme nav.navbar::before {
        animation: none;
        opacity: 0.85;
    }
}