/* product.css */

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: block;
}

.container {
    display: flex;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-width: 100%;
    width: 100%;
    margin: 20px auto;
}

.product-image-container {
    flex: 1;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fafafa;
    position: relative;
}

#main-image {
    max-width: 100%;
    max-height: 80%;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

#main-image:hover {
    transform: scale(1.05);
}

.image-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: #007BFF;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s;
    opacity: 1;
    z-index: 10;
}

.image-nav:hover {
    background-color: #0056b3;
}

.image-nav.prev {
    left: 30px;
}

.image-nav.next {
    right: 30px;
}

.product-info-container {
    flex: 1;
    padding: 40px;
}

#product-brand {
    font-family: 'Teko', sans-serif;
    font-size: 1.8em;
    font-weight: 700;
    color: #007BFF;
    margin: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#product-name {
    font-size: 2.8em;
    margin: 0 0 15px 0;
    font-weight: 700;
}

.product-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.meta-tag {
    background-color: #e9ecef;
    color: #495057;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9em;
}

/* === UPDATED: Added white-space property to preserve line breaks === */
#product-description {
    color: #555;
    line-height: 1.7;
    white-space: pre-wrap; /* This is the magic line */
}

.price {
    font-family: 'Teko', sans-serif;
    font-size: 3em;
    font-weight: 700;
    color: #333;
    margin: 20px 0;
}

.shipping-cost {
    font-size: 0.4em;
    font-weight: 400;
    color: #666;
    vertical-align: middle;
    margin-left: 10px;
}

/* Updated: Renamed from .add-to-cart to .add-to-cart-btn for consistency */
.add-to-cart-btn {
    background-color: #007BFF;
    color: #fff;
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
    margin-bottom: 30px;
}

.add-to-cart-btn:hover {
    background-color: #0056b3;
}

.specifications {
    margin-top: 30px;
}

#spec-table {
    width: 100%;
    border-collapse: collapse;
}

#spec-table tr {
    border-bottom: 1px solid #eee;
}

#spec-table td {
    padding: 12px 0;
    font-size: 0.95em;
}

#spec-table td:first-child {
    font-weight: 700;
    color: #333;
    padding-right: 20px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
}

.modal-content {
    margin: auto;
    display: block;
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 90vh;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 35px;
    color: white;
    background-color: #007BFF;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.close-button:hover {
    background-color: #0056b3;
}

.modal .prev, .modal .next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  padding: 16px;
  margin-top: -22px;
  color: white;
  font-weight: bold;
  font-size: 20px;
  transition: 0.6s ease;
  border-radius: 0 3px 3px 0;
  user-select: none;
}

.modal .next {
  right: 0;
  border-radius: 3px 0 0 3px;
}

.modal .prev:hover, .modal .next:hover {
  background-color: rgba(0,0,0,0.8);
}

/* Info Icon and Tooltip Styles */
.meta-tag-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-icon-wrapper {
    position: relative;
    display: none;
    align-items: center;
}

.info-icon {
    font-size: 1.3em;
    color: #888;
    cursor: help;
    line-height: 1;
}

.info-icon-wrapper:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

.tooltip {
    visibility: hidden;
    opacity: 0;
    width: 260px;
    background-color: #2c2c2c;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 10;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.3s ease, visibility 0.3s ease;
    font-size: 0.9em;
    line-height: 1.5;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #2c2c2c transparent transparent transparent;
}


/* Responsive Adjustments */
@media (max-width: 767px) {
    .container {
        flex-direction: column;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .product-image-container { padding: 10px; }
    #main-image { max-height: 350px; }
    .product-info-container { padding: 20px; }
    #product-brand { font-size: 1.5em; }
    #product-name { font-size: 2em; margin-bottom: 10px; }
    .price { font-size: 2.2em; margin: 15px 0; }
    .add-to-cart-btn { padding: 12px 20px; font-size: 1.1em; }
    #spec-table td { font-size: 0.9em; }
    
    .image-nav.prev { left: 15px; }
    .image-nav.next { right: 15px; }

    .tooltip {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 1010;
        width: 90vw;
        max-width: 400px;
        white-space: normal;
        min-height: fit-content;
    }
}


.original-price {
    text-decoration: line-through;
    color: #6c757d;
    font-size: 0.8em;
    margin-right: 10px;
}

.discounted-price {
    color: #dc3545;
    font-weight: bold;
}

.discount-percentage {
    background-color: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.6em;
    margin-left: 10px;
    vertical-align: middle;
}

.universal-description {
    color: #444;
    line-height: 1.6;
    white-space: pre-wrap; /* This respects line breaks you enter in the textarea */
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    font-size: 0.95em;
}

.universal-description {
    white-space: pre-wrap;
}