
/*==================================================
  MODERN CSS RESET & BASE STYLES
==================================================*/
:root {
    /* Color Palette */
    --primary-color: #3B82F6; /* Blue 500 */
    --primary-hover: #2563EB; /* Blue 600 */
    --secondary-color: #10B981; /* Emerald 500 */
    --text-primary: #1F2937; /* Gray 800 */
    --text-secondary: #6B7280; /* Gray 500 */
    --background-light: #F9FAFB; /* Gray 50 */
    --background-white: #FFFFFF;
    --border-color: #E5E7EB; /* Gray 200 */
    --danger-color: #EF4444; /* Red 500 */

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Border Radius */
    --border-radius-sm: 0.375rem; /* 6px */
    --border-radius-md: 0.5rem; /* 8px */
    --border-radius-lg: 0.75rem; /* 12px */
    --border-radius-xl: 1rem; /* 16px */
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-light);
    color: var(--text-primary);
    line-height: 1.6;
    padding-top: 80px; /* Space for fixed header */
    padding-bottom: 80px; /* Space for fixed bottom navbar */
    text-align: center;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/*==================================================
  LAYOUT & CONTAINER
==================================================*/
.container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/*==================================================
  TYPOGRAPHY
==================================================*/
h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 { font-size: 2.75rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.5rem; }
p { margin-bottom: 1rem; color: var(--text-secondary); }

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

/*==================================================
  HEADER & NAVIGATION
==================================================*/
.main-header {
    background-color: var(--background-white);
    box-shadow: var(--shadow-md);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.25rem 0;
}

.main-header .container {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    position: relative;
}

.logo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 1.75rem;
    color: var(--text-primary);
}

.search-container {
    flex-grow: 1;
    margin: 0 2rem;
}

#product-search {
    width: 100%;
    max-width: 400px;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

#product-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.main-nav {
    display: flex;
}

.main-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.main-nav a {
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.5rem 0;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

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

.hamburger i {
    font-size: 1.5rem;
    color: var(--text-primary);
}


/*==================================================
  BOTTOM NAVIGATION (MOBILE)
==================================================*/
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--background-white);
    box-shadow: 0 -4px 10px rgba(0,0,0,0.08);
    display: none; /* Hidden by default, shown in media query */
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 1000;
}

.bottom-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.5rem;
    text-decoration: none;
    transition: color 0.2s;
}

.bottom-nav .nav-link i {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
}

.bottom-nav .nav-link.active,
.bottom-nav .nav-link:hover {
    color: var(--primary-color);
}

/*==================================================
  HERO SECTION
==================================================*/
.hero-section {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--background-white);
    text-align: center;
    padding: 6rem 1.5rem;
    margin-bottom: 4rem;
    border-radius: var(--border-radius-xl);
}

.hero-section h1 {
    font-size: 3.5rem;
    font-weight: 800;
    text-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.hero-section p {
    font-size: 1.2rem;
    max-width: 650px;
    margin: 1rem auto 2rem;
    color: rgba(255, 255, 255, 0.9);
}

/*==================================================
  CARD STYLES (UNIFIED)
==================================================*/
.card {
    background-color: var(--background-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: var(--border-radius-md);
    margin-bottom: 1.5rem;
}

.card-content {
    flex-grow: 1;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.card-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.card-description {
    margin-bottom: 1.5rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.product-card .card-image {
    background-color: var(--background-light);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 280px; /* Taller image container */
}

.product-card .card-image img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain; /* Show the whole product */
}

.product-card .price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

/*==================================================
  BUTTONS
==================================================*/
.btn {
    display: inline-block;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--border-radius-md);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    color: var(--background-white);
    background-color: var(--primary-color);
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    color: var(--text-primary);
    background-color: transparent;
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--background-light);
    border-color: #D1D5DB; /* Gray 300 */
}

.btn-danger {
    color: var(--background-white);
    background-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #d03030;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 0.5rem;
}

.btn-google {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    background-color: #fff;
    border-color: var(--border-color);
    color: var(--text-primary);
    text-transform: none;
    font-weight: 500;
}

.btn-google:hover {
    background-color: #f7f7f7;
}

.btn-google i {
    font-size: 1.2rem;
}

/*==================================================
  CART PAGE STYLES
==================================================*/
.cart-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

#cart-items-grid {
    grid-template-columns: 1fr; /* Each item takes full width */
}

.cart-item-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
}

.cart-item-card img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--border-radius-md);
    margin-right: 1.5rem;
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-actions {
    text-align: right;
}

.quantity-control {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.quantity-control button {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    background: none;
    cursor: pointer;
}

.quantity-control span {
    padding: 0 1rem;
}

#cart-summary-card h3 {
    text-align: center;
    margin-bottom: 2rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.summary-row.total {
    font-weight: 700;
    font-size: 1.25rem;
}

#cart-summary-card hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

#checkout-btn {
    width: 100%;
    margin-top: 1rem;
}


/*==================================================
  FORMS & AUTH
==================================================*/
.auth-container, .form-container, .admin-controls, .product-form-container {
    max-width: 480px;
    margin: 4rem auto;
    padding: 2.5rem;
    background: var(--background-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    text-align: center;
}

.auth-container h2 {
    margin-bottom: 0.5rem;
}

.auth-container p {
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--background-white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.form-links {
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.form-links a {
    margin: 0 0.5rem;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider span {
    padding: 0 1rem;
}

/*==================================================
  PROFILE PAGE
==================================================*/

.profile-page-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: flex-start;
}

.profile-nav-card {
    padding: 1.5rem;
    position: sticky;
    top: 100px;
}

.profile-header {
    text-align: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.profile-avatar {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background-color: #eee;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

#avatar-upload-label {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: var(--primary-color);
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    transition: background-color 0.2s;
}
#avatar-upload-label:hover { background-color: var(--primary-hover); }

#profile-display-name {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}
#profile-email { font-size: 0.9rem; }

.profile-nav a.nav-btn,
.profile-nav button.nav-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid transparent;
    background: none;
    text-align: left;
    cursor: pointer;
    border-radius: var(--border-radius-md);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: background-color 0.2s, color 0.2s;
}

.profile-nav a.nav-btn:hover,
.profile-nav button.nav-btn:hover {
    background-color: var(--background-light);
    color: var(--text-primary);
}

.profile-nav a.nav-btn.active,
.profile-nav button.nav-btn.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}
.profile-nav a.nav-btn i,
.profile-nav button.nav-btn i {
    width: 20px;
    text-align: center;
}

.profile-content .content-section {
    display: none;
    text-align: left;
}

.profile-content .content-section.active {
    display: block;
}

.profile-content hr {
    margin: 2rem 0;
    border: 0;
    border-top: 1px solid var(--border-color);
}

.info-group {
    margin-bottom: 1.5rem;
}

.info-group label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.info-group p {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-top: 0.25rem;
}

/* Wallet & Balance */
.balance-display {
    text-align: center;
    padding: 2rem;
    background-color: var(--background-light);
    border-radius: var(--border-radius-lg);
    margin-bottom: 2rem;
}

.balance-display p {
    margin: 0;
    color: var(--text-secondary);
}

.balance-display h2 {
    margin: 0;
    font-size: 2.5rem;
    color: var(--primary-color);
}

/* Order History */
#orders-list-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.order-card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background-color: #fff;
}

.order-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background-color: var(--background-light);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.order-body {
    padding: 1.5rem;
}

.order-items-list {
    list-style-type: none;
    padding-left: 0;
    margin-top: 0.5rem;
}

.order-items-list li {
    padding: 0.25rem 0;
}


/*==================================================
  TESTIMONIALS SECTION
==================================================*/
.testimonials-section {
    background-color: var(--background-white);
    padding: 4rem 0;
    margin-bottom: 4rem;
}

.testimonial-carousel {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
}

.testimonial-carousel-inner {
    display: flex;
    transition: transform 0.5s ease;
}

.testimonial-card {
    flex: 0 0 100%;
    padding: 2rem;
    text-align: center;
}

.testimonial-card .avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1.5rem;
    border: 4px solid var(--primary-color);
}

.testimonial-card p {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 1rem;
}

.testimonial-card .author {
    font-weight: 700;
    color: var(--text-primary);
}

.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.3);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.carousel-control:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

.carousel-control.prev {
    left: 1rem;
}

.carousel-control.next {
    right: 1rem;
}

/*==================================================
  FOOTER
==================================================*/

.main-footer {
    background-color: var(--background-white);
    padding: 3rem 0;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    text-align: center;
    color: var(--text-secondary);
}

.social-media {
    margin-bottom: 1.5rem;
}

.social-media a {
    color: var(--text-secondary);
    font-size: 1.5rem; /* Larger icons */
    margin: 0 1rem;
    transition: color 0.3s ease, transform 0.3s ease;
    display: inline-block; /* Allows for transform */
}

.social-media a:hover {
    color: var(--primary-color);
    transform: translateY(-3px); /* Add a little lift on hover */
}

.footer-links {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.footer-content p {
    font-size: 0.9rem;
    margin: 0;
}

/*==================================================
  TOAST NOTIFICATIONS
==================================================*/

#toast-container {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
}

.toast {
    background-color: var(--text-primary);
    color: var(--background-white);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    font-weight: 600;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    background-color: var(--secondary-color);
}

.toast.error {
    background-color: var(--danger-color);
}


/*==================================================
  RESPONSIVE DESIGN
==================================================*/
@media (max-width: 992px) {
    .profile-grid, .cart-layout {
        grid-template-columns: 1fr;
    }
    .profile-nav-card {
        position: static;
        top: auto;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }
    
    .main-header .container {
        flex-wrap: wrap;
    }

    .search-container {
        order: 3; /* Move search to the bottom on mobile */
        width: 100%;
        margin: 1rem 0 0;
    }

    #product-search {
        max-width: 100%;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--background-white);
        box-shadow: var(--shadow-md);
        flex-direction: column;
        align-items: stretch;
        padding: 1rem 0;
    }
    
    .main-nav.active {
        display: flex;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0;
    }

    .main-nav li {
        width: 100%;
    }

    .main-nav a {
        display: block;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--border-color);
    }

    .hamburger {
        display: block;
    }

    .bottom-nav {
        display: flex;
    }

    .hero-section h1 {
        font-size: 2.5rem;
    }

    .hero-section p {
        font-size: 1rem;
    }

    .section-title {
        font-size: 2rem;
    }
    
    .card-grid {
        grid-template-columns: 1fr;
    }

    .auth-container {
        margin: 2rem auto;
        padding: 2rem 1.5rem;
        box-shadow: none;
        border-radius: 0;
    }

    .cart-item-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .cart-item-card img {
        width: 100%;
        height: 180px;
        margin-right: 0;
        margin-bottom: 1rem;
    }
}
