/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1976d2;
    --primary-dark: #1565c0;
    --secondary-color: #ff6b6b;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #e0e0e0;
    --bg-gray: #f5f5f5;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-gray);
    line-height: 1.6;
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

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

/* ===== HEADER ===== */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 20px;
    color: var(--primary-color);
}

.logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
}

.search-bar {
    flex: 1;
    max-width: 600px;
}

.search-bar form {
    display: flex;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.search-bar form:focus-within {
    border-color: var(--primary-color);
}

.search-bar input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    outline: none;
    font-size: 15px;
}

.search-bar button {
    padding: 12px 24px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.search-bar button:hover {
    background: var(--primary-dark);
}

.nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.nav-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: all 0.3s;
    min-width: 70px;
}

.nav-icon:hover {
    background: var(--bg-gray);
    color: var(--primary-color);
}

.nav-icon i {
    font-size: 20px;
    margin-bottom: 4px;
}

.nav-label {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.nav-link:hover {
    background: var(--bg-gray);
    color: var(--primary-color);
}

.nav-link i {
    font-size: 18px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(25, 118, 210, 0.4);
}

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

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

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-post {
    min-width: 120px;
}

/* ===== USER MENU ===== */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.user-btn:hover {
    border-color: var(--primary-color);
}

.user-btn img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow-hover);
    min-width: 200px;
    padding: 8px 0;
}

.user-menu:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    transition: background 0.3s;
}

.dropdown-menu a:hover {
    background: var(--bg-gray);
}

.dropdown-menu hr {
    margin: 8px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* ===== CATEGORY BAR ===== */
.category-bar {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
}

.categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.categories::-webkit-scrollbar {
    display: none;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-gray);
    border-radius: 12px;
    white-space: nowrap;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
}

.category-item:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.category-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.category-item .icon {
    font-size: 18px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    min-height: calc(100vh - 400px);
    padding: 24px 0;
}

/* ===== PRODUCTS GRID ===== */
.products-section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.product-count {
    color: var(--text-secondary);
    font-size: 14px;
}

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

.product-card {
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: all 0.3s;
}

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

.product-image {
    position: relative;
    padding-top: 100%;
    background: var(--bg-gray);
    overflow: hidden;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--white);
}

.badge-new {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.favorite-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.favorite-btn:hover {
    transform: scale(1.1);
}

.favorite-btn i {
    font-size: 18px;
    color: var(--secondary-color);
}

.product-info {
    padding: 12px;
}

.product-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.product-price {
    font-size: 18px;
    font-weight: 800;
    color: var(--secondary-color);
    margin-bottom: 8px;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

.product-meta i {
    margin-right: 4px;
}

/* ===== AUTH PAGES ===== */
.auth-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: calc(100vh - 200px);
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-hover);
    margin: 40px auto;
    max-width: 1000px;
}

.auth-box {
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.auth-form {
    margin-bottom: 24px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.password-input {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.auth-divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    position: relative;
    background: var(--white);
    padding: 0 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.social-login {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-social {
    background: var(--white);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.btn-google:hover {
    border-color: #db4437;
    color: #db4437;
}

.btn-facebook:hover {
    border-color: #1877f2;
    color: #1877f2;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
}

.auth-footer a {
    color: var(--primary-color);
    font-weight: 600;
}

.auth-note {
    text-align: center;
    margin-top: 16px;
    padding: 12px;
    background: #e3f2fd;
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 14px;
}

.auth-side {
    position: relative;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.auth-side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
}

.auth-side-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--white);
}

.auth-side-content h2 {
    font-size: 36px;
    margin-bottom: 16px;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--white);
    border-top: 1px solid var(--border-color);
    padding: 48px 0 24px;
    margin-top: 48px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    margin-bottom: 32px;
}

.footer-section h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

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

.footer-section ul li {
    margin-bottom: 12px;
}

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

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

.social-links {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.social-links a {
    width: 40px;
    height: 40px;
    background: var(--bg-gray);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s;
}

.social-links a:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
}

.app-download h4 {
    font-size: 14px;
    margin-bottom: 12px;
}

.app-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--text-primary);
    color: var(--white);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s;
}

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

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== PRODUCT DETAIL ===== */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    background: var(--white);
    padding: 32px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 32px;
}

.product-gallery {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.main-image {
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--bg-gray);
}

.main-image img {
    width: 100%;
    height: 500px;
    object-fit: cover;
}

.thumbnail-images {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.thumbnail {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.thumbnail:hover,
.thumbnail.active {
    border-color: var(--primary-color);
}

.thumbnail img {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.product-detail-info {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.product-detail-title {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
}

.product-detail-price {
    font-size: 32px;
    font-weight: 800;
    color: var(--secondary-color);
}

.product-stats {
    display: flex;
    gap: 24px;
    padding: 16px;
    background: var(--bg-gray);
    border-radius: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.product-stats i {
    margin-right: 6px;
}

.product-description h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.product-description p {
    line-height: 1.8;
    color: var(--text-secondary);
}

.product-category {
    padding: 16px;
    background: var(--bg-gray);
    border-radius: 12px;
    font-size: 15px;
}

.seller-info {
    padding: 24px;
    background: var(--bg-gray);
    border-radius: 12px;
}

.seller-info h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.seller-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.seller-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

.seller-details h4 {
    font-size: 16px;
    margin-bottom: 4px;
}

.seller-details p {
    color: var(--text-secondary);
    font-size: 14px;
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.related-products {
    margin-top: 48px;
}

.related-products h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ===== LOAD MORE ===== */
.load-more {
    text-align: center;
    margin-top: 32px;
}

/* ===== BANNER AD ===== */
.banner-ad {
    margin: 24px 0;
    min-height: 100px;
    background: var(--bg-gray);
    border-radius: 12px;
    overflow: hidden;
}

/* ===== MOBILE MENU ===== */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .nav-label {
        display: none;
    }

    .nav-icon {
        min-width: auto;
        padding: 8px;
    }

    .user-name {
        display: none;
    }

    .btn span {
        display: none;
    }

    .btn {
        padding: 10px 16px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        gap: 12px;
    }

    .logo span {
        display: none;
    }

    .search-bar {
        order: 3;
        width: 100%;
        max-width: 100%;
    }

    .nav {
        gap: 8px;
    }

    .nav-icons {
        gap: 4px;
    }

    .nav-icon {
        padding: 6px;
    }

    .nav-icon i {
        font-size: 18px;
        margin-bottom: 0;
    }

    .btn-outline:first-of-type {
        display: none;
    }

    .category-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .categories {
        justify-content: flex-start;
        padding: 0 8px;
    }

    .category-item {
        flex-shrink: 0;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .product-detail {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .main-image img {
        height: 300px;
    }

    .auth-container {
        grid-template-columns: 1fr;
    }

    .auth-side {
        display: none;
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .header-content {
        padding: 8px 0;
    }

    .logo img {
        width: 32px;
        height: 32px;
        object-fit: contain;
    }

    .nav-icons {
        gap: 2px;
    }

    .nav-icon {
        padding: 4px 6px;
    }

    .nav-icon i {
        font-size: 16px;
    }

    .user-btn {
        padding: 4px 8px;
    }

    .user-btn img {
        width: 28px;
        height: 28px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    .product-detail-title {
        font-size: 22px;
    }

    .product-detail-price {
        font-size: 26px;
    }
}

