/* public/style.css */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
}

header {
    background: #2c3e50;
    color: white;
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
}

header h1 a {
    color: white;
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9rem;
}

.user-nav a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s;
}

.user-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.user-nav .user-info {
    color: #bdc3c7;
    margin-right: 10px;
}

footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

.breadcrumbs { 
    padding: 10px 20px;
    background: #ecf0f1;
    font-size: 0.9rem;
}

.breadcrumbs a {
    color: #2980b9;
    text-decoration: none;
}

main {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Sidebar Categories */
.categories {
    width: 250px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    height: fit-content;
}

.categories h2 {
    margin-top: 0;
    font-size: 1.2rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.categories ul {
    list-style: none;
    padding: 0;
}

.categories li {
    margin: 10px 0;
}

.categories a {
    text-decoration: none;
    color: #555;
    display: block;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.3s;
}

.categories a:hover, .categories a.active {
    background: #3498db;
    color: white;
}

/* Product List */
.product-list {
    flex: 1;
    margin-left: 30px;
}

.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
}

.product {
    background: white;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.product:hover {
    transform: translateY(-5px);
}

.product img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.product h3 {
    font-size: 1.1rem;
    margin: 10px 0;
    height: 2.4em;
    overflow: hidden;
}

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

.price {
    font-weight: bold;
    color: #e67e22;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

button {
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
    width: 100%;
}

button:hover {
    background: #219150;
}

/* Product Detail Page */
.product-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.product-image img {
    width: 100%;
    border-radius: 8px;
}

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

.product-info .category {
    color: #7f8c8d;
    font-style: italic;
}

.product-info .price {
    font-size: 2rem;
    margin: 20px 0;
}

.description h3 {
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.add-to-cart-btn {
    font-size: 1.2rem;
    padding: 15px;
    margin-top: 20px;
}

/* Admin Styles */
.admin-main {
    flex-direction: column;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.admin-main table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.admin-main th, .admin-main td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.admin-main th {
    background-color: #f2f2f2;
}

.btn {
    display: inline-block;
    background: #3498db;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    margin-bottom: 20px;
}

.link-btn {
    background: none;
    border: none;
    color: #e74c3c;
    padding: 0;
    cursor: pointer;
    font-weight: normal;
    text-decoration: underline;
    width: auto;
}

.admin-form {
    flex-direction: column;
    max-width: 600px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.admin-form label {
    display: block;
    margin-top: 15px;
    font-weight: bold;
}

.admin-form input, .admin-form select, .admin-form textarea {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.admin-form button {
    margin-top: 20px;
}

/* Product Carousel */
.carousel-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    background: #eee;
}

.carousel-slides {
    position: relative;
    height: 400px; /* Fixed height for consistency */
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    display: flex;
    justify-content: center;
    align-items: center;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 1;
}

.carousel-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.carousel-prev, .carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    z-index: 10;
    width: auto;
    border-radius: 4px;
}

.carousel-prev:hover, .carousel-next:hover {
    background: rgba(0,0,0,0.8);
}

.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }

.carousel-indicators {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.3s;
}

.indicator.active {
    background: white;
}

/* Lazy loading placeholder */
.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy.loaded {
    opacity: 1;
}

/* Responsive Product Details */
@media (max-width: 768px) {
    .product-page {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .carousel-slides {
        height: 300px;
    }
}

/* Shopping Cart Widget */
.cart-container {
    position: relative;
}

.cart {
    background: #f1c40f;
    color: #2c3e50;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s;
}

.cart:hover {
    transform: scale(1.05);
}

.cart-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    width: 320px;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    margin-top: 10px;
    color: #333;
}

.cart-dropdown.show {
    display: block !important;
}

/* Updated Cart Styles */
.cart-items-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
}

.cart-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    gap: 10px;
}

.cart-item-info {
    flex: 1;
}

.cart-item-info .name {
    font-weight: bold;
    font-size: 0.9rem;
}

.cart-item-info .price {
    color: #7f8c8d;
    font-size: 0.85rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-input {
    width: 45px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.remove-action {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 5px;
    transition: color 0.2s;
}

.remove-action:hover {
    color: #c0392b;
    background: none;
}

.cart-total-display {
    margin-top: 15px;
    font-weight: bold;
    text-align: right;
    font-size: 1.1rem;
    color: #2c3e50;
}

.cart-checkout-action {
    width: 100%;
    background: #e67e22;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    margin-top: 15px;
    cursor: pointer;
    font-weight: bold;
}

.cart-checkout-action:hover {
    background: #d35400;
}

/* Auth Forms */
.auth-form {
    flex-direction: column;
    max-width: 450px;
    margin: 60px auto;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.auth-form h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
}

.auth-form input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #dcdde1;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.auth-form input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.auth-form button {
    width: 100%;
    padding: 14px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.auth-form button:hover {
    background: #2980b9;
}

.auth-form .auth-footer {
    text-align: center;
    margin-top: 25px;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.auth-form .auth-footer a {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
}

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

.error-message {
    background: #fab1a0;
    color: #d63031;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    border-left: 4px solid #d63031;
}
