/* General Styles */
body {
    font-family: 'Roboto', sans-serif;
    color: #553c1f;
    background-color: #F8F0E3; /* Existing background */
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative; /* Needed for absolute positioning of logout button */
}

.container {
    width: 80%;
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 0; /* Keep at 0 unless needed for other content */
}

h1,
h2,
h3,
h4 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
}

h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    text-align: center; /* Default center for H2 */
}

h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

p {
    line-height: 1.6;
}

.btn {
    display: inline-block;
    /* MODIFIED: Changed default button background to green */
    background-color: #79a752; /* Green */
    color: #fff;
    padding: 0.8rem 1.8rem;
    border-radius: 6px; /* Slightly more rounded */
    text-decoration: none;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.1s ease; /* Added transitions */
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500; /* Slightly bolder */
    line-height: normal;
    margin: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); /* Subtle shadow */
    vertical-align: middle; /* Align buttons nicely if inline */
}

.btn:hover {
   /* MODIFIED: Darker green on hover */
   background-color: #638e3f; /* Darker Green */
   box-shadow: 0 2px 5px rgba(0,0,0,0.15); /* Enhance shadow */
}

.btn:active {
    transform: translateY(1px); /* Add press effect */
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Primary button style (e.g., Save) */
.btn-save-product {
     background-color: #79a752; /* Green */
     /* Inherits .btn styles */
}
.btn-save-product:hover {
     background-color: #638e3f; /* Darker Green */
}

/* Secondary button style (USED FOR LOGOUT ICON BUTTON NOW) */
/* .btn-secondary removed as it's replaced by btn-icon-logout */


img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Navigation - (Keep existing styles) */
nav {
    background-color: #fff;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 700;
    text-decoration: none;
    color: #553c1f;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    float: right;
}

nav ul li {
    display: inline-block;
    margin-left: 2rem;
}

nav ul li a {
    text-decoration: none;
    color: #553c1f;
    transition: color 0.3s ease;
}

nav ul li a:hover {
    color: #BCA5A5;
}

.order-now {
    /* MODIFIED: Order Now button inherits .btn styling (green) */
    /* Kept specific padding if needed, otherwise remove */
    padding: 0.5rem 1rem;
    /* background-color: #D2B48C; */ /* Removed old tan */
    /* color: #fff; */ /* Inherited */
    /* border-radius: 5px; */ /* Inherited */
}

.order-now:hover {
    /* Inherits .btn:hover */
    /* background-color: #BCA5A5; */ /* Removed old mauve hover */
}


#cart-link { /* Keep existing cart styles */
    position: relative;
}
#cart-link[data-count]::after {
    content: attr(data-count);
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: red;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.8rem;
    display: none;
}
#cart-link.has-items::after {
    display: block;
}

/* Hero, About, Featured, Testimonials, Menu, Contact, Cart, Success, Footer */
/* --- (Keep existing styles for non-admin sections) --- */

/* Hero Section */
.hero { background-image: url('images/dlicious bakes banner.png'); background-size: cover; background-position: center; color: #fff; text-align: center; padding: 8rem 0; }
.hero-content { background-color: rgba(0, 0, 0, 0.4); padding: 2rem; border-radius: 10px; }
/* About Snippet */
.about-snippet { margin: 4rem 0; margin-left: 150px; display: flex; align-items: center; gap: 2rem; justify-content: center; }
.about-content { display: flex; gap: 2rem; align-items: center; }
.about-content img { border-radius: 10px; flex: 1; max-width: 50%; }
.about-content p { flex: 1; }
/* Featured Items */
.featured-items { background-color: #fff; padding: 4rem 0; text-align: center; }
.carousel { display: flex; overflow-x: auto; gap: 1rem; padding: 1rem; }
.carousel .item { min-width: 250px; text-align: center; border-radius: 10px; overflow: hidden; background-color: #F8F0E3; box-shadow: 0 2px 5px rgba(0,0,0,0.1); padding-bottom: 1rem; display: flex; flex-direction: column; }
.carousel .item img { border-radius: 10px 10px 0 0; margin-bottom: 1rem; width: 100%; object-fit: cover; height: 180px; }
.carousel .item h3 { font-size: 1.2rem; margin-top: 0; flex-grow: 1; padding: 0 0.5rem; }
/* Testimonials */
.testimonials { margin: 4rem 0; }
.testimonial { background-color: #f2e8dc; padding: 2rem; margin-bottom: 1.5rem; border-radius: 10px; }
/* Section Base */
section { flex-grow: 1; margin-bottom: 4rem; }
/* Menu Tabs */
.menu-tabs { display: flex; justify-content: center; margin-bottom: 2rem; }
.menu-tab { background-color: #D2B48C; color: #fff; border: none; padding: 0.8rem 1.5rem; cursor: pointer; transition: background-color 0.3s ease; border-radius: 5px 5px 0 0; margin-right: 2px; }
.menu-tab:hover { background-color: #BCA5A5; }
.menu-tab.active { background-color: #553c1f; }
.menu-content { background-color: #fff; padding: 2rem; border-radius: 0 5px 5px 5px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); }
/* Menu Items Grid */
.menu-items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.menu-item { background-color: #F8F0E3; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; padding: 0; }
.menu-item img { width: 100%; height: 200px; object-fit: cover; object-position: center; border-radius: 10px 10px 0 0; margin-bottom: 0; }
.item-info { display: flex; flex-direction: column; flex-grow: 1; padding: 1rem; }
.item-info h4 { margin-bottom: 0.5rem; display: flex; justify-content: space-between; align-items: flex-start; }
.item-info .out-of-stock { font-size: 0.8rem; color: red; font-weight: bold; white-space: nowrap; margin-left: 0.5em; }
.item-info .new-label { font-size: 0.8rem; color: green; font-weight: bold; white-space: nowrap; margin-left: 0.5em; }
.item-info p { font-size: 0.9rem; margin-bottom: 0.5rem; flex-grow: 1; }
.price-add-to-cart { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.price { font-weight: bold; font-size: 1rem; white-space: nowrap; }
.calories { font-size: 0.9rem; color: #777; }
.add-to-cart { background-color: #79a752; color: #fff; border: none; padding: 0.5rem 1rem; border-radius: 5px; cursor: pointer; transition: background-color 0.3s ease; font-size: 0.9rem; white-space: nowrap; }
.add-to-cart:hover { background-color: #638e3f; }
.add-to-cart:disabled { background-color: #ccc; cursor: default; }
/* About */
#about { padding: 4rem 0; }
/* Contact */
#contact { padding: 4rem 0; background-color: #fff; }
.contact-info { margin-bottom: 2rem; }
.contact-info p { margin: 0.5rem 0; }
#contact-form input, #contact-form textarea { width: 100%; padding: 0.8rem; margin-bottom: 1rem; border: 1px solid #ccc; border-radius: 5px; }
#contact-form textarea { height: 150px; }
#map { height: 400px; margin-top: 2rem; border-radius: 10px; overflow: hidden; }

/* Cart Page Styles */
#cart { padding: 4rem 0; }
#cart-table { width: 100%; border-collapse: collapse; margin-bottom: 2rem; background-color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-radius: 5px; overflow: hidden; }
#cart-table thead { background-color: #f8f0e3; }
#cart-table th, #cart-table td { padding: 1rem; text-align: left; border-bottom: 1px solid #e0d8cc; }
#cart-table th { font-weight: 500; color: #553c1f; }
#cart-table tbody tr:last-child td { border-bottom: none; }
@media (min-width: 769px) { #cart-table { width: 80%; max-width: 800px; margin-left: auto; margin-right: auto; } #cart-table th, #cart-table td { padding: 0.6rem; } }
.delete-item { cursor: pointer; color: #553c1f; } .delete-item:hover { color: red; }
.quantity-select { appearance: none; -webkit-appearance: none; -moz-appearance: none; background-color: #fff; border: 1px solid #D2B48C; padding: 0.4rem 2rem 0.4rem 0.8rem; border-radius: 5px; font-size: 1rem; color: #553c1f; cursor: pointer; min-width: 60px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23553c1f'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 1.2em; transition: border-color 0.3s ease; }
.quantity-select:hover { border-color: #BCA5A5; }
.quantity-select:focus { outline: none; border-color: #553c1f; box-shadow: 0 0 0 2px rgba(85, 60, 31, 0.2); }
.form-container { display: block; margin-bottom: 2rem; }
.form-section { margin-bottom: 2rem; }
.form-section h3 { margin-bottom: 1rem; }
.form-section input, .form-section .StripeElement { width: 95%; padding: 0.8rem; margin-bottom: 1rem; border: 1px solid #ccc; border-radius: 5px; }

#checkout-btn {
    margin-top: 1rem;
    align-self: center;
    background-color: #79a752; /* Added Green background */
    color: #fff; /* Ensure text is white */
 }
#checkout-btn:hover {
    background-color: #638e3f; /* Darker Green on hover */
}

/* Footer */
footer { background-color: #553c1f; color: #fff; text-align: center; padding: 2rem 0; margin-top: auto; }
.cart-item-container { display: flex; align-items: center; }
.cart-item-image { width: 50px; height: 50px; object-fit: cover; margin-right: 10px; border-radius: 50%; }
.cart-summary { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; margin-right: 1rem; }
#cart-total { font-size: 1.2rem; font-weight: bold; align-self: flex-end; }
#shipping-cost { text-align: right; margin-bottom: 0.5rem; font-size: 1rem; }
#shipping-cost p { margin: 0.2rem 0; line-height: 1.2; }
/* Success Page Styles */
#success { padding: 4rem 0; text-align: center; }
.success-content { display: flex; flex-direction: column; align-items: center; }
.success-content h2, .success-content p { text-align: center; }
.success-content .btn { margin-top: 1rem; }
/* Image Expansion Styles */
.expandable-image { cursor: pointer; }
#overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); display: flex; justify-content: center; align-items: center; z-index: 1000; }
#overlay img { max-width: 80%; max-height: 80%; border-radius: 10px; }
#overlay .close-btn { position: absolute; top: 20px; right: 30px; font-size: 40px; color: white; cursor: pointer; z-index: 1001; }

/* --- Pagination Styles (Recommendation 1) --- */
.pagination {
    display: flex;
    justify-content: flex-start; /* Or center? */
    align-items: center;
    margin-top: 2rem; /* Increased top margin */
    margin-bottom: 3rem;
    margin-left: 2rem; /* Keep alignment or center? */
    gap: 0.5rem; /* Use gap for spacing instead of margin-right */
}

.pagination button {
    background-color: #F8F0E3; /* Use light site background */
    color: #553c1f; /* Dark brown text */
    border: 1px solid #e0d8cc; /* Softer border */
    padding: 0.5rem 1rem;
    border-radius: 6px; /* Slightly more rounded */
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Roboto', sans-serif; /* Ensure font */
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); /* Subtle shadow */
    /* margin-right removed as gap is used on container */
}

.pagination button:hover {
    background-color: #fff; /* White background on hover */
    border-color: #D2B48C; /* Tan border on hover */
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.pagination button.active {
    background-color: #553c1f; /* Dark brown */
    color: #fff; /* White text */
    border-color: #553c1f; /* Match background */
    font-weight: bold;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); /* Inner shadow */
}

.pagination button:disabled {
    background-color: #f0e6d8; /* Lighter tan disabled */
    color: #a89a89; /* Muted text color */
    border-color: #e0d8cc; /* Match background border */
    cursor: default;
    box-shadow: none;
}
/* --- End Pagination Styles --- */


/* --- Admin Page Specific Styles --- */
.admin-section {
    background-color: #fff;
    padding: 2.5rem; /* Base padding */
    margin-top: 4rem; /* Increased top margin */
    margin-bottom: 4rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    position: relative;
}

#admin-login h2,
#product-management h2,
#add-product h2,
#shipping-rate-management h2 { /* Applied to add product and shipping h2 as well */
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    padding-left: 0;
    margin-top: 0;
    color: #553c1f;
    border-bottom: 1px solid #eee;
}


/* Login Form */
#login-form .form-group {
    margin-bottom: 1.5rem;
}

#login-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #553c1f;
}

#login-form input[type="text"],
#login-form input[type="password"] {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
#login-form input[type="text"]:focus,
#login-form input[type="password"]:focus {
    outline: none;
    border-color: #D2B48C;
    box-shadow: 0 0 0 3px rgba(210, 180, 140, 0.2);
}

#login-form .btn {
    margin-top: 1rem;
    background-color: #79a752;
}
#login-form .btn:hover {
    background-color: #638e3f;
}

.error-message {
    color: #d9534f;
    background-color: #f2dede;
    border: 1px solid #ebccd1;
    border-radius: 6px;
    padding: 0.8rem 1rem;
    margin-top: 1rem;
    font-weight: 500;
}

.status-message {
    margin: 1rem 0;
    font-weight: 500;
    padding: 0.8rem 1rem;
    border-radius: 6px;
    display: block; /* Should be block by default */
    box-sizing: border-box;
    width: 100%; /* Take full width */
}
.status-message:not([style*="display: none"]) { /* Only apply background/border if visible */
    color: #3c763d;
    background-color: #dff0d8;
    border: 1px solid #d6e9c6;
}
/* Apply error styles based on color property set by JS */
.status-message[style*="color: red;"] {
     color: #d9534f !important; /* Override green if error */
     background-color: #f2dede;
     border: 1px solid #ebccd1;
}


/* Style and Position Logout ICON Button - Absolute */
#logout-btn.btn-icon-logout {
    position: absolute;
    top: 15px;
    left: 15px;
    background-color: transparent;
    color: #8c8c8c;
    border: none;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    line-height: 1;
    box-shadow: none;
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
    display: none; /* Controlled by JS */
}

#logout-btn.btn-icon-logout .material-icons {
    font-size: 24px;
}

#logout-btn.btn-icon-logout:hover {
    background-color: #eee;
    color: #553c1f;
    box-shadow: none;
}
#logout-btn.btn-icon-logout:active {
    background-color: #ddd;
    transform: none;
}

/* Search Bar Styling */
.search-bar-container {
    margin-bottom: 1.5rem;
    margin-top: 1rem;
}

#product-search-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
#product-search-input:focus {
    outline: none;
    border-color: #D2B48C;
    box-shadow: 0 0 0 3px rgba(210, 180, 140, 0.2);
}
#product-search-input::-webkit-search-cancel-button {
    cursor: pointer;
}


/* Product Table */
#product-table {
    width: 100%;
    border-collapse: collapse;
    /* margin-top: 1.5rem; */
    border: none;
    border-radius: 6px;
    overflow: hidden; /* Clip rounded corners */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#product-table thead {
     background-color: #f7f7f7;
}

#product-table th {
    border: none;
    border-bottom: 2px solid #e0d8cc;
    padding: 1rem 1.2rem;
    text-align: left;
    font-weight: 600;
    color: #553c1f;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    vertical-align: middle; /* Align header text middle */
}

#product-table tbody tr:nth-child(even) {
    background-color: #fdfaf6;
}
#product-table tbody tr:hover {
    background-color: #f5efe6;
}

#product-table td {
    border: none;
    border-bottom: 1px solid #eee;
    padding: 0.9rem 1.2rem;
    text-align: left;
    vertical-align: middle;
    color: #665444;
}

#product-table tbody tr:last-child td {
    border-bottom: none;
}


/* Specific Column Alignments & Widths */
#product-table th:nth-child(1), /* Image */
#product-table td:nth-child(1) {
    width: 8%;
    padding-left: 1.2rem;
    padding-right: 0.5rem;
    text-align: center;
}
#product-table th:nth-child(2), /* Name */
#product-table td:nth-child(2) {
    width: 18%;
}
#product-table th:nth-child(3), /* Price */
#product-table td:nth-child(3) {
    text-align: right;
    /* Increased width for Price column */
    width: 12%;
}
#product-table th:nth-child(4), /* Description */
#product-table td:nth-child(4) {
     /* Adjusted width slightly to compensate for price */
     width: 30%;
     white-space: normal; /* Allow description to wrap */
}
#product-table th:nth-child(5), /* Featured */
#product-table td:nth-child(5) {
    text-align: center;
    width: 10%; /* Adjusted */
}
#product-table th:nth-child(6), /* Out of Stock */
#product-table td:nth-child(6) {
    text-align: center;
    width: 10%; /* Adjusted */
}
#product-table th:nth-child(7), /* Actions */
#product-table td:nth-child(7) {
    text-align: center;
    width: 12%; /* Adjusted */
    white-space: nowrap; /* Prevent action icons from wrapping */
}


/* Admin Product Image Style */
.admin-product-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
}


/* Checkbox Styling */
#product-table .out-of-stock-checkbox,
#product-table .featured-checkbox {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    vertical-align: middle;
    position: relative;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
#product-table .out-of-stock-checkbox:checked,
#product-table .featured-checkbox:checked {
    background-color: #79a752;
    border-color: #638e3f;
}
#product-table .out-of-stock-checkbox:checked::after,
#product-table .featured-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}


/* Save All Button Container - Removed */
/* .save-all-container { ... } */
/* #save-all-btn { ... } */


/* --- Styles for Add Product / Shipping Rate Forms --- */
#add-product, #shipping-rate-management {
    /* Inherits .admin-section styles */
    margin-top: 2rem; /* Space between sections */
}

#add-product h2, #shipping-rate-management h2 {
    /* Inherits admin h2 styles */
    text-align: center; /* Ensure centered */
}

/* --- MODIFIED: Combine Form Group Margin Styling --- */
#add-product-form .form-group,
#login-form .form-group, /* Added login form for consistency */
#create-shipping-rate-form .form-group /* Added shipping rate form */
{
    margin-bottom: 1.5rem;
}

/* --- MODIFIED: Combine Label Styling --- */
#add-product-form label,
#login-form label, /* Added login form */
#create-shipping-rate-form label /* Added shipping rate form */
{
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #553c1f;
}

/* Input Styling (Combined from previous step) */
#add-product-form input[type="text"],
#add-product-form input[type="number"],
#add-product-form textarea,
#add-product-form input[type="file"],
#create-shipping-rate-form input[type="text"],
#create-shipping-rate-form input[type="number"]
{
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit; /* Ensure consistent font */
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
#add-product-form input[type="file"] {
    padding: 0.5rem; /* Adjust padding for file input */
}

#add-product-form textarea {
    resize: vertical; /* Allow vertical resizing */
    min-height: 80px; /* Ensure decent height */
}

/* Focus Styling (Combined from previous step) */
#add-product-form input:focus,
#add-product-form textarea:focus,
#create-shipping-rate-form input:focus
{
    outline: none;
    border-color: #D2B48C;
    box-shadow: 0 0 0 3px rgba(210, 180, 140, 0.2);
}

/* --- MODIFIED: Add margin-top to buttons within forms --- */
#add-product-form .btn-save-product,
#create-shipping-rate-form .btn-save-product /* Added shipping rate form button */
{
     margin-top: 1rem;
     /* Inherits btn styles */
}


#add-product-status {
    /* Inherits .status-message styles */
    margin-top: 1rem;
}


/* --- Styles for Action Icons (Edit, Delete, Save, Cancel) --- */
#product-table td[data-label="Actions"] .material-icons {
    color: #8c8c8c; /* Default grey */
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    font-size: 22px;
    vertical-align: middle;
    margin: 0 4px; /* Add space between icons */
    display: inline-block; /* Ensure proper spacing */
}

#product-table td[data-label="Actions"] .material-icons:hover {
    transform: scale(1.1);
}
/* Specific hover colors */
#product-table td[data-label="Actions"] .edit-product:hover { color: #4682B4; } /* Steel Blue for Edit */
#product-table td[data-label="Actions"] .delete-product:hover { color: #d9534f; } /* Red for Delete */
#product-table td[data-label="Actions"] .save-product-edit:hover { color: #79a752; } /* Green for Save */
#product-table td[data-label="Actions"] .cancel-product-edit:hover { color: #f0ad4e; } /* Orange for Cancel */

/* Styles for disabled icons */
#product-table td[data-label="Actions"] .material-icons.disabled-icon {
    color: #ccc;
    cursor: default; /* Changed from not-allowed for less aggressive feel */
    opacity: 0.5;
    /* pointer-events: none; */ /* Removed to allow potential tooltips on disabled icons */
}
#product-table td[data-label="Actions"] .material-icons.disabled-icon:hover {
    transform: none; /* No scale effect when disabled */
}


/* --- Styles for Inline Edit Fields --- */
#product-table td input[type="text"].edit-product-name,
#product-table td input[type="number"].edit-product-price,
#product-table td textarea.edit-product-description {
    width: 100%; /* Take full cell width */
    padding: 0.4rem 0.6rem;
    border: 1px solid #D2B48C;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.95rem;
    color: #553c1f;
    margin: 0; /* Remove default margins */
}
#product-table td input[type="number"].edit-product-price {
     /* Ensure enough minimum width for price input */
     min-width: 70px; /* Adjust as needed */
     text-align: right; /* Align price right */
     padding-right: 0.6rem; /* Ensure padding */
}

#product-table td textarea.edit-product-description {
    resize: vertical;
    min-height: 50px; /* Smaller default height for table cell */
    line-height: 1.4; /* Improve readability */
}

#product-table td input[type="text"].edit-product-name:focus,
#product-table td input[type="number"].edit-product-price:focus,
#product-table td textarea.edit-product-description:focus {
    outline: none;
    border-color: #553c1f;
    box-shadow: 0 0 0 2px rgba(85, 60, 31, 0.2);
}

/* Image upload in edit mode */
#product-table td[data-label="Image"] .edit-image-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
}
#product-table td[data-label="Image"] .edit-product-image-input {
    font-size: 0.8em;
    max-width: 100%; /* Prevent overflow */
}
#product-table td[data-label="Image"] .edit-image-preview {
     border-radius: 50%; /* Keep preview rounded */
     border: 1px solid #eee;
}
#product-table td[data-label="Image"] .current-image-text {
    color: #777;
}

/* Hide display elements when inputs are shown */
/* Using JS style.display = 'none' is primary method, this is fallback */
#product-table tr.is-editing .product-image-display,
#product-table tr.is-editing .product-name-display,
#product-table tr.is-editing .product-price-display,
#product-table tr.is-editing .product-description-display {
    display: none !important; /* Use !important cautiously if needed */
}


/* --- Media Queries for Mobile Responsiveness --- */

/* Smaller Tablets and Larger Phones (e.g., 481px to 767px) */
@media (max-width: 767px) {
    .container { width: 90%; }
    nav { padding: 1rem; }
    .logo { display: block; text-align: center; float: none; font-size: 1.5rem; margin-bottom: 1rem; }
    nav ul { float: none; text-align: center; display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; }
    nav ul li { display: inline-block; margin: 0 0.5rem; }
    nav ul li a { font-size: 13px; padding: 0.5rem; }
    .order-now { display: none; }
    #cart-link { margin-left: auto; }
    #cart-link[data-count]::after { top: -8px; right: -12px; font-size: 0.7rem; padding: 2px 5px; }
    .hero { padding: 4rem 0; }
    h1 { font-size: 2.5rem; }
    .hero-content { padding: 1.5rem; }
    .about-snippet { margin: 2rem 0; flex-direction: column; margin-left: 0; padding: 0 1rem; }
    .about-content { flex-direction: column; text-align: center; }
    .about-content img { width: 100%; height: auto; max-width: 80%; }
    .carousel .item { min-width: 200px; }
    .menu-tabs { padding-left: 1rem; padding-right: 1rem; justify-content: flex-start; overflow-x: auto; white-space: nowrap; margin-left: -1rem; margin-right: -1rem; scrollbar-width: none; -ms-overflow-style: none; }
    .menu-tabs::-webkit-scrollbar { display: none; }
    .menu-tab { margin-right: 0.5rem; flex-shrink: 0; }
    .testimonial { padding: 1.5rem; }
    .menu-items { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .menu-item img { height: 150px; }
    .pagination { margin-left: 0.5rem; flex-wrap: wrap; justify-content: center; margin-bottom: 2rem; } /* Centered pagination for mobile */
    .pagination button { padding: 0.4rem 0.8rem; font-size: 0.9rem; margin-bottom: 0.5rem; }
    #about, #contact, #cart, #success { padding: 2rem 0; }
    #map { height: 300px; }
    #cart-table th, #cart-table td { padding: 0.8rem; }
    .delete-item { font-size: 0.9rem; }
    .quantity-select { padding: 0.3rem 1.8rem 0.3rem 0.6rem; font-size: 0.9rem; background-position: right 0.4rem center; }
    .cart-summary { margin-right: 0.5rem; }
    .form-section input, .form-section .StripeElement { width: 90%; }
    footer { padding: 1.5rem 0; }

      /* --- Admin mobile styles (Tablets / Larger Phones) --- */
      .admin-section {
          padding: 1.5rem;
          margin-top: 3rem;
          margin-bottom: 3rem;
          box-shadow: 0 2px 8px rgba(0,0,0,0.06);
      }
      #logout-btn.btn-icon-logout {
          top: 10px; left: 10px; width: 36px; height: 36px; padding: 6px;
      }
       #logout-btn.btn-icon-logout .material-icons { font-size: 20px; }

       #admin-login h2, #product-management h2, #add-product h2, #shipping-rate-management h2 { /* Added shipping h2 */
          padding-left: 0; font-size: 1.8rem; margin-bottom: 1rem; padding-bottom: 0.8rem; border-bottom: 1px solid #eee; text-align: center; margin-top: 0;
      }


      /* Adjust horizontal scroll table */
      #product-table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid #eee; border-radius: 6px; box-shadow: none; }
       #product-table thead, #product-table tbody, #product-table tr { display: table; width: 100%; min-width: 950px; table-layout: fixed; }
       #product-table th, #product-table td { display: table-cell; padding: 0.8rem 1rem; font-size: 0.9rem; border: none; border-bottom: 1px solid #eee; text-align: left; white-space: nowrap; /* Keep nowrap for most */ overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
       /* Allow wrap for specific columns */
        #product-table th:nth-child(2), #product-table td:nth-child(2), /* Name */
        #product-table th:nth-child(4), #product-table td:nth-child(4) { /* Desc */ white-space: normal; }
       /* Specific alignments & widths for tablet */
         #product-table th:nth-child(1), #product-table td:nth-child(1) { width: 10%; text-align: center; } /* Image */
         #product-table th:nth-child(2), #product-table td:nth-child(2) { width: 18%; } /* Name */
         #product-table th:nth-child(3), #product-table td:nth-child(3) { width: 12%; text-align: right;} /* Price - Wider */
         #product-table th:nth-child(4), #product-table td:nth-child(4) { width: 30%;} /* Desc - Adjusted */
         #product-table th:nth-child(5), #product-table td:nth-child(5) { width: 10%; text-align: center;} /* Featured */
         #product-table th:nth-child(6), #product-table td:nth-child(6) { width: 10%; text-align: center;} /* Stock */
         #product-table th:nth-child(7), #product-table td:nth-child(7) { width: 10%; text-align: center;} /* Actions - Adjusted */


        #product-table tbody tr:last-child td { border-bottom: none; }
        #product-table td::before { content: none; } /* Ensure labels are off in table view */

        .admin-product-image { width: 40px; height: 40px; } /* Smaller image */
        #product-table .out-of-stock-checkbox,
        #product-table .featured-checkbox { width: 18px; height: 18px; }
        #product-table .out-of-stock-checkbox:checked::after,
        #product-table .featured-checkbox:checked::after { left: 5px; top: 1px; width: 4px; height: 9px; }

        /* Inline edit inputs on tablet */
        #product-table td input[type="text"].edit-product-name,
        #product-table td input[type="number"].edit-product-price,
        #product-table td textarea.edit-product-description {
            font-size: 0.9rem;
            padding: 0.3rem 0.5rem;
        }
         #product-table td input[type="number"].edit-product-price {
             min-width: 60px; /* Ensure minimum width */
        }
        #product-table td textarea.edit-product-description {
             min-height: 40px;
        }
         #product-table td[data-label="Image"] .edit-product-image-input { font-size: 0.75em; }


    /* Save All button removed */
    /* .save-all-container { ... } */
    /* #save-all-btn { ... } */

}

/* Smallest Screens (e.g., <= 480px) */
@media (max-width: 480px) {
    .container { width: 95%; }
    .menu-items { grid-template-columns: 1fr; }
    .menu-item img { height: auto; }
    nav ul { display: flex; align-items: center; width: 100%; justify-content: space-around; }
    nav ul li { margin-left: 0; margin-right: 10px; }
    nav ul li a { font-size: 12px; }
    .about-snippet { padding: 0 1rem; }
    .about-content img { width: 100%; height: auto; max-width: 100%; }
    #cart-table { font-size: 14px; }
    #cart-table th, #cart-table td { padding: 0.5rem; }
    .carousel { display: block; overflow-x: visible; padding: 0; }
    .carousel .item { min-width: unset; width: 80%; margin-left: auto; margin-right: auto; margin-bottom: 1.5rem; }
    .carousel .item img { height: auto; }

    /* --- Admin table adjustments for very small screens (Stacked Cards) --- */
      .admin-section { padding: 1rem; margin-top: 3rem; margin-bottom: 3rem; }
      #logout-btn.btn-icon-logout { top: 8px; left: 8px; width: 32px; height: 32px; padding: 4px; }
      #logout-btn.btn-icon-logout .material-icons { font-size: 18px; }
      #admin-login h2, #product-management h2, #add-product h2, #shipping-rate-management h2 { /* Added shipping h2 */
           padding-left: 0; text-align: center; font-size: 1.4rem; margin-top: 0; border-bottom: 1px solid #eee; padding-bottom: 0.8rem; margin-bottom: 1rem;
      }
      .search-bar-container { margin-bottom: 1rem; }
      #product-search-input { padding: 0.7rem 0.9rem; font-size: 0.95rem; }

      #product-table { display: block; width: 100%; overflow-x: hidden; border: none; box-shadow: none; }
      #product-table thead { display: none; } /* Hide table header in card view */
      #product-table tbody, #product-table tr { display: block; width: 100%; }

      /* *** Style TR as Flex Card *** */
      #product-table tr {
          display: flex; /* Use flex for card layout */
          flex-wrap: wrap; /* Allow wrapping */
          align-items: center; /* Align items vertically */
          margin-bottom: 1rem;
          border: 1px solid #e0d8cc;
          border-radius: 6px;
          padding: 1rem;
          background-color: #fff;
          box-shadow: 0 1px 3px rgba(0,0,0,0.05);
          box-sizing: border-box;
      }
      /* *** Style Individual TD within Flex Card *** */
       #product-table td {
           display: block; /* Revert TD to block */
           border: none;
           padding: 0.4rem 0; /* Adjust padding */
           width: 100%; /* Default to full width */
           box-sizing: border-box;
           white-space: normal;
           overflow: visible;
           text-overflow: clip;
           position: static;
           font-size: 0.95rem;
           text-align: left; /* Align text left */
           border-bottom: 1px dashed #eee; /* Keep separator */
           display: flex; /* Make TD flex to align label/value */
           justify-content: space-between;
           align-items: baseline; /* Align text baseline */
           flex-wrap: wrap; /* Allow label and value/input to wrap if needed */
       }
       #product-table td:last-child { border-bottom: none; } /* No border on last item (Actions) */

       /* Style the Image Cell */
       #product-table td[data-label="Image"] {
           width: auto; /* Allow natural width */
           margin-right: 1rem; /* Space next to image */
           border-bottom: none; /* No border below image */
           padding: 0; /* No padding needed */
           order: -1; /* Place image first visually */
           justify-content: flex-start; /* Align image left */
           margin-bottom: 0.5rem; /* Space below image */
           flex-basis: auto; /* Don't force full width */
           flex-grow: 0; /* Don't grow */
       }
       .admin-product-image {
           width: 60px; /* Larger image for card */
           height: 60px;
       }
        /* Image edit styles for card view */
        #product-table td[data-label="Image"] .edit-image-upload { align-items: flex-start; }
        #product-table td[data-label="Image"] .edit-product-image-input { font-size: 0.9em; margin-bottom: 5px; }
        #product-table td[data-label="Image"] .edit-image-preview { width: 60px; height: 60px; margin: 0; }
        #product-table td[data-label="Image"] .current-image-text { font-size: 0.75em; }


       /* Container for other details */
       #product-table td:not([data-label="Image"]):not([data-label="Actions"]) {
            flex-basis: 100%; /* Make other fields take full width below image */
            flex-grow: 1;
       }


        /* Style the label pseudo-element */
        #product-table td::before {
            content: attr(data-label);
            font-weight: 500;
            color: #553c1f;
            text-align: left;
            margin-right: 1rem; /* Space between label and value */
            flex-shrink: 0;
            width: 90px; /* Fixed label width */
             flex-basis: 90px; /* Use flex-basis for label width */
        }
        /* Hide label for Image and Actions cell */
         #product-table td[data-label="Image"]::before,
         #product-table td[data-label="Actions"]::before {
             display: none;
         }

         /* Value styling (spans) */
         #product-table td > span[class*="-display"] {
            text-align: right;
            flex-grow: 1; /* Allow value to take remaining space */
            word-break: break-word; /* Allow long values to wrap */
             margin-left: 0.5rem; /* Space after label */
         }
         #product-table td[data-label="Description"] > span { /* Let description span */
            text-align: left;
         }

         /* Input styling in card view */
        #product-table td input[type="text"].edit-product-name,
        #product-table td input[type="number"].edit-product-price,
        #product-table td textarea.edit-product-description {
            flex-grow: 1; /* Allow input to fill space */
            margin-left: 0.5rem; /* Space after label */
            text-align: right; /* Align input text right */
            font-size: 0.95rem;
             min-width: 50px; /* Prevent inputs from becoming too small */
        }
        #product-table td input[type="number"].edit-product-price {
            /* Ensure specific min-width for price */
            min-width: 70px;
        }
         #product-table td textarea.edit-product-description {
             text-align: left; /* Keep textarea left-aligned */
             min-height: 60px;
             width: 100%; /* Force textarea to take full width below label */
             margin-left: 0; /* No margin needed if full width */
             margin-top: 0.3rem; /* Space below label */
             flex-basis: 100%; /* Ensure it takes full width */
        }


         /* Checkbox alignment */
         #product-table td[data-label="Out of Stock"],
         #product-table td[data-label="Featured"] {
            align-items: center; /* Center checkbox vertically */
             justify-content: space-between; /* Keep space-between layout */
         }
         #product-table .out-of-stock-checkbox,
         #product-table .featured-checkbox {
             width: 22px; height: 22px; margin-left: 1rem; /* Space before checkbox */ flex-shrink: 0; flex-grow: 0;
          }
         #product-table .out-of-stock-checkbox:checked::after,
         #product-table .featured-checkbox:checked::after {
            left: 7px; top: 3px; width: 5px; height: 11px;
        }

        /* Actions cell specific styles for card view */
         #product-table td[data-label="Actions"] {
             width: 100%; /* Take full width at the bottom */
             order: 99; /* Place actions last */
             flex-basis: 100%; /* Force full width */
             justify-content: flex-end; /* Align icons to the right */
             border-bottom: none;
             padding-top: 0.8rem; /* Add some space above */
             margin-top: 0.5rem; /* Space above actions */
             border-top: 1px dashed #eee; /* Separator above actions */
         }
         #product-table .edit-mode-icons { /* Ensure edit mode icons span is block */
             display: inline-block; /* Keep icons inline */
         }
         #product-table .material-icons {
             margin: 0 8px; /* Adjust spacing for touch */
             padding: 5px; /* Add padding to make it easier to tap */
         }

}