/* Product details page styles extracted from main stylesheet */

/* Hide navbar when scrolling down / interacting with drawers */
.navbar.navbar-hidden {
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.product-page { padding-bottom: 48px; }
.product-grid { display: grid; grid-template-columns: 1fr 420px; gap: 40px; align-items: start; }
.gallery .main-image { background:#f7f6f5; border-radius:12px; overflow:hidden; display:flex; align-items:center; justify-content:center; height:620px; position:relative; }
.gallery .main-image img { width:100%; height:100%; object-fit:cover; display:block; }

/* two-image swap on hover in product page: show packaged image when hovering the main image */
.gallery .main-image img.prod-img-packaged { position: absolute; inset: 0; opacity: 0; transition: opacity 220ms ease; }
.gallery .main-image:hover img.prod-img-packaged { opacity: 1; }
.gallery .main-image:hover img.prod-img-default { opacity: 0; }

/* Modal image hover: support the same packaged-image swap inside the preview modal */
#productPreviewModal .modal-image-wrap img.prod-img-packaged { position: absolute; inset: 0; opacity: 0; transition: opacity 220ms ease; }
#productPreviewModal .modal-image-wrap:hover img.prod-img-packaged { opacity: 1; }
#productPreviewModal .modal-image-wrap:hover img.prod-img-default { opacity: 0; }
#productPreviewModal .modal-image-wrap { position: relative; display: block; width: 100%; }

/* Ensure initial states and transitions are explicit inside modal */
#productPreviewModal .modal-image-wrap img.prod-img-default { opacity: 1; transition: opacity 220ms ease; display: block; width: 100%; height: auto; }
#productPreviewModal .modal-image-wrap img.prod-img-packaged { opacity: 0; transition: opacity 220ms ease; display: block; width: 100%; height: auto; }
.thumbnails { margin-top:12px; display:flex; gap:10px; }
.thumbnails .thumb { border:1px solid transparent; padding:6px; background:#fff; border-radius:8px; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
.thumbnails .thumb img { width:72px; height:72px; object-fit:cover; border-radius:6px; display:block; }
.thumbnails .thumb:focus, .thumbnails .thumb:hover { border-color:#bca98a; box-shadow:0 6px 18px rgba(0,0,0,0.06); }

.details { padding:6px 4px; }
.product-title { font-family:'Playfair Display', serif; font-size:1.8rem; margin:0 0 8px 0; color:#231c17; }
.product-meta { color:#6b6058; margin-bottom:8px; }
.price-row { display:flex; align-items:baseline; gap:12px; margin:12px 0; }
.product-price-large { font-size:1.6rem; font-weight:800; color:#231c17; }
.price-sub { color:#6b6058; font-size:0.92rem; }
.product-description { color:#5a534d; line-height:1.6; }
.product-options { display:flex; gap:18px; align-items:center; margin-top:14px; }
.product-options label { font-weight:600; color:#231c17; }
.qty { display:inline-flex; align-items:center; gap:8px; margin-left:8px; }
.qty button { width:36px; height:36px; border-radius:8px; border:1px solid #e6e6e6; background:#fff; cursor:pointer; font-size:18px; }
.qty input { width:58px; padding:8px; border-radius:8px; border:1px solid #e6e6e6; text-align:center; }
.product-actions { margin-top:16px; display:flex; gap:12px; align-items:center; }
.btn-primary { background:#231c17; color:#f5e8d6; padding:12px 18px; border-radius:8px; border:none; cursor:pointer; font-weight:700; }
.btn-ghost { background:transparent; border:1px solid #231c17; color:#231c17; padding:10px 14px; border-radius:8px; cursor:pointer; }
.cart-notice { position:fixed; right:24px; bottom:24px; background:#231c17; color:#f5e8d6; padding:12px 18px; border-radius:8px; box-shadow:0 10px 30px rgba(0,0,0,0.2); transform:translateY(-8px); opacity:0; transition:all 0.28s ease; z-index:800; }

.details-tabs h3 { margin-top:12px; margin-bottom:6px; color:#231c17; }
.reviews { background:#fff; padding:12px; border-radius:8px; box-shadow:0 6px 18px rgba(0,0,0,0.04); }

.related-products { margin-top:36px; }
.related-products h2 { font-family:'Playfair Display', serif; font-size:1.4rem; margin-bottom:18px; }
.related-products .products-grid { grid-template-columns: repeat(3, 1fr); gap:24px; }

@media (max-width: 980px) {
  .product-grid { grid-template-columns: 1fr; }
  .gallery .main-image { height:300px; }
  .related-products .products-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .thumbnails .thumb img { width:56px; height:56px; }
  .gallery .main-image { height:220px; }
}

/* product image sizing should tie into the global variable if present */
.product-img { height: var(--product-image-height); }

@media (max-width: 900px) {
  .product-img { height: calc(var(--product-image-height) * 0.85); }
}

@media (max-width: 600px) {
  .product-img { height: calc(var(--product-image-height) * 0.7); }
}

/* Checkout Modal Styles */
.checkout-modal {
    position: fixed;
    inset: 0;
    z-index: 1600;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkout-modal .checkout-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 240ms ease;
}

.checkout-modal .checkout-panel {
    position: relative;
    width: 92%;
    max-width: 1100px;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    opacity: 0;
    transition: all 300ms ease;
    display: flex;
    flex-direction: column;
}

.checkout-modal.open {
    pointer-events: auto;
}

.checkout-modal.open .checkout-backdrop {
    opacity: 1;
}

.checkout-modal.open .checkout-panel {
    transform: scale(1);
    opacity: 1;
}

.checkout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 2px solid #eee;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.checkout-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-family: 'Playfair Display', serif;
    color: #333;
}

.checkout-close {
    background: transparent;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.checkout-close:hover {
    color: #000;
}

.checkout-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.cart-summary-checkout {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.cart-summary-checkout h3 {
    margin: 0 0 16px 0;
    font-size: 1.2rem;
    font-family: 'Playfair Display', serif;
    color: #333;
}

.checkout-cart-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

.checkout-cart-item:last-child {
    border-bottom: none;
}

.checkout-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: bold;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid #333;
    color: #000;
}

.checkout-form h3 {
    margin: 24px 0 16px 0;
    font-size: 1.2rem;
    font-family: 'Playfair Display', serif;
    color: #333;
}

.checkout-form h3:first-of-type {
    margin-top: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    flex-direction: column;
}

.form-row.full-width {
    grid-column: 1 / -1;
}

.form-row label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
    font-size: 0.95rem;
}

.form-row input,
.form-row textarea {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-row input:focus,
.form-row textarea:focus {
    outline: none;
    border-color: #000;
}

.form-row textarea {
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.submit-btn {
    flex: 1;
    padding: 14px 24px;
    background: #000;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.submit-btn:hover {
    background: #333;
}

.cancel-btn {
    padding: 14px 24px;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.cancel-btn:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.form-message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .checkout-modal .checkout-panel {
        width: 95%;
        max-height: 95vh;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .checkout-content {
        padding: 16px;
    }
    
    .form-actions {
        flex-direction: column;
    }
}
