/* ============================================================
   JOTA URBANIC — CART MODAL
   ============================================================ */

/* ============================================================
   1. ИКОНКА КОРЗИНЫ В NAVBAR
   ============================================================ */
.cart-icon {
    position: relative !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: 50%;
    transition: background 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.cart-icon i {
    font-size: 1.15rem !important;
    line-height: 1 !important;
    color: inherit;
    transition: color 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-icon:hover {
    background: rgba(255, 92, 1, 0.1);
    color: #FF5C01 !important;
}

.cart-icon:hover i {
    color: #FF5C01;
}

/* ============================================================
   2. БЕЙДЖ СЧЁТЧИКА
   ============================================================ */
.cart-count {
    position: absolute !important;
    top: -2px !important;
    right: -2px !important;
    left: auto !important;
    bottom: auto !important;

    width: 20px !important;
    height: 20px !important;
    min-width: 0 !important;
    max-width: 20px !important;
    min-height: 0 !important;
    max-height: 20px !important;
    padding: 0 !important;
    margin: 0 !important;

    background: #FF5C01 !important;
    color: #FFFFFF !important;
    border: 2px solid #FFFFFF !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 6px rgba(255, 92, 1, 0.4);

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    text-align: center !important;

    display: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box !important;
    z-index: 2;
    flex-shrink: 0;
}

.cart-count[style*="display: flex"],
.cart-count[style*="display:flex"] {
    display: flex !important;
}

/* ============================================================
   3. МОДАЛКА
   ============================================================ */
#cartModal .modal-dialog {
    max-width: 780px;
}

#cartModal .modal-content {
    border: none;
    border-radius: 24px;
    overflow: hidden;
    box-shadow:
        0 32px 80px rgba(15, 23, 42, 0.24),
        0 8px 24px rgba(15, 23, 42, 0.12);
    background: #FFFFFF;
}

.modal-backdrop.show {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 1;
}

/* ============================================================
   4. ШАПКА МОДАЛКИ
   ============================================================ */
#cartModal .modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#cartModal .modal-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0F172A;
    display: flex;
    align-items: center;
    gap: 14px;
    line-height: 1.2;
    margin: 0;
}

#cartModal .modal-title i {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #FF5C01 0%, #FF8C42 100%);
    color: #FFFFFF !important;
    font-size: 1rem;
    box-shadow: 0 6px 16px rgba(255, 92, 1, 0.32);
    margin: 0 !important;
    flex-shrink: 0;
}

#cartModal .modal-header .btn-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(15, 23, 42, 0.04);
    background-size: 11px;
    opacity: 0.6;
    transition: all 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0;
    padding: 0;
}

#cartModal .modal-header .btn-close:hover {
    background-color: rgba(255, 92, 1, 0.12);
    opacity: 1;
    transform: rotate(90deg);
}

#cartModal .modal-header .btn-close:focus {
    box-shadow: none;
}

/* ============================================================
   5. ТЕЛО МОДАЛКИ
   ============================================================ */
#cartModal .modal-body {
    padding: 24px 32px;
    background: #FFFFFF;
}

/* ============================================================
   6. СПИСОК ТОВАРОВ
   ============================================================ */
#cartItems {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#cartItems .cart-item {
    background: #F8FAFC;
    border: 1px solid rgba(15, 23, 42, 0.04);
    border-radius: 16px;
    padding: 14px 18px;
    margin: 0;
    transition: all 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: center;
}

#cartItems .cart-item:hover {
    background: #FFFFFF;
    border-color: rgba(255, 92, 1, 0.22);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

#cartItems .cart-item img {
    display: block;
}

/* ============================================================
   7. DESKTOP LAYOUT (≥768px) — flex-строка
   ============================================================ */
@media (min-width: 768px) {
    #cartItems .cart-item {
        display: flex;
        gap: 16px;
    }

    #cartItems .cart-item-image {
        flex-shrink: 0;
        width: 64px;
    }

    #cartItems .cart-item-image img {
        width: 64px;
        height: 64px;
        object-fit: cover;
        border-radius: 12px;
        background: #FFFFFF;
        padding: 4px;
        border: 1px solid rgba(15, 23, 42, 0.05);
    }

    #cartItems .cart-item-info {
        flex: 1 1 auto;
        min-width: 0;
    }

    #cartItems .cart-item-title {
        font-size: 0.95rem;
        font-weight: 700;
        color: #0F172A;
        letter-spacing: -0.01em;
        margin: 0;
        line-height: 1.35;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    #cartItems .cart-item-qty {
        flex-shrink: 0;
    }

    #cartItems .cart-item-remove {
        flex-shrink: 0;
        margin-left: auto;
    }
}

/* ============================================================
   8. СЧЁТЧИК КОЛИЧЕСТВА
   ============================================================ */
#cartItems .cart-item .input-group {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 100px;
    overflow: hidden;
    padding: 3px;
    width: fit-content;
    margin-left: auto;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    flex-wrap: nowrap;
}

#cartItems .cart-item .input-group .btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #64748B;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
    box-shadow: none;
}

#cartItems .cart-item .input-group .btn:hover,
#cartItems .cart-item .input-group .btn:focus {
    background: #FF5C01;
    color: #FFFFFF;
    box-shadow: none;
}

#cartItems .cart-item .input-group .form-control {
    border: none;
    background: transparent;
    padding: 0 !important;
    font-weight: 700;
    font-size: 0.9rem;
    color: #0F172A;
    box-shadow: none !important;
    min-width: 34px;
    height: 30px;
    line-height: 30px;
    text-align: center;
}

#cartItems .cart-item .input-group .form-control:focus {
    outline: none;
    box-shadow: none;
    background: transparent;
}

/* ============================================================
   9. КНОПКА «УДАЛИТЬ»
   ============================================================ */
#cartItems .cart-item .btn-link {
    color: #EF4444 !important;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    padding: 6px 12px !important;
    border-radius: 100px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: -0.005em;
    border: none;
    background: transparent;
    white-space: nowrap;
}

#cartItems .cart-item .btn-link::before {
    content: '\f2ed';
    font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Pro', 'FontAwesome';
    font-weight: 900;
    font-size: 0.72rem;
    line-height: 1;
}

#cartItems .cart-item .btn-link:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #DC2626 !important;
}

/* ============================================================
   10. ПУСТОЕ СОСТОЯНИЕ
   ============================================================ */
#cartItems > .text-center {
    padding: 48px 24px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#cartItems > .text-center i {
    font-size: 1.6rem !important;
    color: #94A3B8 !important;
    margin: 0 0 14px !important;
    background: #F8FAFC;
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.04);
}

#cartItems > .text-center h5 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0F172A;
    letter-spacing: -0.015em;
    margin: 0 0 4px;
    line-height: 1.3;
}

#cartItems > .text-center p {
    font-size: 0.88rem;
    color: #94A3B8;
    margin: 0;
    line-height: 1.5;
}

/* ============================================================
   11. ФОРМА ЗАКАЗА
   ============================================================ */
#cartSummary {
    margin-top: 28px !important;
}

#cartSummary .cart-total {
    padding-top: 20px !important;
    border-top: 1px solid rgba(15, 23, 42, 0.06) !important;
}

#cartSummary h5 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0F172A;
    letter-spacing: -0.015em;
    margin-bottom: 18px !important;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.2;
}

#cartSummary h5 i {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: rgba(255, 92, 1, 0.1);
    color: #FF5C01 !important;
    font-size: 0.82rem;
    margin: 0 !important;
    flex-shrink: 0;
}

#cartSummary .form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
    letter-spacing: -0.005em;
    display: block;
}

#cartSummary .form-control {
    padding: 12px 16px;
    font-size: 0.92rem;
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    background: #FFFFFF;
    color: #0F172A;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    box-shadow: none;
    line-height: 1.4;
    width: 100%;
}

#cartSummary .form-control::placeholder {
    color: #94A3B8;
}

#cartSummary .form-control:hover {
    border-color: #CBD5E1;
}

#cartSummary .form-control:focus {
    border-color: #FF5C01;
    box-shadow: 0 0 0 4px rgba(255, 92, 1, 0.1);
    outline: none;
    background: #FFFFFF;
}

#cartSummary textarea.form-control {
    min-height: 92px;
    resize: vertical;
    line-height: 1.5;
    padding: 14px 16px;
}

#cartSummary small.text-muted {
    font-size: 0.75rem !important;
    color: #94A3B8 !important;
    display: block;
    margin-top: 6px;
    line-height: 1.45;
}

/* ============================================================
   12. ФУТЕР МОДАЛКИ
   ============================================================ */
#cartModal .modal-footer {
    padding: 18px 32px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    background: #FAFBFD;
    gap: 12px;
    flex-wrap: nowrap;
}

#cartModal .modal-footer .btn {
    padding: 12px 26px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 100px;
    letter-spacing: -0.005em;
    transition: all 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1.5px solid transparent;
    min-height: 46px;
    line-height: 1;
    white-space: nowrap;
}

#cartModal .modal-footer .btn i {
    font-size: 0.85rem;
}

#cartModal .modal-footer .btn-outline-secondary {
    background: #FFFFFF;
    border-color: #E2E8F0;
    color: #475569;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

#cartModal .modal-footer .btn-outline-secondary:hover {
    background: #F1F5F9;
    border-color: #CBD5E1;
    color: #0F172A;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

#cartModal .modal-footer .btn-primary {
    background: linear-gradient(135deg, #FF5C01 0%, #FF8C42 100%);
    border: none;
    color: #FFFFFF;
    box-shadow: 0 6px 18px rgba(255, 92, 1, 0.28);
    padding: 12px 32px;
}

#cartModal .modal-footer .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(255, 92, 1, 0.4);
    color: #FFFFFF;
}

#cartModal .modal-footer .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(255, 92, 1, 0.28);
}

#cartModal .modal-footer .btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   13. СКРОЛЛБАР
   ============================================================ */
#cartModal .modal-dialog-scrollable .modal-body {
    overflow-y: auto;
}

#cartModal .modal-body::-webkit-scrollbar {
    width: 6px;
}

#cartModal .modal-body::-webkit-scrollbar-track {
    background: transparent;
}

#cartModal .modal-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 10px;
}

#cartModal .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* ============================================================
   14. МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================================ */
@media (max-width: 767.98px) {
    .cart-icon {
        width: 40px !important;
        height: 40px !important;
    }

    .cart-count {
        width: 18px !important;
        height: 18px !important;
        max-width: 18px !important;
        max-height: 18px !important;
        font-size: 0.62rem !important;
        top: -1px !important;
        right: -1px !important;
    }

    #cartModal .modal-dialog {
        margin: 8px;
        max-width: calc(100% - 16px);
        height: calc(100vh - 16px);
    }

    #cartModal .modal-content {
        border-radius: 18px;
        max-height: calc(100vh - 16px);
        display: flex;
        flex-direction: column;
    }

    #cartModal .modal-header {
        padding: 16px 18px;
    }

    #cartModal .modal-title {
        font-size: 1.05rem;
        gap: 10px;
    }

    #cartModal .modal-title i {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
        border-radius: 10px;
    }

    #cartModal .modal-header .btn-close {
        width: 32px;
        height: 32px;
        background-size: 10px;
    }

    #cartModal .modal-body {
        padding: 16px 16px 12px;
        flex: 1 1 auto;
        overflow-y: auto;
    }

    /* ---- Карточка товара: grid ---- */
    #cartItems {
        gap: 10px;
    }

    #cartItems .cart-item {
        display: grid !important;
        grid-template-columns: 56px 1fr auto;
        grid-template-areas:
            "image name   remove"
            "image qty    qty";
        gap: 8px 12px;
        padding: 12px !important;
        margin: 0 !important;
        border-radius: 14px;
        align-items: center;
        width: 100%;
        box-sizing: border-box;
    }

    #cartItems .cart-item-image {
        grid-area: image;
        width: 56px;
        padding: 0;
        margin: 0;
    }

    #cartItems .cart-item-image img {
        width: 56px !important;
        height: 56px !important;
        border-radius: 10px;
        object-fit: cover;
    }

    #cartItems .cart-item-info {
        grid-area: name;
        padding: 0;
        margin: 0;
        min-width: 0;
        align-self: center;
    }

    #cartItems .cart-item-title {
        font-size: 0.85rem;
        margin: 0;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.3;
        font-weight: 700;
        color: #0F172A;
    }

    #cartItems .cart-item-qty {
        grid-area: qty;
        padding: 0;
        margin: 0;
        display: flex;
        justify-content: flex-start;
        align-self: center;
    }

    #cartItems .cart-item-qty .input-group {
        margin: 0 !important;
        padding: 2px;
        border-radius: 100px;
    }

    #cartItems .cart-item-qty .input-group .btn {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }

    #cartItems .cart-item-qty .input-group .form-control {
        min-width: 26px;
        width: 30px;
        height: 26px;
        line-height: 26px;
        font-size: 0.82rem;
    }

    #cartItems .cart-item-remove {
        grid-area: remove;
        padding: 0;
        margin: 0;
        align-self: start;
        justify-self: end;
        text-align: right;
        width: auto;
    }

    #cartItems .cart-item .btn-link {
        font-size: 0.72rem !important;
        padding: 4px 8px !important;
        width: auto !important;
        height: auto !important;
        border-radius: 100px;
        background: rgba(239, 68, 68, 0.06);
        white-space: nowrap;
    }

    #cartItems .cart-item .btn-link::before {
        font-size: 0.65rem;
        margin-right: 3px;
    }

    /* ---- Форма ---- */
    #cartSummary {
        margin-top: 18px !important;
    }

    #cartSummary h5 {
        font-size: 0.95rem;
        padding-bottom: 10px;
        margin-bottom: 14px !important;
        gap: 8px;
    }

    #cartSummary h5 i {
        width: 26px;
        height: 26px;
        font-size: 0.72rem;
        border-radius: 8px;
    }

    #cartSummary .form-label {
        font-size: 0.78rem;
        margin-bottom: 5px;
    }

    #cartSummary .form-control {
        padding: 11px 14px;
        font-size: 0.88rem;
        border-radius: 10px;
    }

    #cartSummary textarea.form-control {
        min-height: 76px;
    }

    #cartSummary .row {
        margin-left: -6px;
        margin-right: -6px;
    }

    #cartSummary .row > [class*="col-"] {
        padding-left: 6px;
        padding-right: 6px;
    }

    /* ---- Футер ---- */
    #cartModal .modal-footer {
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        flex-direction: column-reverse;
        gap: 8px;
        flex-wrap: nowrap !important;
        border-top: 1px solid rgba(15, 23, 42, 0.06);
    }

    #cartModal .modal-footer .btn {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 12px 20px !important;
        font-size: 0.9rem !important;
        min-height: 48px;
        display: inline-flex !important;
        justify-content: center !important;
        margin: 0 !important;
        flex: 0 0 auto;
    }

    #cartModal .modal-footer .btn i {
        font-size: 0.85rem;
    }
}

@media (max-width: 400px) {
    #cartItems .cart-item {
        grid-template-columns: 48px 1fr auto;
        grid-template-areas:
            "image name   remove"
            "image qty    qty";
        padding: 10px !important;
        gap: 6px 10px;
    }

    #cartItems .cart-item-image {
        width: 48px;
    }

    #cartItems .cart-item-image img {
        width: 48px !important;
        height: 48px !important;
    }

    #cartItems .cart-item-title {
        font-size: 0.8rem;
    }

    #cartItems .cart-item-qty .input-group .btn {
        width: 24px;
        height: 24px;
    }

    #cartItems .cart-item-qty .input-group .form-control {
        width: 26px;
        min-width: 26px;
        height: 24px;
        line-height: 24px;
        font-size: 0.78rem;
    }

    #cartItems .cart-item .btn-link {
        font-size: 0.68rem !important;
        padding: 3px 6px !important;
    }

    #cartModal .modal-body {
        padding: 14px 12px 10px;
    }

    #cartModal .modal-header {
        padding: 14px;
    }

    #cartModal .modal-footer {
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    }
}