/* CSS Version: 1.0.5 */

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

/* Variables */
:root {
    --primary: #000;
    --secondary: #34495e;
    --accent: #e74c3c;
    --text: #2c3e50;
    --bg: #fff;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --filter-width: 180px;
    --container-width: 1400px;
    --text-color: #2c3e50;
    --text-color-light: #95a5a6;
    --primary-color: #6c757d;
    --secondary-color: #f1c40f;
}

/* Base */
body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Contact page specific layout */
.contact-page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.contact-page-wrapper .container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Layout */
/* Header */
.header {
    background: var(--primary);
    padding: var(--spacing-md) 0;
    margin-bottom: var(--spacing-lg);
}

.header .container {
    display: flex;
    justify-content: center;
}

nav {
    display: flex;
    gap: var(--spacing-md);
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 4px;
}

.nav-link:hover {
    background: var(--secondary);
}

/* Home Layout */
.home-layout {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-lg) var(--spacing-md);
}

.home-content {
    width: 100%;
    max-width: var(--container-width);
    display: flex;
    gap: var(--spacing-lg);
    min-width: 0; /* Fix for Safari flexbox */
}

/* Filter Column */
.filter-column {
    width: var(--filter-width);
    flex-shrink: 0;
    padding: var(--spacing-md);
    height: fit-content;
    position: sticky;
    top: var(--spacing-lg);
}

.filter-column h2 {
    font-size: 1rem;
    font-weight: normal;
    color: var(--text);
    margin-bottom: var(--spacing-md);
    text-transform: none;
}

.filter-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--spacing-lg) 0;
}

.filter-list li {
    margin-bottom: 2px;
}

.filter-link {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text);
    text-decoration: none;
    border-radius: 4px;
    font-weight: normal;
    transition: background-color 0.2s ease;
}

.filter-link:hover {
    background-color: #f5f5f5;
}

.filter-link.active {
    background-color: #f0f0f0;
    font-weight: normal;
}

.filter-options {
    margin-top: calc(var(--spacing-lg) / 2);
    border-top: 1px solid #eee;
    padding-top: calc(var(--spacing-lg) / 2);
}

.filter-checkbox {
    margin-bottom: var(--spacing-sm);
    white-space: nowrap;
}

.filter-checkbox label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 4px;
    transition: background-color 0.2s ease;
    cursor: pointer;
    width: var(--filter-width);
    box-sizing: border-box;
}

.filter-checkbox label:hover {
    background-color: #f5f5f5;
}

.filter-checkbox input[type="checkbox"] {
    margin: 0;
}

.filter-checkbox span {
    color: var(--text);
    font-weight: normal;
}

/* Items Grid */
.items-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-md);
    min-width: 0; /* Fix for Safari flexbox */
}

.item {
    position: relative;
    background: white;
}

/* Create square aspect ratio */
.item::before {
    content: '';
    display: block;
    padding-top: 100%;
}

.item-link {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.item-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Contact page styles */
.contact-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.contact-info {
    padding: 2rem;
}

.contact-info h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.contact-info p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-color-light);
    margin-bottom: 2rem;
}

.contact-details {
    display: grid;
    gap: 2rem;
    margin-top: 2rem;
}

.contact-detail h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.contact-detail p {
    font-size: 1rem;
    color: var(--text-color-light);
}

/* Product inquiry on contact page */
.product-inquiry-image {
    margin: 1.5rem 0;
    width: 100%;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.product-inquiry-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Contact form styles */
.contact-form-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    max-width: 600px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.form-input {
    padding: var(--spacing-sm);
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

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

.form-input:invalid {
    border-color: var(--accent);
}

.error-message {
    color: var(--accent);
    font-size: 0.875rem;
    min-height: 1.25rem;
}

.submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.submit-button:hover:not(:disabled) {
    opacity: 0.9;
}

.submit-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Success Message */
.contact-success {
    text-align: center;
    padding: var(--spacing-lg);
}

.success-icon {
    font-size: 3rem;
    color: #2ecc71;
    margin-bottom: var(--spacing-md);
}

.contact-success h3 {
    margin-bottom: var(--spacing-sm);
    color: var(--text);
}

.contact-success p {
    margin-bottom: var(--spacing-lg);
    color: var(--text-color-light);
}

/* Admin Login Page Styles */
.admin-login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-login-container h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
}

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

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Include padding and border in element's total width and height */
}

.login-form .submit-button {
    width: 100%;
    padding: 12px;
    background-color: #5cb85c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.login-form .submit-button:hover {
    background-color: #4cae4c;
}

.admin-login-container .error-message {
    color: #d9534f; /* Bootstrap danger color */
    background-color: #f2dede;
    border: 1px solid #ebccd1;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

/* Product Detail Page Styles */
.product-detail-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .product-detail-container {
        flex-direction: row;
        align-items: flex-start;
    }
}

/* Gallery Styles */
.product-gallery {
    flex: 1;
    max-width: 100%;
    position: relative;
}

@media (min-width: 768px) {
    .product-gallery {
        position: sticky;
        top: 2rem;
        max-width: 50%;
    }
}

.main-image-container {
    width: 100%;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: zoom-in;
    position: relative;
}

.main-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.image-thumbnails {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    position: relative;
}

.thumbnail-item {
    width: 80px;
    height: 80px;
    border-radius: 0.25rem;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.thumbnail-item:hover {
    border-color: #5a7d7c;
}

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

.no-image {
    width: 100%;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    border-radius: 0.5rem;
}

/* Product Info Styles */
.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.product-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}

.product-price-availability {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
}

.product-sold {
    background-color: #e53e3e;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.product-available {
    background-color: #38a169;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.product-description {
    color: #4a5568;
    line-height: 1.6;
}

.product-details h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    color: #2d3748;
}

.product-details ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.product-details li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
}

.product-details li:last-child {
    border-bottom: none;
}

.second-quality {
    color: #dd6b20;
    font-weight: 500;
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

@media (min-width: 640px) {
    .product-actions {
        flex-direction: row;
    }
}

.inquiry-button {
    display: inline-block;
    background-color: #5a7d7c;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.25rem;
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    transition: background-color 0.2s ease;
    flex: 1;
}

.inquiry-button:hover {
    background-color: #4a6665;
}

.back-button {
    display: inline-block;
    background-color: #e2e8f0;
    color: #2d3748;
    padding: 0.75rem 1.5rem;
    border-radius: 0.25rem;
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    transition: background-color 0.2s ease;
    flex: 1;
}

.back-button:hover {
    background-color: #cbd5e0;
}

/* Footer */
.footer {
    background: var(--bg);
    color: var(--text);
    text-align: center;
    padding: var(--spacing-md) 0;
    margin-top: var(--spacing-lg);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1400px) {
    .item {
        width: calc(33.333% - 20px);
    }
}

@media (max-width: 1100px) {
    .item {
        width: calc(50% - 20px);
    }
}

@media (max-width: 600px) {
    .filter-column {
        width: 100%;
        margin-bottom: var(--spacing-lg);
    }
    .items-grid {
        padding-left: 0;
    }
    .item {
        width: calc(100% - 20px);
    }
}

/* Modal Image Viewer */
.image-modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: hidden;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    margin: auto;
    display: flex;
    align-items: center;
}

.modal-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

#modal-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.close-button {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 110;
}

.close-button:hover,
.close-button:focus {
    color: #999;
    text-decoration: none;
}

.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-button:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.prev-button {
    left: -80px;
}

.next-button {
    right: -80px;
}

@media (max-width: 768px) {
    .prev-button {
        left: 5px;
    }

    .next-button {
        right: 5px;
    }
    
    .nav-button {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}
