/* FoodRescue: Дніпро - Волшебная тема: Морская волна ✦ Персик ✦ Фиолетовый */
/* Плавные переходы и магические переливы */

/* Основной фон с глубоким космическим градиентом */
body {
    background: radial-gradient(circle at 20% 20%, #0A1A2F, #1A2F3F, #2A3F4F);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Эффект звездного неба */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 10px 20px, rgba(255, 255, 255, 0.8), rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 30px 70px, rgba(255, 255, 255, 0.6), rgba(0, 0, 0, 0)),
        radial-gradient(3px 3px at 50px 150px, rgba(255, 255, 255, 0.7), rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 90px 40px, rgba(255, 255, 255, 0.8), rgba(0, 0, 0, 0)),
        radial-gradient(3px 3px at 130px 80px, rgba(255, 255, 255, 0.5), rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 180px 120px, rgba(255, 255, 255, 0.9), rgba(0, 0, 0, 0)),
        radial-gradient(4px 4px at 220px 190px, rgba(255, 255, 255, 0.6), rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 270px 50px, rgba(255, 255, 255, 0.7), rgba(0, 0, 0, 0)),
        radial-gradient(3px 3px at 320px 140px, rgba(255, 255, 255, 0.8), rgba(0, 0, 0, 0));
    background-repeat: repeat;
    pointer-events: none;
    z-index: 0;
    animation: starsFloat 50s linear infinite;
    opacity: 0.5;
}

@keyframes starsFloat {
    from { transform: translateY(0); }
    to { transform: translateY(-200px); }
}

/* Улучшение текста с мягким свечением */
h1, h2, h3, h4, h5, h6 {
    text-shadow: 0 2px 10px rgba(42, 169, 160, 0.3), 0 2px 20px rgba(155, 124, 185, 0.2);
    position: relative;
    z-index: 1;
}

h1 {
    background: var(--gradient-magic);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(10deg); }
}

/* Карточки с эффектом магического стекла */
.card, .form-container, .item-card, .role-card {
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    background: linear-gradient(135deg,
        rgba(10, 26, 47, 0.85),
        rgba(26, 47, 63, 0.85),
        rgba(42, 63, 79, 0.85)) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(42, 169, 160, 0.2),
                0 0 20px rgba(155, 124, 185, 0.2);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* Эффект свечения на границах карточек */
.card::before, .item-card::before, .role-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--gradient-magic);
    border-radius: calc(var(--radius-lg) + 2px);
    z-index: -1;
    animation: borderGlow 4s ease infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover::before, .item-card:hover::before, .role-card:hover::before {
    opacity: 0.7;
}

@keyframes borderGlow {
    0%, 100% { filter: blur(5px); opacity: 0.5; }
    50% { filter: blur(10px); opacity: 0.8; }
}

.card::after, .item-card::after, .role-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        rgba(42, 169, 160, 0.1),
        rgba(255, 159, 124, 0.1),
        rgba(155, 124, 185, 0.1),
        transparent);
    transition: left 0.8s ease;
    pointer-events: none;
}

.card:hover::after, .item-card:hover::after, .role-card:hover::after {
    left: 100%;
}

/* Главное меню - волшебный выделенный элемент */
.main-menu-section .card {
    background: linear-gradient(135deg,
        rgba(10, 26, 47, 0.9),
        rgba(26, 47, 63, 0.9)) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6),
                0 0 30px rgba(42, 169, 160, 0.3),
                0 0 30px rgba(255, 159, 124, 0.3),
                0 0 30px rgba(155, 124, 185, 0.3) !important;
    animation: gentleFloat 6s ease-in-out infinite;
}

@keyframes gentleFloat {
    0%, 100% { transform: translateY(0) rotate(0.2deg); }
    50% { transform: translateY(-5px) rotate(-0.2deg); }
}

/* Формы с магическим фокусом */
.form-control, .quantity-input, select, textarea {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(10, 26, 47, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--text-primary) !important;
    transition: all 0.3s ease;
}

.form-control:focus, .quantity-input:focus {
    background: rgba(26, 47, 63, 0.9) !important;
    border-color: transparent !important;
    box-shadow: 0 0 0 2px rgba(42, 169, 160, 0.3),
                0 0 0 4px rgba(255, 159, 124, 0.2),
                0 0 0 6px rgba(155, 124, 185, 0.1),
                0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

/* Навигация с магическим стеклом */
.navbar {
    background: linear-gradient(135deg,
        rgba(10, 26, 47, 0.95),
        rgba(26, 47, 63, 0.95)) !important;
    backdrop-filter: blur(25px) saturate(200%);
    -webkit-backdrop-filter: blur(25px) saturate(200%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.nav-links a {
    background: rgba(10, 26, 47, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-links a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-magic);
    opacity: 0.3;
    transition: left 0.4s ease;
    z-index: -1;
}

.nav-links a:hover::before,
.nav-links a.active::before {
    left: 0;
}

.nav-links a:hover,
.nav-links a.active {
    color: white !important;
    border-color: transparent !important;
    box-shadow: 0 0 20px rgba(42, 169, 160, 0.3),
                0 0 20px rgba(255, 159, 124, 0.3),
                0 0 20px rgba(155, 124, 185, 0.3) !important;
    transform: translateY(-2px);
}

/* Кнопки с волшебными эффектами */
.btn {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transform-style: preserve-3d;
    perspective: 1000px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--gradient-magic);
    border-radius: calc(var(--radius-md) + 2px);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn:hover:not(:disabled)::before {
    opacity: 0.5;
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.btn:hover:not(:disabled) {
    transform: translateY(-3px) rotateX(5deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
}

.btn:active:not(:disabled) {
    transform: translateY(-1px) scale(0.98);
}

/* Primary Button - с градиентом морская волна ✦ персик ✦ фиолетовый */
.btn-primary {
    background: var(--gradient-primary);
    background-size: 200% 200%;
    animation: gradientMove 5s ease infinite;
    color: white;
}

@keyframes gradientMove {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Secondary Button - персиковый */
.btn-secondary {
    background: var(--gradient-peach);
    color: var(--text-primary);
}

/* Purple Button */
.btn-purple {
    background: var(--gradient-purple);
    color: white;
}

/* Таблицы с магическими переливами */
table {
    border: none;
    background: rgba(10, 26, 47, 0.8);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

thead {
    background: var(--gradient-magic);
    background-size: 200% 200%;
    animation: gradientMove 8s ease infinite;
}

th {
    background: transparent !important;
    color: white !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2) !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 600;
}

tbody tr {
    transition: all 0.3s ease;
    position: relative;
}

tbody tr:hover {
    background: linear-gradient(90deg,
        rgba(42, 169, 160, 0.1),
        rgba(255, 159, 124, 0.1),
        rgba(155, 124, 185, 0.1)) !important;
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Карта с магической стилизацией */
.leaflet-popup-content-wrapper {
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    background: rgba(10, 26, 47, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(42, 169, 160, 0.3) !important;
    color: var(--text-primary) !important;
}

.leaflet-control-zoom {
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    background: rgba(10, 26, 47, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

.leaflet-control-zoom a {
    background: transparent !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.leaflet-control-zoom a:hover {
    background: linear-gradient(135deg,
        rgba(42, 169, 160, 0.2),
        rgba(255, 159, 124, 0.2),
        rgba(155, 124, 185, 0.2)) !important;
}

/* Анимации появления с магическим эффектом */
@keyframes fadeInMagic {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
        filter: blur(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.animate-fade-in {
    animation: fadeInMagic 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Специальные эффекты для карточек товаров */
.item-card:hover {
    transform: translateY(-10px) rotate(1deg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(42, 169, 160, 0.3) !important;
}

.item-card:hover .item-image {
    transform: scale(1.05);
    transition: transform 0.5s ease;
}

/* Улучшенный скроллбар с магическим градиентом */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #0A1A2F;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-magic);
    border-radius: 10px;
    border: 2px solid #0A1A2F;
    background-size: 200% 200%;
    animation: gradientMove 5s ease infinite;
}

::-webkit-scrollbar-thumb:hover {
    animation: gradientMove 2s ease infinite;
}

/* Магические пузыри для акцентов */
.magic-bubbles {
    position: relative;
    overflow: hidden;
}

.magic-bubbles::before,
.magic-bubbles::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: var(--gradient-magic);
    filter: blur(20px);
    animation: bubbleFloat 6s ease-in-out infinite;
    z-index: 0;
    opacity: 0.3;
}

.magic-bubbles::before {
    width: 150px;
    height: 150px;
    top: -50px;
    left: -50px;
    animation-delay: 0s;
}

.magic-bubbles::after {
    width: 200px;
    height: 200px;
    bottom: -80px;
    right: -80px;
    animation-delay: 3s;
}

@keyframes bubbleFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: translate(30px, -30px) scale(1.2);
        opacity: 0.5;
    }
}

/* Эффект для активных элементов */
.glow-active {
    position: relative;
}

.glow-active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-magic);
    border-radius: 2px;
    background-size: 200% 200%;
    animation: gradientMove 3s ease infinite;
}

/* Мерцающие звездочки */
@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.2); }
}

.twinkle-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
}

/* Магический неоновый эффект для ховера */
.neon-magic {
    transition: all 0.3s ease;
}

.neon-magic:hover {
    box-shadow: 0 0 15px rgba(42, 169, 160, 0.5),
                0 0 30px rgba(255, 159, 124, 0.3),
                0 0 45px rgba(155, 124, 185, 0.2);
}

/* Анимация для загрузки с магическим градиентом */
@keyframes loadingWave {
    0%, 100% {
        transform: translateY(0) scale(1);
        filter: hue-rotate(0deg);
    }
    50% {
        transform: translateY(-15px) scale(1.1);
        filter: hue-rotate(20deg);
    }
}

.loading-wave {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.loading-wave div {
    width: 6px;
    height: 25px;
    background: var(--gradient-magic);
    border-radius: 3px;
    animation: loadingWave 1.2s ease-in-out infinite;
    background-size: 200% 200%;
}

.loading-wave div:nth-child(2) { animation-delay: 0.1s; }
.loading-wave div:nth-child(3) { animation-delay: 0.2s; }
.loading-wave div:nth-child(4) { animation-delay: 0.3s; }
.loading-wave div:nth-child(5) { animation-delay: 0.4s; }

/* Фиксированное нижнее меню с магическим эффектом */
.bottom-nav {
    background: linear-gradient(135deg,
        rgba(10, 26, 47, 0.95),
        rgba(26, 47, 63, 0.95)) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.bottom-nav-item {
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: white;
    background: linear-gradient(135deg,
        rgba(42, 169, 160, 0.2),
        rgba(255, 159, 124, 0.2),
        rgba(155, 124, 185, 0.2)) !important;
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(42, 169, 160, 0.3);
}

/* Градиентная обводка для премиум элементов */
.gradient-border-magic {
    position: relative;
    border: double 4px transparent;
    background-image: linear-gradient(#0A1A2F, #0A1A2F),
                      var(--gradient-magic);
    background-origin: border-box;
    background-clip: content-box, border-box;
    animation: borderRotate 6s linear infinite;
}

@keyframes borderRotate {
    0% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(20deg); }
    100% { filter: hue-rotate(0deg); }
}

/* Адаптивные улучшения для мобильных устройств */
@media (max-width: 768px) {
    .card, .item-card, .role-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .navbar {
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
    }

    .nav-links a {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    body::before {
        opacity: 0.3;
    }
}