
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
}

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

/* Main Content Styles */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    height: auto;
}

/* Mobile: Always column layout */
@media (max-width: 767px) {
    .product-section {
        flex-direction: column !important;
    }
}

/* Tablet & Desktop: Row layout with equal height */
@media (min-width: 768px) {
    .product-section {
        flex-direction: row;
        align-items: stretch; /* Make children stretch to same height */
        gap: 3rem;
        max-height: 85vh; /* Reduced slightly to ensure fit */
        min-height: 600px; /* Minimum height for consistency */
    }
}

/* Laptop screens (992px and above) */
@media (min-width: 992px) {
    .product-section {
        max-height: 80vh; /* Adjusted for better fit on laptop */
        min-height: 650px;
    }
    
    main {
        padding: 3rem 0;
    }
}

/* Product Image */
.product-image-container {
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .product-image-container {
        flex: 1;
        height: 100%; /* Take full height of parent */
         border-radius: 20px;
    }
}

.product-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    aspect-ratio: 1/1;
    border-radius: 20px;
}

@media (min-width: 768px) {
    .product-image {
        aspect-ratio: auto; /* Allow natural aspect ratio */
        max-height: 100%;
        object-fit: contain; /* Show entire image without cropping */
        padding: .5rem; /* Add some padding around image */
         border-radius: 20px;
    }
}

/* Product Info */
.product-info {
    width: 100%;
    background-color: var(--card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .product-info {
        flex: 1;
        height: 100%; /* Take full height of parent */
        overflow-y: auto; /* Allow scrolling if content is too long */
        max-height: 100%;
    }
}

/* For very tall screens, limit the max height */
@media (min-width: 768px) and (max-height: 800px) {
    .product-section {
        max-height: 75vh;
    }
}

.product-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 1rem;
    line-height: 1.3;
    word-wrap: break-word;
}

@media (min-width: 768px) {
    .product-title {
        font-size: 1.75rem;
    }
}

@media (min-width: 992px) {
    .product-title {
        font-size: 2rem;
    }
}

.product-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.spec-badge {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    white-space: nowrap;
}

.spec-badge i {
    color: var(--primary);
    font-size: 0.9rem;
}

.product-description {
    color: var(--muted-foreground);
    margin-bottom: 1.5rem;
    line-height: 1.7;
    word-wrap: break-word;
    flex-grow: 1; /* Allow description to take available space */
    overflow-y: auto; /* Make description scrollable if too long */
    max-height: 200px; /* Limit description height */
    padding-right: 0.5rem; /* Space for scrollbar */
}

/* Custom scrollbar for description */
.product-description::-webkit-scrollbar {
    width: 6px;
}

.product-description::-webkit-scrollbar-track {
    background: var(--muted);
    border-radius: 3px;
}

.product-description::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.product-description::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground);
}

/* Pricing */
.pricing {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.current-price {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
}

@media (min-width: 768px) {
    .current-price {
        font-size: 2rem;
    }
}

@media (min-width: 992px) {
    .current-price {
        font-size: 2.25rem;
    }
}

.regular-price {
    font-size: 1.1rem;
    color: var(--muted-foreground);
    text-decoration: line-through;
}

@media (min-width: 768px) {
    .regular-price {
        font-size: 1.25rem;
    }
}

/* Add to Cart Button */
.add-to-cart-btn {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
    padding: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    margin-bottom: 1rem;
    margin-top: auto; /* Push button to bottom */
}

.add-to-cart-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.add-to-cart-btn i {
    font-size: 1.2rem;
}



/* Mobile Cart Icon in Mobile Nav */
.mobile-cart-icon-container {
    position: relative;
    cursor: pointer;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    width: fit-content;
}

.mobile-cart-icon-container .cart-icon {
    font-size: 1.25rem;
    color: var(--primary);
}

 .cart-count{
    color: red;
 }

.mobile-cart-icon-container .cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--destructive);
    color: var(--destructive-foreground);
    font-size: 0.7rem;
    font-weight: 600;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cart Drawer Styles */
.cart-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background-color: var(--card);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Cart drawer is hidden by default on all screens */
.cart-drawer.open {
    right: 0;
}

@media (max-width: 400px) {
    .cart-drawer {
        max-width: 100%;
    }
}

.cart-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.cart-drawer-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
}

.close-cart {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: color 0.2s;
    padding: 0.25rem;
    line-height: 1;
}

.close-cart:hover {
    color: var(--destructive);
}

.cart-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 0;
    width: 100%;
}

.cart-empty {
    text-align: center;
    padding: 1rem 1rem;
    color: var(--muted-foreground);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cart-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--border);
}

.cart-empty h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.cart-empty p {
    font-size: 0.85rem;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.cart-item {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .5rem;
    border-radius: 8px;
    background-color: var(--muted);
    width: 100%;
}

@media (min-width: 480px) {
    .cart-item {
        flex-direction: row;
        align-items: flex-start;
    }
}

.cart-item-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
}

@media (min-width: 480px) {
    .cart-item-image {
        width: 80px;
        height: 80px;
    }
}

.cart-item-details {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.cart-item-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 1rem;
    color: var(--foreground);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-item-price {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.cart-item-subtotal {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-bottom: 0.5rem;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.quantity-btn:hover {
    background-color: var(--secondary);
    border-color: var(--primary);
}

.quantity-input {
    width: 50px;
    height: 32px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    font-family: var(--font-body);
    background: var(--card);
    flex-shrink: 0;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--destructive);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1rem;
    transition: color 0.2s;
    flex-shrink: 0;
    align-self: flex-start;
}

.cart-item-remove:hover {
    color: #dc2626;
}

/* Cart Totals */
.cart-totals {
    background-color: var(--muted);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    width: 100%;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    width: 100%;
}

.total-row:last-child {
    margin-bottom: 0;
}

.total-label {
    color: var(--muted-foreground);
}

.total-value {
    font-weight: 600;
    color: var(--foreground);
}

.grand-total {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    font-size: 1.125rem;
}

.grand-total .total-label {
    color: var(--foreground);
    font-weight: 700;
}

.grand-total .total-value {
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 700;
}

/* Cart Footer */
.cart-drawer-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: var(--card);
    width: 100%;
}

.checkout-btn {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: center;
    text-decoration: none;
    width: 100%;
}

.checkout-btn:hover {
    background-color: var(--primary-dark);
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .container {
        padding: 0 0.75rem;
    }
    
    main {
        padding: 1rem 0;
        align-items: flex-start; /* Align to top on mobile */
    }
    
    .product-info {
        padding: 1.25rem;
    }
    
    .product-title {
        font-size: 1.35rem;
    }
    
    .current-price {
        font-size: 1.5rem;
    }
    
    .regular-price {
        font-size: 1rem;
    }
    
    .spec-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .cart-drawer-header {
        padding: 1rem 1.25rem;
    }
    
    .cart-drawer-content {
        padding: 1rem;
    }
    
    .cart-drawer-footer {
        padding: 1rem;
    }
    
    .cart-item {
        padding: 0.875rem;
    }
    
    .add-to-cart-btn {
        padding: 0.875rem;
        font-size: 1rem;
        margin-top: 1rem; /* Reset margin-top on mobile */
    }
    
    .product-description {
        max-height: 150px; /* Smaller max-height on mobile */
    }
}

@media (max-width: 480px) {
    .product-info {
        padding: 1rem;
    }
    
    .product-title {
        font-size: 1.25rem;
    }
    
    .current-price {
        font-size: 1.35rem;
    }
    
    .spec-badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.7rem;
    }
    
    .cart-drawer-title {
        font-size: 1.25rem;
    }
    
    .cart-item-title {
        font-size: 0.95rem;
    }
    
    .quantity-btn {
        width: 28px;
        height: 28px;
    }
    
    .quantity-input {
        width: 45px;
        height: 28px;
    }
}

/* Fix for horizontal scroll */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Ensure no content overflows */
* {
    max-width: 100%;
}

/* Fix for cart drawer on mobile */
@media (max-width: 767px) {
    body.cart-open {
        overflow: hidden;
    }
    
    .cart-drawer {
        max-width: 100%;
    }
}

/* Fix for very wide laptop screens */
@media (min-width: 1400px) {
    .product-section {
        max-height: 70vh;
    }
}

/* Fix for very short screens */
@media (max-height: 700px) and (min-width: 768px) {
    .product-section {
        max-height: 65vh;
        min-height: 500px;
    }
}