/* Página de produtos */
.products-page {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 1.25rem;
    align-items: start;
}

.products-page > h2,
.products-page > p,
.products-page > script {
    grid-column: 1 / -1;
}

.product-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
    min-width: 0;
    padding: 1rem;
    border: 1px solid #d8dee8;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 3px 12px rgb(25 42 70 / 7%);
    
}

.product-card h2,
.product-card p {
    margin: 0;
}

.product-small-text {
    font-size: 0.9rem;
    color: #667085;
}

.product-image {
    display: block;
    width: 110px;
    height: 110px;
    object-fit: contain;
    border-radius: 0.5rem;
    background: #f4f6f9;
}

.product-image-placeholder {
    display: grid;
    place-items: center;
    flex: 0 0 110px;
    color: #667085;
    font-size: 0.9rem;
}

.product-modal-backdrop[hidden] {
    display: none;
}

.product-modal-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    overflow-y: auto;
    padding: 1rem;
    background: rgb(16 24 40 / 58%);
}

.product-modal {
    position: relative;
    width: min(100%, 680px);
    max-height: min(90vh, 850px);
    overflow-y: auto;
    padding: 1.5rem;
    border-radius: 0.85rem;
    background: #fff;
    box-shadow: 0 18px 60px rgb(0 0 0 / 25%);
}

.product-modal h2 {
    margin: 0 2rem 1.25rem 0;
}

.product-modal-close {
    position: absolute;
    top: 0.65rem;
    right: 0.9rem;
    border: 0;
    background: transparent;
    color: #344054;
    font-size: 2rem;
    cursor: pointer;
}

.purchase-plan-preview {
    margin: 1rem 0;
}

.purchase-plan-preview > p,
.installment-total-line {
    font-weight: 600;
}

.installment-table-scroll {
    max-width: 100%;
    overflow-x: auto;
}

.installment-table {
    width: 100%;
    border-collapse: collapse;
}

.installment-table th,
.installment-table td {
    padding: 0.65rem;
    border-bottom: 1px solid #e4e7ec;
    text-align: left;
    white-space: nowrap;
}

.product-modal-open {
    overflow: hidden;
}

@media (max-width: 600px) {
    .product-modal {
        padding: 1.1rem;
    }

    .product-card {
        padding: 0.85rem;
    }
}

/* Cartões de produto: largura fixa no desktop e adaptável no celular. */
.products-page {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 500px));
    justify-content: center;
}

.product-card {
    align-items: stretch;
    width: min(500px, 100%);
    box-sizing: border-box;
}

.product-card h2 {
    text-align: center;
}

.product-card p {
    font-weight: 400;
}

.product-card .product-total {
    font-size: 16px;
    font-weight: 700;
}

.product-image-trigger {
    align-self: center;
    padding: 0;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    cursor: zoom-in;
}

.product-card-actions {
    flex-wrap: wrap;
    width: 100%;
}

.product-card-actions .save-button {
    display: inline-block;
    box-sizing: border-box;
}

.purchase-payment-type,
.purchase-plan-details {
    margin: 0.5rem 0;
}

.purchase-payment-details {
    width: 100%;
    margin-top: 0.5rem;
}

.purchase-payment-details summary {
    padding: 0.6rem 0;
    color: #175cd3;
    font-weight: 600;
    cursor: pointer;
}

.purchase-payment-details .installment-table-scroll {
    margin-top: 0.5rem;
}

.product-image-modal-backdrop[hidden] {
    display: none;
}

.product-image-modal-backdrop {
    position: fixed;
    z-index: 1100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgb(16 24 40 / 82%);
}

.product-image-modal {
    position: relative;
    display: grid;
    place-items: center;
    width: min(100%, 1100px);
    height: min(90vh, 900px);
}

.product-image-modal img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-image-modal-close {
    position: absolute;
    z-index: 1;
    top: 0.25rem;
    right: 0.25rem;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #222;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 600px) {
    .products-page {
        grid-template-columns: minmax(0, 1fr);
    }

    .product-card {
        width: 100%;
    }
}

.product-title-trigger {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.product-title-trigger:hover {
    color: #175cd3;
    text-decoration: underline;
}

.product-card > .alert-error,
.product-card > .alert-success {
    align-self: center;
    text-align: center;
}

.product-detail-modal {
    text-align: center;
}

.product-detail-modal h2 {
    margin: 0 2rem 1rem;
}

.product-detail-modal-image {
    display: block;
    width: min(220px, 70vw);
    height: min(220px, 35vh);
    margin: 0 auto 1rem;
    object-fit: contain;
}

.product-detail-description {
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    white-space: pre-wrap;
}

.product-purchase-details {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #e4e7ec;
    text-align: left;
}

.product-purchase-details h3 {
    margin: 0 0 0.75rem;
    text-align: center;
}

.product-purchase-details dl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
    gap: 0.65rem 1rem;
    margin: 0;
}

.product-purchase-details dl > div {
    min-width: 0;
}

.product-purchase-details dt {
    color: #667085;
    font-size: 0.9rem;
}

.product-purchase-details dd {
    margin: 0.15rem 0 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}
