/* style.css */

/* Custom Properties (CSS Variables) for Theming */
:root {
    --primary-color: #00B09B; /* A vibrant green for accents */
    --secondary-color: #334155; /* Darker tone for text/elements */
    --text-color: #333;
    --background-color: #fff;
    --card-background: #f9f9f9;
    --border-color: #e0e0e0;
    --placeholder-color: #ccc; /* For skeleton loading */
    --hover-bg-color: #e6e6e6; /* Light gray for subtle hover */
    --shadow-color: rgba(0, 0, 0, 0.08);
}

/* Dark Mode Preference */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #00CC99; /* Slightly brighter green for dark mode */
        --secondary-color: #cbd5e1; /* Lighter text for dark mode */
        --text-color: #e2e8f0;
        --background-color: #1a202c;
        --card-background: #2d3748;
        --border-color: #4a5568;
        --placeholder-color: #4a5568; /* For skeleton loading */
        --hover-bg-color: #4a5568;
        --shadow-color: rgba(0, 0, 0, 0.3);
    }
}

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

body {
    font-family: 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    color: var(--text-color);
    background-color: var(--background-color);
    line-height: 1.6;
    margin: 0;
    padding-top: 80px; /* Space for fixed navbar */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    text-decoration: underline;
}

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

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

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Navbar */
.navbar {
    width: 100%;
    background-color: var(--background-color);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.navbar-actions .btn {
    background-color: var(--primary-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: none;
    cursor: pointer;
}

.navbar-actions .btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.navbar-logo {
    height: 60px;
    vertical-align: middle;
}

/* Main Content Area */
main {
    flex: 1; /* Allows main content to grow and push footer down */
    padding: 40px 0;
}

/* Footer */
.footer {
    background-color: var(--card-background);
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
    margin-top: 60px;
    color: var(--secondary-color);
    font-size: 14px;
}

.footer .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.footer-section h4 {
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 15px;
}

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

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

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

.footer-section ul li a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.social-links a {
    color: var(--primary-color);
    font-size: 24px;
    transition: transform 0.2s ease;
}

.social-links a:hover {
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Homepage Specific Styles (index.html) */
.hero {
    text-align: center;
    padding: 60px 20px;
    background-color: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 40px;
}

.hero h1 {
    font-size: 3em;
    color: var(--text-color);
    margin-bottom: 15px;
}

.hero p {
    font-size: 1.2em;
    color: var(--secondary-color);
    max-width: 700px;
    margin: 0 auto;
}

.search-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 40px;
    justify-content: center;
    align-items: stretch; /* Ensure inputs/selects have similar height */
}

.search-controls input[type="text"],
.search-controls select {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 1em;
    width: 250px; /* Default width for controls */
    min-width: 150px; /* Minimum width for responsiveness */
    flex-grow: 1;
    max-width: 300px;
}

.search-controls input[type="text"]::placeholder {
    color: var(--secondary-color);
    opacity: 0.7;
}

.search-controls select {
    appearance: none; /* Remove default arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    cursor: pointer;
}

@media (prefers-color-scheme: dark) {
    .search-controls select {
        background-image: url('data:image/svg+xml;utf8,<svg fill="%23e2e8f0" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
    }
}


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

.product-card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--placeholder-color); /* For missing images */
    border-bottom: 1px solid var(--border-color);
}

.product-card-content {
    padding: 15px;
    flex-grow: 1; /* Allow content to push down footer if image is short */
    display: flex;
    flex-direction: column;
}

.product-card h3 {
    font-size: 1.3em;
    color: var(--text-color);
    margin-bottom: 10px;
    flex-grow: 1; /* Allow title to take up space */
}

.product-card p {
    font-size: 0.95em;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.product-card .price {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 10px;
}

.product-card .category {
    font-size: 0.85em;
    background-color: rgba(0, 176, 155, 0.1);
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 4px;
    align-self: flex-start;
    margin-bottom: 8px;
}

.no-results {
    text-align: center;
    padding: 50px 20px;
    font-size: 1.2em;
    color: var(--secondary-color);
}

/* Skeleton Loading Styles */
.skeleton-card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px var(--shadow-color);
    display: flex;
    flex-direction: column;
    animation: pulse 1.5s infinite ease-in-out;
}

.skeleton-card-image {
    width: 100%;
    height: 200px;
    background-color: var(--placeholder-color);
    border-bottom: 1px solid var(--border-color);
}

.skeleton-card-content {
    padding: 15px;
}

.skeleton-line {
    height: 18px;
    background-color: var(--placeholder-color);
    border-radius: 4px;
    margin-bottom: 10px;
}

.skeleton-line.title {
    width: 80%;
}

.skeleton-line.text {
    width: 60%;
    height: 15px;
}

.skeleton-line.price {
    width: 40%;
    height: 20px;
}

@keyframes pulse {
    0% {
        background-color: var(--card-background);
    }
    50% {
        background-color: rgba(var(--placeholder-color), 0.5); /* Semi-transparent for pulse effect */
    }
    100% {
        background-color: var(--card-background);
    }
}


/* Detail Page Styles (detail.html) */
.product-detail-container {
    display: flex;
    gap: 40px;
    padding: 40px 0;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.product-detail-image {
    flex: 2;
    min-width: 400px;
    max-width: 60%;
}

.product-detail-image img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.product-detail-info {
    flex: 1;
    min-width: 300px;
}

.product-detail-info .category {
    font-size: 0.9em;
    background-color: rgba(0, 176, 155, 0.1);
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
    margin-bottom: 10px;
}

.product-detail-info h1 {
    font-size: 2.5em;
    color: var(--text-color);
    margin-bottom: 15px;
}

.product-detail-info .price {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.product-detail-info p {
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.product-detail-info .btn-chat {
    background-color: var(--primary-color);
    color: #fff;
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    margin-top: 20px;
    display: inline-block;
}

.product-detail-info .btn-chat:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.dummy-chat-section {
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
}

.dummy-chat-section h2 {
    font-size: 1.8em;
    color: var(--text-color);
    margin-bottom: 20px;
}

.chat-bubble {
    background-color: var(--card-background);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    max-width: 70%;
    box-shadow: 0 2px 4px var(--shadow-color);
    line-height: 1.5;
}

.chat-bubble.sent {
    margin-left: auto;
    background-color: var(--primary-color);
    color: #fff;
    border-bottom-right-radius: 0;
}

.chat-bubble.received {
    margin-right: auto;
    background-color: var(--hover-bg-color);
    color: var(--text-color);
    border-bottom-left-radius: 0;
}

.chat-bubble .sender {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}

/* Legal Pages (tentang.html, privacy.html, terms.html) & Jual.html */
.static-page-content {
    padding: 40px 0;
}

.static-page-content h1 {
    font-size: 2.5em;
    color: var(--text-color);
    margin-bottom: 25px;
    text-align: center;
}

.static-page-content h2 {
    font-size: 1.8em;
    color: var(--primary-color);
    margin-top: 30px;
    margin-bottom: 15px;
}

.static-page-content p,
.static-page-content ul {
    font-size: 1.1em;
    color: var(--secondary-color);
    margin-bottom: 15px;
    line-height: 1.8;
}

.static-page-content ul {
    padding-left: 25px;
    list-style-type: disc;
}

.static-page-content li {
    margin-bottom: 8px;
}

/* Jual Barang Form (jual.html) */
.sell-form-container {
    max-width: 700px;
    margin: 40px auto;
    padding: 30px;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.sell-form-container h1 {
    text-align: center;
    margin-bottom: 30px;
}

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

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

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 176, 155, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    cursor: pointer;
}

@media (prefers-color-scheme: dark) {
    .form-group select {
        background-image: url('data:image/svg+xml;utf8,<svg fill="%23e2e8f0" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
    }
}

.btn-submit {
    width: 100%;
    background-color: var(--primary-color);
    color: #fff;
    padding: 15px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 1.1em;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-submit:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 24px;
    }

    .hero h1 {
        font-size: 2.5em;
    }

    .hero p {
        font-size: 1em;
    }

    .search-controls {
        flex-direction: column;
        align-items: center;
    }

    .search-controls input[type="text"],
    .search-controls select {
        width: 100%;
        max-width: 400px;
    }

    .product-detail-container {
        flex-direction: column;
        align-items: center;
    }

    .product-detail-image,
    .product-detail-info {
        min-width: unset;
        max-width: 100%;
        width: 100%;
    }

    .product-detail-image img {
        max-height: 400px;
    }
    
    .footer .container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-section ul {
        padding: 0;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .navbar-brand {
        font-size: 20px;
    }

    .navbar-actions .btn {
        padding: 8px 15px;
        font-size: 0.9em;
    }

    .hero h1 {
        font-size: 2em;
    }
}