/* ==========================================================================
   Базовые настройки сайта
   ========================================================================== */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: inherit;
}

body { 
    background: #ffffff; 
    color: #4a4a4a; 
    position: relative; 
    overflow-x: hidden; 
}

/* ==========================================================================
   Цветочная рамка (Гирлянды роз)
   ========================================================================== */
body::before {
    content: ""; 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 180px;
    background: url("images/flowers-top.png") center top / contain no-repeat; 
    z-index: 10; 
    pointer-events: none;
}

body::after {
    content: ""; 
    position: absolute; 
    left: 0; 
    top: 0; 
    width: 120px; 
    height: 100%;
    background: url("images/flowers-side.png") left top / 100% auto repeat-y; 
    z-index: 1; 
    pointer-events: none;
}

.flowers-frame-right {
    position: absolute; 
    right: 0; 
    top: 0; 
    width: 120px; 
    height: 100%;
    background: url("images/flowers-side.png") left top / 100% auto repeat-y; 
    transform: scaleX(-1); 
    z-index: 1; 
    pointer-events: none;
}

/* ==========================================================================
   Шапка сайта (Bootstrap Navbar Customization)
   ========================================================================== */
.navbar {
    z-index: 1030; /* Делаем меню выше гирлянд роз */
    background-color: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(5px);
}

.navbar-brand {
    font-family: 'Georgia', cursive, serif;
    color: #e96e91 !important;
}

.navbar-nav .nav-link {
    color: #666666 !important;
    font-size: 15px;
    font-weight: 500;
    margin-left: 10px;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: #e96e91 !important;
}

/* Сброс глобального стиля кнопок для гамбургера Bootstrap */
.navbar-toggler {
    background: transparent !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
    padding: 4px 8px !important;
    box-shadow: none !important;
    border-radius: 6px !important;
}

.navbar-toggler:hover {
    transform: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* ==========================================================================
   Главный экран (Hero)
   ========================================================================== */
.hero { 
    text-align: center; 
    padding: 60px 40px 40px 40px; 
    background: transparent; 
}

.hero h2 { 
    font-family: 'Georgia', serif; 
    font-size: 42px; 
    color: #c23b61; 
    font-weight: 400; 
    margin-bottom: 15px; 
}

.hero p { 
    font-size: 16px; 
    color: #7d7d7d; 
    margin-bottom: 35px; 
    font-style: italic; 
}

/* ==========================================================================
   Кнопки сайта
   ========================================================================== */
button, 
.hero button, 
.calc-section button, 
#cart button, 
#cart button.pay, 
.auth-content button, 
.product-box button,
.admin-lock-btn {
    background: #f45b7e;
    color: white;
    border: none;
    padding: 12px 50px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    display: inline-block;
    outline: none;
}

button:hover,
.hero button:hover, 
.calc-section button:hover, 
#cart button:hover,
#cart button.pay:hover, 
.auth-content button:hover, 
.product-box button:hover,
.admin-lock-btn:hover {
    background: #ff003a; 
    transform: translateY(-2px); 
    box-shadow: 0 6px 18px rgba(255,0,58,0.4);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(244, 91, 126, 0.3);
}

.cake button { 
    background: #ffffff; 
    color: #f45b7e; 
    border: 1.5px solid #f45b7e; 
    padding: 8px 25px; 
    border-radius: 20px; 
    box-shadow: none; 
}

.cake button:hover { 
    background: #f45b7e; 
    color: white; 
    box-shadow: 0 4px 10px rgba(244, 91, 126, 0.2); 
}

#cartItems button {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 12px;
    margin: 0 2px;
    box-shadow: none;
}

#cartItems button:last-child {
    background: #6c757d;
    box-shadow: none;
}

#cartItems button:last-child:hover {
    background: #5a6268;
}

.close-modal {
    background: transparent !important;
    color: #aaa !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.close-modal:hover {
    color: #333 !important;
    background: transparent !important;
    transform: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   Поиск и Поля форм
   ========================================================================== */
.search-box { 
    display: flex; 
    justify-content: center; 
    padding: 20px 40px; 
    margin-bottom: 30px; 
}

#search { 
    width: 100%; 
    max-width: 750px; 
    padding: 14px 25px; 
    border-radius: 30px; 
    border: 1px solid #e8e8e8; 
    background: #ffffff; 
    font-size: 15px; 
    color: #4a4a4a; 
    outline: none; 
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02); 
    transition: all 0.3s ease; 
}

#search:focus { 
    border-color: #ff003a; 
    box-shadow: 0 4px 15px rgba(244, 91, 126, 0.15); 
}

#notFound { 
    display: none; 
    text-align: center; 
    color: #f45b7e; 
    font-size: 18px; 
    margin: 20px; 
    font-weight: bold; 
}

input, select, textarea {
    width: 100%; 
    padding: 12px 20px; 
    border-radius: 12px; 
    border: 1px solid #e8e8e8;
    margin-bottom: 15px; 
    font-size: 14px; 
    color: #4a4a4a; 
    outline: none; 
    transition: all 0.3s;
}

input:focus, select:focus, textarea:focus {
    border-color: #f45b7e; 
    box-shadow: 0 0 8px rgba(244, 91, 126, 0.15);
}

/* ==========================================================================
   Каталог тортов
   ========================================================================== */
#cakes { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 30px; 
    padding: 40px 50px; 
}

.cake { 
    position: relative;
    z-index: 2; /* Помещаем карточки ВЫШЕ цветочной рамки */
    background: white; 
    border-radius: 15px; 
    overflow: hidden; /* Обрезаем всё, что выходит за границы */
    box-shadow: 0 5px 20px rgba(0,0,0,0.05); 
    text-align: center; 
    padding-bottom: 25px; 
    border: 1px solid #fcfcfc; 
    transition: all 0.3s ease; 
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cake:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 12px 30px rgba(244, 91, 126, 0.15); 
}

.cake img { 
    width: 100%; 
    height: 250px; 
    object-fit: cover; /* Изображение масштабируется без искажения */
    display: block;
    cursor: pointer; 
}

.cake h3 { 
    font-size: 18px; 
    color: #333; 
    margin: 15px 0 8px 0; 
}

.cake p { 
    font-size: 20px; 
    color: #f45b7e; 
    font-weight: 700; 
    margin-bottom: 15px; 
}

.cake.fade-in { 
    opacity: 0; 
    transform: translateY(40px); 
    transition: opacity 0.6s ease-out, transform 0.6s ease-out; 
}

.cake.fade-in.visible { 
    opacity: 1; 
    transform: translateY(0); 
}

/* ==========================================================================
   Страница одного товара
   ========================================================================== */
.product-box { 
    text-align: center; 
    background: white; 
    border-radius: 15px; 
    padding: 30px; 
}

.product-image {
    width: 100%; 
    max-width: 420px; 
    height: auto; 
    max-height: 420px;
    object-fit: cover; 
    border-radius: 12px; 
    margin: 0 auto 20px auto;
    display: block; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.product-box h2 { 
    font-family: 'Georgia', serif; 
    font-size: 32px; 
    color: #333; 
    margin-bottom: 10px; 
}

/* ==========================================================================
   Калькулятор стоимости своего торта
   ========================================================================== */
.calc-section { 
    background: #fff9fa; 
    padding: 30px; 
    border-radius: 15px; 
    margin: 40px auto; 
    max-width: 550px; 
    border: 1px solid #ffe3e8; 
    box-shadow: 0 4px 20px rgba(244, 91, 126, 0.05); 
}

.calc-section h2 { 
    font-family: 'Georgia', serif; 
    color: #c23b61; 
    margin-bottom: 20px; 
    text-align: center; 
}

.calc-group { 
    margin-bottom: 15px; 
    text-align: left; 
}

.calc-group label { 
    display: block; 
    font-weight: 600; 
    margin-bottom: 5px; 
    color: #555; 
}

.calc-result { 
    font-size: 20px; 
    font-weight: 700; 
    color: #c23b61; 
    text-align: center; 
    margin: 20px 0; 
}

/* ==========================================================================
   Корзина покупок
   ========================================================================== */
#cart { 
    max-width: 750px; 
    margin: 40px auto; 
    padding: 30px; 
    background: #fff; 
    border-radius: 15px; 
    box-shadow: 0 5px 25px rgba(0,0,0,0.05); 
}

#cart h2 { 
    font-family: 'Georgia', serif; 
    color: #333; 
    margin-bottom: 20px; 
}

#cart h3 { 
    margin: 20px 0; 
    color: #333; 
}

.cart-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

.promo-box { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 20px; 
}

.promo-box input { 
    margin-bottom: 0; 
}

/* ==========================================================================
   Подвал сайта (Footer)
   ========================================================================== */
footer { 
    text-align: center; 
    padding: 40px 20px; 
    background: #fff; 
    margin-top: 60px; 
    border-top: 1px solid #ffe3e8; 
}

footer p { 
    margin-bottom: 10px; 
    font-size: 15px; 
    color: #666; 
}

.admin-lock-btn { 
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 15px;
    color: #000;
}

.admin-lock-btn:hover { 
    background: #fff;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    margin-top: 15px;
    color: #000;
}

.pay-window {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
}

.pay-card {
    background: white;
    width: 350px;
    padding: 30px;
    border-radius: 25px;
    margin: 150px auto;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.card-number {
    font-size: 25px;
    font-weight: bold;
    letter-spacing: 3px;
    background: #f5f5f5;
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
}

/* ==========================================================================
   Страница «О нас»
   ========================================================================== */
.about-page {
    background: #fffafc;
    color: #4a4a4a;
    padding: 40px 20px;
}

.about-container {
    max-width: 900px;
    margin: 0 auto;
    background: #ffffff;
    padding: 50px;
    border-radius: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,.08);
    border: 1px solid #f4d7df;
}

.about-container h1 {
    text-align: center;
    color: #c23b61;
    font-size: 40px;
    margin-bottom: 30px;
    font-family: Georgia, serif;
}

.about-container p {
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 20px;
    color: #666;
}

.about-container strong a {
    color: #e96e91;
    text-decoration: none;
}

.features {
    margin: 35px 0;
    padding: 25px;
    background: #fff6f8;
    border-radius: 18px;
}

.features p {
    margin: 12px 0;
    font-size: 18px;
}

.footer-text {
    font-style: italic;
    text-align: center;
    color: #777;
}

.home-btn {
    display: inline-block;
    margin-top: 30px;
    padding: 14px 35px;
    background: #ff003a;
    color: white;
    text-decoration: none;
    border-radius: 40px;
    font-weight: 600;
    transition: .3s;
}

.home-btn:hover {
    background: #d90032;
}

/* ==========================================================================
   АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ И ПЛАНШЕТОВ
   ========================================================================== */
@media (max-width: 992px) {
    body::after, .flowers-frame-right {
        width: 80px;
    }
}

@media (max-width: 768px) {
    /* Рамки на телефонах */
    body::after, .flowers-frame-right {
        width: 35px;
        opacity: 0.4;
    }

    /* Мобильное выпадающее меню Bootstrap */
    .navbar-collapse {
        margin-top: 15px;
        padding: 15px;
        border-top: 1px solid #ffe3e8;
        background: #ffffff;
        border-radius: 0 0 12px 12px;
    }

    .navbar-nav .nav-link {
        margin-left: 0;
        padding: 10px 0;
        border-bottom: 1px dashed #f5f5f5;
    }

    /* Каталог и блоки */
    #cakes {
        padding: 20px 40px;
        gap: 20px;
    }

    .search-box {
        padding: 10px 20px;
    }

    .hero h2 {
        font-size: 28px;
    }

    #cart, .calc-section {
        margin: 20px 0x;
        padding: 50px;
    }

    .pay-card {
        width: 90%;
        margin: 100px auto;
        padding: 20px;
    }

    .card-number {
        font-size: 18px;
        letter-spacing: 1px;
    }

    .about-page {
        padding: 20px 10px;
    }

    .about-container {
        padding: 25px 20px;
        border-radius: 18px;
    }

    .about-container h1 {
        font-size: 28px;
        margin-bottom: 20px;
    }

    .about-container p, .features p {
        font-size: 16px;
        line-height: 1.6;
    }

    .features {
        padding: 15px;
        margin: 20px 0;
    }

    .home-btn {
        display: block;
        text-align: center;
        width: 100%;
    }
}

/* ==========================================================================
   Стильные кнопки и карточки корзины (#cartItems)
   ========================================================================== */

/* Контейнер карточки товара в корзине */
.cart-item-card {
    background: #ffffff;
    border: 1px solid #f2f2f2;
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: all 0.25s ease;
}

.cart-item-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    border-color: #ffe3e8;
}

/* Изображение товара в корзине */
.cart-item-img {
    width: 75px;
    height: 75px;
    object-fit: cover;
    border-radius: 12px;
}

/* Название и кнопка сброса/удаления */
.cart-item-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.cart-item-info h5 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: #2b2b2b;
}

/* Кнопка "Удалить" - аккуратная текстовая ссылка */
button.btn-remove-cart,
#cartItems button.btn-remove-cart {
    background: transparent !important;
    color: #dc3545 !important;
    border: none !important;
    padding: 0 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 !important;
    opacity: 0.8;
    transition: opacity 0.2s ease, color 0.2s ease !important;
}

button.btn-remove-cart:hover,
#cartItems button.btn-remove-cart:hover {
    color: #a71d2a !important;
    background: transparent !important;
    transform: none !important;
    box-shadow: none !important;
    opacity: 1;
    text-decoration: underline;
}

/* Блок счетчика и цены */
.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.cart-item-price {
    font-size: 18px;
    font-weight: 700;
    color: #2b2b2b;
    white-space: nowrap;
}

/* Элегантный счетчик (+ / -) */
.qty-counter {
    display: inline-flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    padding: 3px;
}

/* Сброс глобальных стилей для кнопок счетчика */
.qty-counter button,
#cartItems .qty-counter button {
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 30px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    color: #444444 !important;
    border: 1px solid #e0e0e0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
}

.qty-counter button:hover,
#cartItems .qty-counter button:hover {
    background: #f45b7e !important;
    color: #ffffff !important;
    border-color: #f45b7e !important;
    transform: scale(1.08) !important;
    box-shadow: 0 3px 8px rgba(244, 91, 126, 0.3) !important;
}

.qty-counter button:active,
#cartItems .qty-counter button:active {
    transform: scale(0.95) !important;
}

.qty-counter .qty-value {
    width: 32px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #2b2b2b;
    user-select: none;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 576px) {
    .cart-item-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .cart-item-controls {
        width: 100%;
        justify-content: space-between;
    }
}