:root {
    --primary-blue: #007BFF;
    --light-blue: #E6F0FF;
    --dark-blue: #0056b3;
    --text-color: #333;
    --text-light: #666;
    --background: #f8f9fa;
    --white: #ffffff;
    --border: #dee2e6;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-dark: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
    --neon-blue: #00d4ff;
    --neon-purple: #ff00ff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
}

/* Product Modal Styles */
.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 0.3s ease-in-out forwards;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    background: var(--light-blue);
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    color: var(--dark-blue);
    margin: 0;
    font-size: 24px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--danger);
    color: var(--white);
    transform: rotate(90deg);
}

.modal-body {
    display: flex;
    padding: 30px;
    gap: 30px;
}

.modal-image {
    flex: 1;
    max-width: 400px;
}

.modal-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.modal-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-price {
    font-size: 28px;
    font-weight: bold;
    color: var(--success);
    margin: 0;
}

.modal-description {
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
}

.modal-stock {
    color: var(--text-light);
    font-size: 14px;
    margin: 0;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.add-to-cart-btn, .close-modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.add-to-cart-btn {
    background: var(--success);
    color: var(--white);
}

.add-to-cart-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

.close-modal-btn {
    background: var(--border);
    color: var(--text-color);
}

.close-modal-btn:hover {
    background: var(--text-light);
    color: var(--white);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

/* Product card hover effect for clickability */
.product-card {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* Responsive modal */
@media (max-width: 768px) {
    .modal-body {
        flex-direction: column;
        padding: 20px;
    }
    
    .modal-image {
        max-width: 100%;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .add-to-cart-btn, .close-modal-btn {
        width: 100%;
    }
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(255, 219, 98, 0.2) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    animation: floatingGradient 20s ease-in-out infinite;
}

@keyframes floatingGradient {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    position: sticky;
    top: 0;
    z-index: 100;
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from { 
        transform: translateY(-100%);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.logo h1 a {
    text-decoration: none;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
    transition: all 0.3s ease;
}

.logo h1 a:hover {
    transform: scale(1.05);
    text-shadow: 0 0 40px rgba(102, 126, 234, 0.8);
}

.search-bar {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
}

.search-bar input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 25px;
    font-size: 1rem;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--neon-blue);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    transform: translateY(-2px);
}

.search-bar button {
    padding: 0.75rem 1.5rem;
    background: var(--gradient-accent);
    color: var(--white);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.search-bar button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(79, 172, 254, 0.5);
}

.header-actions {
    display: flex;
    align-items: center;
}

.auth-btn {
    padding: 0.5rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.auth-btn:hover {
    background: var(--gradient-primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.register-btn {
    background: var(--gradient-accent);
    color: var(--white);
}

.register-btn:hover {
    background: var(--gradient-secondary);
}

.logout-btn:hover {
    background: var(--danger);
}

.cart-icon {
    position: relative;
}

.cart-icon a {
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.3s;
}

.cart-icon a:hover,
.cart-icon a.active {
    background: var(--light-blue);
}

.cart-icon span {
    background: var(--danger);
    color: var(--white);
    border-radius: 50%;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    font-weight: bold;
}

.navbar {
    background: var(--light-blue);
    padding: 0.5rem 0;
}

.navbar ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.navbar a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s;
}

.navbar a:hover,
.navbar a.active {
    background: var(--primary-blue);
    color: var(--white);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-blue), var(--dark-blue));
    color: var(--white);
    text-align: center;
    padding: 4rem 0;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.cta-button {
    display: inline-block;
    background: var(--white);
    color: var(--primary-blue);
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 50px;
    font-weight: bold;
    transition: all 0.3s;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Categories Section */
.featured-categories {
    padding: 4rem 0;
}

.featured-categories h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    color: var(--text-color);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    padding: 0;
    text-align: center;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    cursor: pointer;
    transition: all 0.4s ease;
    overflow: hidden;
    position: relative;
    min-height: 200px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform-style: preserve-3d;
}

.category-card:hover {
    transform: translateY(-10px) rotateX(5deg);
    box-shadow: 0 20px 40px rgba(31, 38, 135, 0.5);
    border-color: var(--neon-blue);
}

.category-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.4));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    transition: background 0.3s;
}

.category-card:hover .category-overlay {
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.8), rgba(0, 123, 255, 0.5));
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

.category-card h3 {
    margin-bottom: 0.5rem;
    color: var(--white);
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.category-card p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    margin-bottom: 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Products Section */
.featured-products,
.products-page {
    padding: 4rem 0;
}

.featured-products h2,
.products-header h1 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    color: var(--text-color);
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.filter-sort {
    display: flex;
    gap: 1rem;
}

.filter-sort select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--white);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.product-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    transition: all 0.4s ease;
    cursor: pointer;
    transform-style: preserve-3d;
    position: relative;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.product-card:hover::before {
    left: 100%;
}

.product-card:hover {
    transform: translateY(-15px) rotateY(5deg);
    box-shadow: 0 25px 50px rgba(31, 38, 135, 0.6);
    border-color: var(--neon-blue);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: all 0.4s ease;
    filter: brightness(1);
}

.product-card:hover .product-image {
    transform: scale(1.1) rotate(2deg);
    filter: brightness(1.1);
}

.product-info {
    padding: 1.5rem;
}

.product-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

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

.product-description {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.add-to-cart {
    width: 100%;
    padding: 0.75rem;
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.add-to-cart::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.add-to-cart:hover::before {
    left: 100%;
}

.add-to-cart:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
    background: var(--gradient-secondary);
}

/* Cart Page */
.cart-page {
    padding: 4rem 0;
}

.cart-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.cart-items-list {
    background: var(--white);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
}

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

.cart-item-name {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.cart-item-price {
    color: var(--primary-blue);
    font-weight: bold;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.quantity-btn {
    background: var(--light-blue);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
}

.remove-item {
    background: var(--danger);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0.5rem;
}

.cart-summary {
    background: var(--white);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: var(--shadow);
    height: fit-content;
}

.cart-summary h3 {
    margin-bottom: 1.5rem;
}

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

.summary-row.total {
    font-weight: bold;
    font-size: 1.2rem;
    border-top: 2px solid var(--border);
    padding-top: 1rem;
}

.checkout-button {
    width: 100%;
    padding: 1rem;
    background: var(--success);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 1rem;
    transition: background 0.3s;
}

.checkout-button:hover {
    background: #218838;
}

.continue-shopping {
    display: block;
    text-align: center;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
}

.empty-cart {
    text-align: center;
    padding: 3rem;
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

/* Sell Page */
.sell-page {
    padding: 4rem 0;
}

.sell-page h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.5rem;
}

.sell-form-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}

.form-group textarea {
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 1rem;
}

.submit-button {
    flex: 1;
    padding: 1rem;
    background: var(--success);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
}

.cancel-button {
    flex: 1;
    padding: 1rem;
    background: var(--border);
    color: var(--text-color);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
}

.success-message {
    text-align: center;
    padding: 2rem;
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.success-message h3 {
    color: var(--success);
    margin-bottom: 1rem;
}

/* Footer */
.footer {
    background: var(--text-color);
    color: var(--white);
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-blue);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--white);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--primary-blue);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #555;
}
