body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: #f6f9fc;
    color: #222;
}

body.modal-open {
    overflow: hidden;
}


*,
*::before,
*::after {
    box-sizing: border-box;
}


#componentsContainer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 28px;
    padding: 0 18px;
    max-width: 1400px;
    margin: 28px auto;
}


.component-card {
    width: 23%;
    min-width: 240px;
    height: 380px;
    background: #fff;
    border-radius: 14px;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    align-items: center;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.06);
    transition: 0.2s;
}

.component-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 26px rgba(23, 105, 224, 0.15);
}


.card-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 0 auto;
    text-align: center;
}


.thumb-img {
    display: block;
    margin: 0 auto 8px auto;
    width: 100%;
    max-width: 200px;
    height: 110px;
    object-fit: contain;
    background: #f6fafd;
    border-radius: 6px;
}

.component-card h3 {
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    margin: 10px 0 6px;
    color: #222;
}

.short-desc {
    font-size: 0.95rem;
    color: #505b65;
    text-align: center;
    min-height: 48px;
    margin-bottom: 14px;
}


.card-actions {
    width: 100%;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.component-card button {
    width: 100%;
    min-height: 40px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(23, 105, 224, 0.07);
}

.view-details-btn {
    background: #1769e0;
    color: #fff;
}

.add-cart-btn {
    background: #19946c;
    color: #fff;
}


#detailsModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2000;
}

#detailsModal .modal-content {
    background: #fff;
    border-radius: 14px;
    width: 95%;
    max-width: 460px;
    padding: 28px 24px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    position: relative;
    animation: slideUp 0.3s ease;
}

#modalImage {
    display: block;
    margin: 0 auto 12px auto;
    width: 100%;
    max-height: 180px;
    object-fit: contain;
}

#modalName {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 6px 0 2px 0;
    color: #1769e0;
}

#modalDesc {
    font-size: 1rem;
    color: #444;
    margin-top: 8px;
}

#modalAddCart,
.modal-add-btn {
    background: linear-gradient(90deg, #19946c 76%, #1769e0 100%);
    color: #fff;
    padding: 12px 0;
    width: 100%;
    border-radius: 8px;
    border: none;
    margin-top: 18px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(23, 105, 224, 0.12);
    transition: background 0.18s;
}

#modalAddCart:hover,
.modal-add-btn:hover {
    background: linear-gradient(90deg, #1769e0 70%, #19946c 100%);
}

#detailsModal .close {
    position: absolute;
    top: 10px;
    right: 18px;
    font-size: 2rem;
    color: #555;
    cursor: pointer;
    background: none;
    border: none;
}


#cartModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2000;
}


#detailsModal.active,
#cartModal.active {
    display: flex;
}

#cartModal .modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 780px;
    width: 95%;
    padding: 30px 26px;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


#cartModal .close {
    position: absolute;
    top: 18px;
    right: 20px;
    font-size: 2rem;
    color: #555;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 10;
}


#cartTitle {
    margin: 4px 0 12px 0;
    color: #1967d2;
    font-size: 1.5rem;
    text-align: center;
}


#itemsTableModal {
    width: 100%;
    border-spacing: 0 8px;

    border-collapse: separate;
    margin-top: 10px;
}

#itemsTableModal thead th {
    border-bottom: 2px solid #dde1e7;
    padding: 10px 12px;
    color: #555;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

#itemsTableModal tbody tr td {
    background: #fdfdfd;
    border-top: 1px solid #eaeff5;
    border-bottom: 1px solid #eaeff5;
    padding: 12px;
    font-size: 0.95rem;
    color: #333;
    vertical-align: middle;
}

#itemsTableModal tbody tr td:first-child {
    border-left: 1px solid #eaeff5;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    font-weight: 500;
}

#itemsTableModal tbody tr td:last-child {
    border-right: 1px solid #eaeff5;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}


.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #e0e6ed;
    background: #fff;
    color: #333;
    cursor: pointer;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 5px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.qty-btn:hover {
    background: #1769e0;
    color: #fff;
    border-color: #1769e0;
}

.qty-btn[data-action="del"] {
    color: #e74c3c;
    border-color: #fadbd8;
    background: #fff;
    margin-left: 10px;
}

.qty-btn[data-action="del"]:hover {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}


.total-qty-box {
    margin-top: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: right;
    padding-right: 8px;
    color: #333;
}

#totalQtyDisplay {
    font-weight: 800;
    color: #1769e0;
}


#previewBtnModal {
    background: linear-gradient(135deg, #1769e0 0%, #0f4cabc9 100%);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(23, 105, 224, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

#previewBtnModal:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23, 105, 224, 0.4);
}



.cart-success-view {
    display: none;

    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    animation: fadeIn 0.4s ease;
}

.cart-success-view i {
    font-size: 4rem;
    color: #27ae60;
    margin-bottom: 20px;
    animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cart-success-view h3 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 12px;
    font-weight: 700;
}

.cart-success-view p {
    color: #7f8c8d;
    font-size: 1.05rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

.cart-success-view button {
    background: #1769e0;
    color: #fff;
    padding: 10px 28px;
    border-radius: 50px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(23, 105, 224, 0.25);
    transition: 0.2s;
}

.cart-success-view button:hover {
    background: #155bb5;
    transform: translateY(-2px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}





@media (max-width: 1200px) {
    .component-card {
        width: 30%;
    }
}


@media (max-width: 1024px) {
    #componentsContainer {
        gap: 22px;
        margin: 24px auto;
    }

    .component-card {
        width: 30%;
        height: 360px;
    }
}


@media (max-width: 900px) {
    .component-card {
        width: 46%;
        height: 350px;
    }

    .component-card h3 {
        font-size: 1rem;
    }

    #componentsContainer {
        padding: 0 14px;
        gap: 18px;
    }

    #cartModal .modal-content {
        max-width: 95%;
        padding: 22px 18px;
    }

    #itemsTableModal th,
    #itemsTableModal td {
        padding: 6px;
        font-size: 0.9rem;
    }
}


@media (max-width: 600px) {
    #componentsContainer {
        width: 100%;
        padding: 0 10px;
        margin: 20px auto;
    }

    .component-card {
        width: 98%;
        height: auto;
        padding: 14px 10px;
        min-height: 280px;
    }

    .thumb-img {
        max-width: 160px;
        height: 80px;
    }

    #cartModal .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        padding: 18px 14px 20px 14px;
    }

    #itemsTableModal {
        font-size: 0.85rem;
    }

    #itemsTableModal th,
    #itemsTableModal td {
        padding: 8px 6px;
    }

    #previewBtnModal {
        width: 100%;
    }
}