/* CSS Reset and Base Styles */
.skeleton {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.image-placeholder {
  width: 100%;
  height: 200px;
  background: #eee;
  animation: pulse 1.5s infinite;
}
.button-group-row {
    display: flex;
    justify-content: center;
    gap: 10px; /* Adds space between the buttons */
    padding: 0 1rem;
}

.add-to-cart-btn {
    white-space: nowrap;
    background: var(--secondary-color); /* A different color to distinguish it */
}

.add-to-cart-btn:hover {
    background: #1a2530;
}
.text-placeholder {
  height: 16px;
  margin: 10px;
  background: #eee;
  border-radius: 4px;
  animation: pulse 1.5s infinite;
}
/* --- Cart Icon --- */
.cart-icon {
    position: relative;
}
#cart-count {
    position: absolute;
    top: -5px;
    right: -10px;
    background: var(--danger);
    color: var(--white);
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: bold;
}

/* --- Cart Sidebar --- */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 350px;
    height: 100%;
    background: var(--white);
    box-shadow: -5px 0 15px rgba(0,0,0,0.2);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}
.cart-sidebar.open {
    transform: translateX(0);
}
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out;
}
.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}
.cart-header h2 { color: var(--secondary-color); }
.close-cart-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #888;
}
.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
}
.cart-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}
.cart-item img {
    width: 70px;
    height: 70px;
    object-fit: cover;
}
.cart-item-info { flex-grow: 1; }
.cart-item-info h4 { font-size: 1rem; margin-bottom: 0.25rem; }
.cart-item-info p { font-size: 0.9rem; color: #666; }
.remove-item-btn {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 0.8rem;
    cursor: pointer;
}
.cart-footer {
    padding: 1rem;
    border-top: 1px solid #eee;
}
.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}
.checkout-btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background: var(--success);
    color: var(--white);
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
}
/* --- Cart Quantity Controls --- */
.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.quantity-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-weight: bold;
}
.quantity-btn:hover {
    background: #e0e0e0;
}
/* --- Improved Image Placeholder --- */
.product-image-container {
    width: 100%;
    height: 300px;
    background: #eee;
    animation: pulse 1.5s infinite;
}

.product-image-container .product-image {
    /* Ensure the image covers the container */
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cart-empty {
    text-align: center;
    color: #888;
    margin-top: 2rem;
}
.text-placeholder.short {
  width: 40%;
}

.text-placeholder.long {
  width: 70%;
}

@keyframes pulse {
  0% { background-color: #eee; }
  50% { background-color: #ddd; }
  100% { background-color: #eee; }
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #d4af37;
    --secondary-color: #2c3e50;
    --text-color: #333;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --danger: #dc3545;
    --success: #28a745;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Georgia', serif;
    line-height: 1.6;
    color: var(--text-color);
}

/* Navigation */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: normal;
    letter-spacing: 2px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
    font-size: 0.95rem;
    letter-spacing: 1px;
}

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

.admin-link {
    color: var(--secondary-color) !important;
    font-weight: bold;
}

/* Hero Section */
.hero {
    background: linear-gradient(rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0.1)),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%23d4af37" fill-opacity="0.1" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,112C672,96,768,96,864,112C960,128,1056,160,1152,160C1248,160,1344,128,1392,112L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>');
    background-size: cover;
    background-position: center;
    padding: 8rem 2rem;
    text-align: center;
}

.hero-content h2 {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-weight: normal;
}

.hero-content p {
    font-size: 1.2rem;
    color: #666;
    letter-spacing: 1px;
}

/* Container and Sections */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 3rem;
    font-weight: normal;
    letter-spacing: 2px;
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1.5rem;
    background: var(--white);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    letter-spacing: 1px;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary-color);
    color: var(--white);
}

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

.product-card {
    background: var(--white);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.product-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.product-info {
    padding: 1.5rem;
}

.product-category {
    color: var(--primary-color);
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.product-name {
    font-size: 1.3rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.product-description {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

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

.product-badge {
    display: inline-block;
    background: var(--success);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    margin-left: 1rem;
}

.product-unavailable {
    opacity: 0.6;
}

.unavailable-badge {
    background: var(--danger);
}

/* Contact Section */
.contact {
    background: var(--light-bg);
    padding: 4rem 2rem;
    text-align: center;
}

.contact-info {
    margin-top: 2rem;
    font-size: 1.1rem;
}

.contact-info p {
    margin: 0.5rem 0;
}

/* Footer */
.footer {
    background: var(--secondary-color);
    color: var(--white);
    text-align: center;
    padding: 2rem;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--primary-color);
    font-size: 1.2rem;
}

/* Login Container */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--light-bg) 0%, var(--white) 100%);
}

.login-box {
    background: var(--white);
    padding: 3rem;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    color: var(--secondary-color);
    margin-bottom: 2rem;
    text-align: center;
    font-size: 2rem;
}

.login-box input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    font-family: inherit;
}

.login-box button {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
    letter-spacing: 1px;
}

.login-box button:hover {
    background: #b8941f;
}

.error-message {
    color: var(--danger);
    margin-top: 1rem;
    text-align: center;
}

/* Admin Dashboard */
.admin-dashboard {
    min-height: 100vh;
    background: var(--light-bg);
}

.admin-nav {
    background: var(--secondary-color);
}

.admin-nav .logo,
.admin-nav h1 {
    color: var(--white);
}

.admin-nav .nav-links a,
.admin-nav .nav-links button {
    color: var(--white);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
}

.admin-nav .nav-links button:hover {
    text-decoration: underline;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.admin-section {
    background: var(--white);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.admin-section h2 {
    color: var(--secondary-color);
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

/* Product Form */
.product-form {
    max-width: 600px;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

#image-preview {
    margin-top: 1rem;
}

#image-preview img {
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
}

.button-group {
    display: flex;
    gap: 1rem;
}

.button-group button {
    padding: 0.75rem 2rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.button-group button[type="submit"] {
    background: var(--primary-color);
    color: var(--white);
}

.button-group button[type="submit"]:hover {
    background: #b8941f;
}

.button-group button[type="button"] {
    background: #6c757d;
    color: var(--white);
}

.button-group button[type="button"]:hover {
    background: #5a6268;
}

/* Stats Cards */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--light-bg);
    padding: 1.5rem;
    text-align: center;
    border-left: 4px solid var(--primary-color);
}

.stat-card h3 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-card p {
    color: #666;
    font-size: 0.9rem;
}

/* Admin Products List */
.admin-products-list {
    display: grid;
    gap: 1rem;
}

.admin-product-item {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: 1rem;
    padding: 1rem;
    background: var(--light-bg);
    align-items: center;
}

.admin-product-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    background: #e0e0e0;
}

.admin-product-info h3 {
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}

.admin-product-info p {
    color: #666;
    font-size: 0.9rem;
}

.admin-product-actions {
    display: flex;
    gap: 0.5rem;
}

.admin-product-actions button {
    padding: 0.5rem 1rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

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

.edit-btn:hover {
    background: #b8941f;
}

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

.delete-btn:hover {
    background: #c82333;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .admin-product-item {
        grid-template-columns: 80px 1fr;
    }
    
    .admin-product-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
}
/* Add to your styles.css file */

/* --- Loading Spinner --- */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner::after {
    content: '';
    width: 50px;
    height: 50px;
    border: 5px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* --- Product Phone Number Button --- */
.product-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}
.error-message {
    text-align: center;
    color: #ff4d4d; /* A clear, visible red color */
    font-size: 1.2rem;
    padding: 2rem;
    margin: 2rem auto;
    background-color: #ffe6e6;
    border: 1px solid #ffcccc;
    border-radius: 8px;
}
.buy-button {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    text-align: center;
    transition: var(--transition);
    border: none;
    font-family: sans-serif;
    cursor: pointer;
    margin-bottom:30px;
    font-size:1rem;
}

.buy-button:hover {
    background: #b8941f;
}

/* For mobile devices, adjust the buy button */
@media (max-width: 768px) {
    .buy-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}
/* Mobile Responsive Adjustments */
@media (max-width: 992px) {
  .nav-container {
    padding: 1rem;
  }
  
  .nav-links {
    gap: 1.2rem;
  }
  
  .nav-links a {
    font-size: 0.9rem;
  }
  
  .logo {
    font-size: 1.5rem;
  }
  
  .logo img {
    height: 35px;
  }
}

@media (max-width: 768px) {
  .nav-container {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    padding: 0.8rem;
  }
  
  .logo {
    font-size: 1.4rem;
    text-align: center;
  }
  
  .nav-links {
    width: 100%;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
  }
  
  .nav-links a {
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
  }
  
  .hero {
    padding: 5rem 1rem;
  }
  
  .hero-content h2 {
    font-size: 2rem;
  }
  
  .filter-buttons {
    gap: 0.5rem;
  }
  
  .filter-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    min-width: 120px;
  }
  
  .cart-sidebar {
    max-width: 85%;
  }
  
  .section-title {
    font-size: 2rem;
  }
}

@media (max-width: 576px) {
  .nav-links {
    gap: 0.5rem;
  }
  
  .nav-links a {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
  }
  
  .logo {
    font-size: 1.3rem;
  }
  
  .logo img {
    height: 30px;
    margin-right: 5px;
  }
  
  .hero-content h2 {
    font-size: 1.7rem;
  }
  
  .hero-content p {
    font-size: 1rem;
  }
  
  .filter-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .filter-btn {
    min-width: 110px;
    padding: 0.5rem 0.8rem;
    margin: 0.2rem;
  }
  
  .products-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .cart-sidebar {
    max-width: 100%;
  }
  
  .container {
    padding: 1.5rem 1rem;
  }
  
  .button-group-row {
    flex-direction: row;
    align-items: center;
  }
  
  .buy-button {
    width: 100%;
    text-align: center;
    margin-top: 0.5rem;
  }
}

@media (max-width: 400px) {
  .nav-links a {
    font-size: 0.75rem;
    padding: 0.25rem 0.4rem;
  }
  
  .logo {
    font-size: 1.2rem;
  }
  
  .filter-btn {
    min-width: 100px;
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
  }
  
  .hero-content h2 {
    font-size: 1.5rem;
  }
}
