/* style.css - Modern Marketplace Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden {
    display: none !important;
}

.section {
    padding: 80px 0 0 0; /* Top padding accounts for fixed navbar */
    min-height: 100vh;
}

.section.active {
    display: block;
}

.page-header {
    text-align: center;
    margin-bottom: 50px;
    padding-top: 20px; /* Extra space after navbar */
}

.page-header h1, .page-header h2 {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.page-header p {
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    color: #7f8c8d;
    max-width: 600px;
    margin: 0 auto;
}

/* Navigation */
.navbar {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-brand {
    font-size: clamp(1.4rem, 4vw, 1.8rem);
    font-weight: 700;
    color: #3498db;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    order: 2;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
    transition: transform 0.3s ease;
    margin: 0;
}

.nav-link {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s ease;
    font-size: 1rem;
    white-space: nowrap;
}

.nav-link.active, .nav-link:hover {
    color: #3498db;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.search-bar {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.search-bar input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    width: 250px;
    max-width: 200px;
    font-size: 0.95rem;
    flex-shrink: 0;
}

#search-btn {
    padding: 10px 15px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#search-btn:hover {
    background: #2980b9;
}

/* Admin Login */
.admin-login {
    position: relative;
    flex-shrink: 0;
}

.login-toggle {
    background: none;
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    color: #333;
    transition: border-color 0.3s ease;
    white-space: nowrap;
    font-size: 0.9rem;
}

.login-toggle:hover {
    border-color: #3498db;
}

.login-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 1001;
}

.login-dropdown form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-dropdown input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
    font-size: 0.9rem;
}

.login-dropdown button {
    padding: 8px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

#logout-btn {
    background: #e74c3c;
    margin-top: 10px;
}

/* Hero Grid */
.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 50px;
    margin-bottom: 50px;
}

.hero-card-link {
    text-decoration: none;
    display: block;
}

.hero-card {
    background: white;
    padding: 40px 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hero-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.hero-card i {
    font-size: clamp(2rem, 6vw, 3rem);
    color: #3498db;
    margin-bottom: 20px;
    display: block;
}

.hero-card h3 {
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    margin-bottom: 10px;
    color: #2c3e50;
}

/* Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.item-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.item-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.item-card-content {
    padding: 20px;
}

.item-card h3 {
    font-size: clamp(1rem, 3vw, 1.2rem);
    margin-bottom: 10px;
    color: #2c3e50;
}

.item-card p.price {
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    font-weight: 700;
    color: #27ae60;
    margin-bottom: 10px;
}

.item-card p.desc {
    color: #7f8c8d;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
}

.item-card .category {
    font-size: 0.8rem;
    color: #3498db;
    text-transform: uppercase;
    font-weight: 600;
}

.order-btn {
    width: 100%;
    padding: 10px;
    background: #25d366;
    color: white;
    border: none;
    border-radius: 5px;
    margin-top: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}

.order-btn:hover {
    background: #128c7e;
}

/* Admin Panel */
.admin-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 40px;
    margin-top: 40px;
}

.admin-chart, .admin-report, .admin-form, .admin-list {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.admin-chart h3, .admin-report h3, .admin-form h3, .admin-list h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.3rem;
}

#sales-chart {
    max-height: 300px;
}

#sales-table {
    width: 100%;
    border-collapse: collapse;
    overflow-x: auto;
    display: block;
}

#sales-table th, #sales-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
    min-width: 100px;
    white-space: nowrap;
}

#sales-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.admin-form {
    grid-column: 1 / -1; /* Full width for add form at top */
}

.admin-form input, .admin-form select, .admin-form textarea, .admin-form input[type="file"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
    font-size: 1rem;
}

.admin-form textarea {
    height: 100px;
    resize: vertical;
}

.admin-form button {
    width: 100%;
    padding: 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    font-size: 1rem;
}

.admin-form button:hover {
    background: #2980b9;
}

.admin-list {
    max-height: 500px;
    overflow-y: auto;
}

.admin-list ul {
    list-style: none;
}

.admin-list li {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-list li:last-child {
    border-bottom: none;
}

.admin-list li span {
    flex: 1;
    min-width: 200px;
}

.admin-list li button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
}

.admin-list li button:hover {
    background: #c0392b;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

.modal-item-img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 20px;
}

.modal-content h3 {
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 1.5rem;
}

.modal-content p {
    margin-bottom: 10px;
    color: #7f8c8d;
    font-size: 1rem;
}

.btn-primary {
    padding: 12px 30px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
    font-size: 1rem;
}

.btn-primary:hover {
    background: #2980b9;
}

/* WhatsApp Floating Button */
.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 40px;
    right: 40px;
    background-color: #25d366;
    color: #fff;
    border-radius: 50px;
    text-align: center;
    font-size: 30px;
    box-shadow: 2px 2px 3px #999;
    z-index: 100;
    animation: whatsapp-bounce 2s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    background-color: #128c7e;
}

.whatsapp-float i {
    color: white;
}

@keyframes whatsapp-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        padding: 0 15px;
    }

    .nav-menu {
        gap: 20px;
    }

    .search-bar input {
        width: 180px;
    }

    .section {
        padding-top: 90px; /* Adjust for navbar height */
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
        order: 99;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 20px 0;
        gap: 0;
        z-index: 999;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        margin: 10px 0;
    }

    .nav-link {
        font-size: 1.1rem;
    }

    .nav-container {
        flex-wrap: wrap;
        gap: 5px;
    }

    .nav-left {
        order: 1;
        width: 100%;
        justify-content: space-between;
        align-items: center;
    }

    .nav-brand {
        flex-shrink: 0;
    }

    .nav-right {
        order: 2;
        width: 100%;
        justify-content: center;
        margin-top: 10px;
        gap: 15px;
        flex-direction: row; /* Keep row but center */
    }

    .search-bar {
        order: 1;
        width: 60%;
        justify-content: center;
    }

    .search-bar input {
        width: 140px;
        max-width: 140px;
    }

    .admin-login {
        order: 2;
        width: 35%;
        text-align: center;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 30px;
    }

    .items-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .admin-panel {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .login-dropdown {
        right: 50%;
        transform: translateX(50%);
        min-width: 250px;
    }

    .section {
        padding-top: 100px; /* Increased for better spacing under navbar */
    }

    .page-header {
        margin-bottom: 30px;
        padding-top: 10px;
    }

    #sales-table {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .section {
        padding-top: 110px; /* Further adjustment for small screens */
    }

    .page-header h1, .page-header h2 {
        font-size: 2rem;
    }

    .page-header p {
        font-size: 1rem;
    }

    .hero-card {
        padding: 30px 15px;
    }

    .item-card-content {
        padding: 15px;
    }

    .item-card img {
        height: 180px;
    }

    .admin-form, .admin-chart, .admin-report, .admin-list {
        padding: 20px;
    }

    .admin-form input, .admin-form select, .admin-form textarea {
        padding: 10px;
        font-size: 0.95rem;
    }

    .modal-content {
        padding: 20px;
        margin: 10px;
    }

    .modal-item-img {
        max-height: 250px;
    }

    .whatsapp-float {
        width: 50px;
        height: 50px;
        font-size: 25px;
        bottom: 20px;
        right: 20px;
    }

    #sales-table th, #sales-table td {
        padding: 8px 5px;
        font-size: 0.85rem;
    }

    .nav-right {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }

    .search-bar {
        width: 100%;
        order: 1;
    }

    .search-bar input {
        width: 100%;
        max-width: none;
    }

    .admin-login {
        width: 100%;
        order: 2;
        text-align: center;
    }
}

/* Additional for very small screens */
@media (max-width: 320px) {
    .search-bar input {
        width: 100%;
    }

    .login-dropdown {
        min-width: 220px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }

    .nav-right {
        gap: 5px;
    }

    .search-bar input {
        padding: 8px 12px;
    }
}