/* General Styles */
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    background-color: #f8f9fa;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
}

/* A few global rules to prevent common responsive issues */
img,
table {
    max-width: 100%;
    height: auto;
}

body {
    overflow-wrap: break-word;
}

.login-page main, .register-page main {
    padding: 0;
}

.login-page .login-wrapper, .register-page .login-wrapper {
    height: calc(100vh - 71px); /* Header height, adjust if needed */
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
header {
    background: #fff;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 1000;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    display: inline-block;
}

.main-logo-img {
    height: 40px;
}

.nav-menu {
    flex-grow: 1; /* Allow the menu to take up available space */
}

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center; /* Center the links within the nav-menu */
    gap: 25px;
    position: relative; /* Add for manual adjustment */
    left: 90px; /* Nudge further to the right for better visual centering */
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #2C3F70;
}

.nav-icons {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative; /* Ensure it's on top of other elements */
    z-index: 2;
}

.nav-link-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
}

.nav-item-icon {
    height: 24px;
    margin-right: 8px;
}

.nav-profile-pic {
    border-radius: 50%;
    object-fit: cover;
    width: 24px;
    height: 24px;
}

.hamburger {
    display: none;
    cursor: pointer;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px 0;
    background-color: #333;
    transition: 0.4s;
}

/* Responsive Navbar */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        background-color: #fff;
        position: absolute;
        top: 70px;
        left: 0;
        padding: 20px 0;
        border-top: 1px solid #eee;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li {
        text-align: center;
        margin: 10px 0;
    }

    .nav-item-text {
        display: none; /* Hide text on mobile for a cleaner look */
    }

    .nav-icons {
        margin-right: 20px; /* Add space between icons and hamburger */
    }

    .hamburger {
        display: block;
    }
}

/* Auth Page Styles */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px 20px;
    background-color: #f4f7f6;
}

.auth-form {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.auth-form h2 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    font-size: 24px;
}

.auth-form p {
    margin-bottom: 30px;
    color: #666;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #2C3F70;
}

.btn-primary {
    width: 100%;
    padding: 12px 15px;
    background-color: #2C3F70;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background-color: #2C3F70;
}

.error-message {
    color: #d9534f;
    background-color: #f2dede;
    border: 1px solid #ebccd1;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.auth-switch {
    margin-top: 25px;
    color: #666;
}

.auth-switch a {
    color: #2C3F70;
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* New Login Page Styles */
.login-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f4f8;
}

.login-container {
    display: flex;
    width: 90%;
    max-width: 1100px;
    height: 85vh;
    max-height: 650px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border-radius: 10px;
    overflow: hidden;
}

.login-left {
    flex-basis: 50%;
    background: linear-gradient(to right, #2C3F70, #2C3F70);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
}

.login-left-content h1 {
    font-size: 32px;
    margin-bottom: 15px;
}

.login-left-content p {
    font-size: 18px;
    line-height: 1.6;
}

.login-right {
    flex-basis: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-right .auth-form {
    box-shadow: none;
    padding: 0;
    max-width: 380px;
}

/* Catalog Page */
.page-header {
    background-color: #2C3F70;
    color: #fff;
    padding: 40px 0;
    text-align: center;
}

.catalog-wrapper {
    display: flex;
    padding: 40px 0;
}

.filter-sidebar {
    width: 25%;
    padding-right: 30px;
}

.product-grid {
    width: 75%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.filter-group {
    margin-bottom: 25px;
}

.filter-group h3 {
    border-bottom: 2px solid #2C3F70;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.product-card a {
    text-decoration: none;
    color: inherit;
}

.product-image {
    width: 100%;
    height: 200px; /* Or adjust as needed */
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 20px;
}

.product-info h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: #2C3F70;
}

.original-price {
    text-decoration: line-through;
    color: #999;
    margin-right: 10px;
}

.discount-price {
    color: #e74c3c;
}

/* Product Detail Page */
.product-detail-container {
    display: flex;
    padding: 60px 0;
    gap: 50px;
}
.product-gallery {
    width: 55%;
}
.main-image img {
    width: 100%;
    border: 1px solid #ddd;
}

.product-info-details {
    width: 45%;
}

.product-info-details h1 {
    font-size: 2.5rem;
    margin-top: 0;
}

.product-price-detail {
    font-size: 2rem;
    color: #000;
    margin: 20px 0;
}

.add-to-cart-btn {
    display: inline-block;
    width: 100%;
    padding: 15px;
    background-color: #2C3F70;
    color: white;
    text-align: center;
    font-size: 1.2rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.add-to-cart-btn:hover {
    background-color: #1a2b52;
}
.add-to-wishlist-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    text-align: center;
    background-color: #f0f0f0;
    color: #333;
    text-decoration: none;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.reviews-section { padding: 40px 0; border-top: 1px solid #ddd; }
.review-card { border-bottom: 1px solid #ddd; padding: 20px 0; }
.review-card:last-child { border-bottom: none; }

/* Cart Page */
.cart-container { padding: 40px 0; }
.cart-container h1 { text-align: center; margin-bottom: 40px; }
.cart-table { width: 100%; border-collapse: collapse; margin-bottom: 40px; }
.cart-table thead { background-color: #2C3F70; color: white; }
.cart-table th, .cart-table td { padding: 15px; text-align: left; border-bottom: 1px solid #ddd; }
.cart-item-info { display: flex; align-items: center; }
.cart-item-image {
    max-width: 100px;
    width: 100%;
    height: auto;
    object-fit: cover;
    margin-right: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}
.remove-btn { color: red; text-decoration: none; }
.cart-summary { float: right; width: 40%; max-width: 450px; background-color: #f8f9fa; padding: 20px; border-radius: 8px; }
.cart-summary h3 { margin-top: 0; }
.checkout-btn { display: block; width: 100%; padding: 15px; background-color: #28a745; color: #fff; text-align: center; text-decoration: none; font-size: 1.2rem; border: none; cursor: pointer; margin-top: 20px; border-radius: 4px;}

.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* for smooth scrolling on iOS */
}

/* Checkout Page */
.checkout-container { 
    display: flex; 
    gap: 50px; 
    padding: 40px 0; 
}
.shipping-form { 
    width: 60%; 
}
.order-summary { 
    width: 40%; 
    background-color: #f9f9f9; 
    padding: 20px; 
    border: 1px solid #ddd; 
    border-radius: 8px;
}

.order-summary h2 { margin-bottom: 20px; }
.order-items { margin-bottom: 20px; }
.order-item { display: flex; justify-content: space-between; margin-bottom: 10px; }
.order-item-name { flex-grow: 1; }
.order-item-price { white-space: nowrap; margin-left: 15px; }

@media (max-width: 992px) {
    .checkout-container {
        flex-direction: column;
    }
    .shipping-form, .order-summary {
        width: 100%;
    }
}

/* Footer */
footer {
    background-color: #2C3F70;
    color: #fff;
    padding: 50px 0;
    margin-top: 40px;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.footer-branding {
    display: flex;
    align-items: center;
    gap: 15px;
}

.footer-logo-img {
    height: 40px;
}

.footer-title {
    font-size: 24px;
    font-weight: 700;
}

.footer-copyright {
    margin: 0;
    font-size: 14px;
    color: #adb5bd;
}

.footer-right .social-media {
    display: flex;
    gap: 20px;
}

.footer-right .social-media a {
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s ease;
}

.footer-right .social-media a:hover {
    color: #adb5bd; /* Adjusted for new footer background */
}


@media (max-width: 992px) {
    .login-left {
        display: none;
    }
    .login-right {
        flex-basis: 100%;
    }
    .login-container {
        width: 100%;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
    .catalog-wrapper {
        flex-direction: column;
    }
    .filter-sidebar, .product-grid {
        width: 100%;
        padding-right: 0;
    }
    .footer-container {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }
    .footer-left {
        flex-direction: column;
        gap: 15px;
    }
}

/* Responsive Product Detail Page & Cart */
@media (max-width: 768px) {
    .product-detail-container {
        flex-direction: column;
        padding: 20px 0;
        gap: 20px;
    }
    .product-gallery, .product-info-details {
        width: 100%;
    }
    .product-info-details h1 {
        font-size: 1.8rem;
    }
    .product-price-detail {
        font-size: 1.5rem;
    }
    
    /* Action row for quantity and add to cart */
    .product-actions {
        display: flex;
        gap: 15px;
        align-items: center;
    }
    .product-actions .form-group {
        flex-grow: 1;
        margin-bottom: 0; /* Remove margin from form-group inside actions */
    }
    .product-actions .add-to-cart-btn {
        flex-basis: 60%;
    }

    /* Cart Page Responsive */
    .cart-summary {
        width: 100%;
        float: none;
        margin-top: 20px;
    }
    .cart-table th, .cart-table td {
        padding: 10px 5px;
    }
    
}


/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.chat-button {
    background-color: #2C3F70;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.chat-window {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    overflow: hidden;
}

.chat-header {
    background: #2C3F70;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 18px;
}

.chat-close {
    cursor: pointer;
    font-size: 24px;
}

.chat-body {
    height: 300px;
    overflow-y: auto;
    padding: 15px;
}

.chat-message {
    margin-bottom: 15px;
    line-height: 1.4;
}

.chat-message.user {
    text-align: right;
}

.chat-message.admin {
    text-align: left;
}

.chat-footer {
    padding: 15px;
    border-top: 1px solid #eee;
}

#chat-form {
    display: flex;
}

#chat-input {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
}

#chat-form button {
    background: #2C3F70;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    margin-left: 10px;
    cursor: pointer;
}