@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #6C5CE7;
    --primary-hover: #5A4BDE;
    --secondary-color: #00B894;
    --secondary-hover: #00A383;
    --bg-color: #F8F9FB;
    --text-color: #2D3436;
    --text-muted: #636E72;
    --white: #FFFFFF;
    --border-color: #E2E8F0;
    --error: #FF7675;
    --success: #55EFC4;
    --warning: #FDCB6E;
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 10px 25px rgba(108, 92, 231, 0.15);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    animation: fadeIn 0.5s ease-in-out;
}

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

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

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Base Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 10px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(108, 92, 231, 0.4);
    color: var(--white);
}

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

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: var(--white);
}

/* Modern Header */
header {
    background: var(--white);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo-link:hover {
    color: var(--primary-hover);
}

/* Search Bar in Header */
.search-container {
    flex: 1;
    max-width: 400px;
    margin: 0 2rem;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border-radius: 25px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
    background: var(--white);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Navigation Links */
nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

nav > a {
    font-weight: 500;
    color: var(--text-color);
}

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

/* Layout */
main {
    padding: 2rem 5%;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 70vh;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 80px 20px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.05) 0%, rgba(0, 184, 148, 0.05) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 3rem;
    overflow: hidden;
    position: relative;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Product Cards Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* ====== Categories Dropdown (ML Style) ====== */
.nav-categories-dropdown {
    position: relative;
}

.nav-categories-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    padding: 6px 0;
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-categories-trigger:hover,
.nav-categories-trigger.active {
    color: var(--primary-color);
}

.nav-categories-trigger .cat-chevron {
    transition: transform 0.25s ease;
}

.nav-categories-trigger.active .cat-chevron {
    transform: rotate(180deg);
}

.categories-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    min-width: 260px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    padding: 8px 0;
    z-index: 2000;
}

.categories-dropdown-menu.open {
    display: block;
    animation: dropdownFadeIn 0.2s ease;
}

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

.cat-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease;
}

.cat-dropdown-item:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.cat-dropdown-item i {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.cat-dropdown-item:hover i {
    color: var(--primary-color);
}

.cat-dropdown-item span {
    flex: 1;
}

.cat-dropdown-badge {
    background: rgba(108, 92, 231, 0.1);
    color: var(--primary-color);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    flex: none !important;
}

.cat-dropdown-arrow {
    width: 14px !important;
    height: 14px !important;
    color: var(--border-color) !important;
    margin-left: auto;
    flex-shrink: 0;
}

.cat-dropdown-item:hover .cat-dropdown-arrow {
    color: var(--primary-color) !important;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

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

.product-image-container {
    height: 180px;
    background: #e2e8f0;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

.product-details {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-category {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--secondary-color);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.product-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.product-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.product-rating {
    color: #F59E0B;
}

.product-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.product-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Dashboard Metrics (Seller/Admin) */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.metric-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.icon-purple { background: rgba(108, 92, 231, 0.1); color: var(--primary-color); }
.icon-green { background: rgba(0, 184, 148, 0.1); color: var(--secondary-color); }
.icon-yellow { background: rgba(253, 203, 110, 0.1); color: #F39C12; }
.icon-blue { background: rgba(9, 132, 227, 0.1); color: #0984E3; }

.metric-info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.metric-info p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

/* Auth / Forms */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.box, .auth-container {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 500px;
}

.auth-container h2 {
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--dark);
    font-weight: 700;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--bg-color);
    transition: var(--transition);
}

.form-control:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

thead {
    background: var(--bg-color);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

tr:last-child td {
    border-bottom: none;
}

/* Footer */
footer {
    background: var(--white);
    border-top: 1px solid var(--border-color);
    padding: 4rem 5% 2rem;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    margin-bottom: 2rem;
}

.footer-column h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 1.5rem;
}

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

.footer-column ul li {
    margin-bottom: 0.75rem;
}

.footer-column ul li a {
    color: var(--text-muted);
}

.footer-column ul li a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    header { flex-direction: column; gap: 15px; }
    .search-container { margin: 10px 0; width: 100%; max-width: 100%; }
    nav { flex-wrap: wrap; justify-content: center; }
    .hero h1 { font-size: 2rem; }
    .hero-actions { flex-direction: column; }
    .categories-dropdown-menu { left: 50%; transform: translateX(-50%); min-width: 220px; }
}