/* frontend/static/css/style.css */

/* --- Global Resets & Defaults --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
    background-color: #f8f9fa; /* Very light grey page background */
    color: #343a40; /* Default dark grey text */
    margin: 0;
    padding: 0;
    line-height: 1.6;
    font-size: 16px;
}

* {
    box-sizing: border-box;
}

/* --- Main Container --- */
.container {
    max-width: 960px;
    margin: 0 auto; /* Centered, no top margin as header provides it */
    padding: 25px;
    background-color: #ffffff; /* White background for content area */
    /* Removed box-shadow and border-radius here, applying to header/sections if needed */
}

/* --- Typography --- */
h1, h2, h3, h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-weight: 500;
    color: #212529; /* Slightly darker for headings */
}
h1 { font-size: 2.25rem; margin-bottom: 1.5rem; } /* e.g., MyBrewery, Page Titles */
h2 { font-size: 1.75rem; } /* e.g., Section titles like "Your Cart", "Order Summary" */
h3 { font-size: 1.25rem; } /* e.g., Product names, sub-sections */
p { margin-top: 0; margin-bottom: 1rem; }

a {
    color: #f1ac0b; /* Primary blue for links */
    text-decoration: none;
}
a:hover {
    color: #a08648;
    text-decoration: underline;
}

/* --- Buttons --- */
button, .button-link {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    background-color: #d09a1e; /* Primary button blue */
    color: #ffffff;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
    text-decoration: none; /* For .button-link */
}
button:hover, .button-link:hover {
    background-color: #a08648;
    color: #ffffff;
    text-decoration: none; /* For .button-link */
}
button:disabled {
    background-color: #6c757d; /* Muted grey for disabled */
    border-color: #6c757d;
    opacity: 0.65;
    cursor: not-allowed;
}
/* Specific button types */
.add-to-cart-btn { /* Product card button */
    background-color: #28a745; /* Green for add to cart */
    border-color: #28a745;
}
.add-to-cart-btn:hover { background-color: #218838; border-color: #1e7e34;}

.checkout-btn { /* Proceed to Checkout, Complete Purchase */
    background-color: #28a745; /* Green for positive actions */
    border-color: #28a745;
    font-size: 1.1em; /* Slightly larger for primary action */
    padding: 0.7rem 1.5rem;
}
.checkout-btn:hover { background-color: #218838; border-color: #1e7e34; }

.cart-item-remove-btn {
    background: none;
    border: none;
    color: #dc3545; /* Red for remove/danger */
    font-size: 1.2em; /* Make it a bit bigger */
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}
.cart-item-remove-btn:hover { color: #c82333; }


/* --- Forms --- */
fieldset {
    border: 1px solid #dee2e6; /* Light grey border */
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0.25rem;
    background-color: #fff; /* Ensure white background if .container is very light grey */
}
legend {
    font-size: 1.25rem; /* Slightly larger legend */
    font-weight: 500;
    padding: 0 0.75rem;
    color: #343a40;
    margin-bottom: 1rem; /* Add space below legend */
}
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
}
input[type="text"],
input[type="email"],
input[type="number"],
select {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    box-sizing: border-box;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    margin-bottom: 1rem;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: #564f37; 
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); /* Bootstrap-like focus glow */
}
.product-selection label { /* For radio buttons */
    font-weight: normal;
    margin-bottom: 0.5rem;
    display: flex; /* Align radio and text */
    align-items: center;
}
input[type="radio"] {
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* Recurly Element Styling */
.recurly-element {
    border: 1px solid #ced4da; /* Match other inputs */
    padding: 10px; /* Adjust as needed */
    border-radius: 0.25rem;
    margin-bottom: 1rem;
    background-color: #ffffff; /* Ensure it's white */
    min-height: 40px; /* Adjust based on element content */
}
#recurly-error-messages {
    color: #dc3545; /* Red for errors */
    margin-top: -0.5rem; /* Pull closer to element */
    margin-bottom: 1rem;
    font-size: 0.875em;
}
/* In your style.css or <style> block for testing */
#recurly-apm-container {
    border: 2px solid red !important; /* Make container visible */
    padding: 10px !important;
    min-height: 100px !important; /* Ensure it has space */
    background-color: #f0f0f0 !important; /* Light background to see content */
}
#recurly-apm-container iframe { /* If Recurly injects an iframe */
    width: 100% !important;
    min-height: 70px !important; /* Or a height Adyen recommends */
    border: 1px solid blue !important; /* Make iframe visible */
    display: block !important; /* Ensure it's not inline or hidden */
}

/* Hidden Utility */
.hidden {
    display: none;
}

/* --- Site Header --- */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem; /* Use consistent units */
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef; /* Light border */
    margin-bottom: 20px; /* Add space before .container content starts */
}
/* Styles for the logo link and image */
.site-header .brand-logo-link {
    display: inline-block; /* Or flex if you need to align something next to it inside the link */
    line-height: 0; /* Helps remove extra space if image is inline-block */
}
.site-header #site-logo {
    height: 80px; /* Example height - ADJUST THIS to your logo's desired display height */
    width: auto;   /* Maintain aspect ratio */
    vertical-align: middle; /* Good for aligning with other header items if any */
}
.site-header .brand-name {
    font-size: 1.75rem;
    font-weight: bold;
    color: #f1ac0b; /* Accent color for brand */
    text-decoration: none;
}
.site-header .cart-link {
    font-size: 1.6rem; /* Slightly larger cart icon */
    text-decoration: none;
    color: #495057;
    position: relative;
}
.site-header .cart-link:hover {
    color: #f1ac0b;
}
.site-header .cart-count-bubble {
    position: absolute;
    top: -10px;
    right: -14px;
    background-color: #dc3545; /* Red for notification */
    color: white;
    border-radius: 50%;
    padding: 3px 7px;
    font-size: 0.7rem;
    font-weight: bold;
    border: 1px solid white; /* Make it pop a bit */
}

/* --- Homepage: index.html --- */
.product-grid {
    display: grid;
    gap: 25px; /* Or your preferred gap */
    padding: 20px; /* Or your preferred padding */

    /* Mobile First: Default to 1 column. */
    grid-template-columns: 1fr; 
}

/* Small tablets and larger phones: Switch to 2 columns */
@media (min-width: 600px) { /* Adjust breakpoint as needed */
    .product-grid {
        grid-template-columns: repeat(2, 1fr); 
    }
}

/* Desktops and larger tablets: Switch to 3 columns */
@media (min-width: 860px) { /* Adjust breakpoint as needed, e.g., 900px or 920px */
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        display: grid;
    }
}

/* Desktops and larger tablets: Switch to 3 columns */
/* Adjust this breakpoint (860px) based on when 3 columns fit well.
   Considering cards around 250px-280px wide:
   (3 cards * ~250px) + (2 gaps * 25px) = 750px + 50px = 800px.
   So, when the grid container itself has around 800-850px width available for content,
   3 columns will look good.
   Your main .container is max-width: 960px.
   The grid has 20px padding on each side, so content area is ~920px.
   920px / 3 columns = ~306px per column, which is a good size for cards.
   A breakpoint of 860px for the viewport should generally ensure the container is wide enough.
*/
/* Styles for .product-card can remain largely the same.
   The `1fr` unit in grid-template-columns means the cards will expand
   to fill the column width. If you want to constrain the card width
   further within these columns, you could add a max-width to .product-card,
   but usually, 1fr gives a nice fluid feel within the fixed column count.
*/
.product-card {
    border: 1px solid #e9ecef;
    border-radius: 0.3rem;
    padding: 20px;
    text-align: center;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.product-card:hover {
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}
.product-card img {
    max-width: 100%;
    height: 170px; 
    object-fit: contain;
    margin-bottom: 1rem;
}
.product-card h3 { 
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #343a40;
}
.product-card .price {
    font-weight: bold;
    color: #000000; 
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
}
.product-card .description {
    font-size: 0.875rem; 
    color: #6c757d;
    margin-bottom: 1rem; 
    flex-grow: 1; 
    min-height: 60px; /* Adjust as needed for your descriptions */
}
.region-selector-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 15px;
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 0.25rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}
.region-selector-container label {
    margin-right: 8px;
    font-weight: normal;
    color: #495057;
}
.region-selector-container select { /* Already styled by global input styles */
    margin-bottom: 0; /* Remove bottom margin if it's the only element */
}

/* --- Cart Page: cart.html --- */
.cart-item {
    display: flex;
    align-items: flex-start; 
    border-bottom: 1px solid #e9ecef;
    padding: 1.25rem 0; /* More padding */
    margin-bottom: 1.25rem;
}
.cart-item:last-child {
    border-bottom: none; /* No border for the last item */
    margin-bottom: 0;
}
.cart-item img {
    width: 80px; /* Slightly larger */
    height: 80px;
    object-fit: contain;
    margin-right: 1.25rem;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}
.cart-item-details { flex-grow: 1; }
.cart-item-details h3 { margin: 0 0 0.3rem 0; font-size: 1.15rem; }
.cart-item-details p { margin: 0 0 0.3rem 0; font-size: 0.9rem; color: #6c757d; }

.cart-item-actions { /* New class to group qty, price, remove */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: 1rem; /* Space from details */
    min-width: 130px;
}
.cart-item-quantity {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}
.cart-item-quantity label { font-size: 0.9rem; margin-right: 0.5rem; margin-bottom: 0; font-weight: normal;}
.cart-item-quantity input[type="number"] {
    width: 50px;
    padding: 0.3rem 0.5rem;
    font-size: 0.9rem;
    text-align: center;
    margin: 0; /* Override global */
}
.cart-item-subtotal { font-size: 1.05rem; font-weight: 500; color: #343a40; margin-bottom: 0.5rem; }

.cart-summary {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
    border: 1px solid #e9ecef;
}
.cart-summary h2 { margin-top: 0; margin-bottom: 1rem; font-size: 1.6rem; }
.cart-total { font-size: 1.5rem; font-weight: bold; text-align: right; margin-bottom: 1.5rem; color: #212529; }
.checkout-btn-container { text-align: right; }

.empty-cart-message { text-align: center; font-size: 1.1rem; color: #313335; padding: 40px 0; }
.empty-cart-message .button-link { margin-top: 1rem; }


/* --- Checkout Page: checkout.html --- */
.product-selection {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}
#cart-summary-on-checkout h4 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #343a40;
    font-weight: 500;
}
.checkout-order-summary-items {
    font-size: 0.9em;
    color: #495057;
    margin-bottom: 1rem;
    padding-left: 0; /* Remove default ul padding */
    max-height: 120px;
    overflow-y: auto;
}
.checkout-order-summary-items li {
    margin-bottom: 0.3rem;
    list-style-type: none;
}

/* --- Confirmation Page: confirmation.html --- */
.confirmation-details {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: #e6f7ff; /* Light blue confirmation box */
    border: 1px solid #b3e0ff;
    border-radius: 0.25rem;
}
.confirmation-details h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.6rem;
    color: #0056b3; /* Darker blue for heading */
}
.confirmation-details p { margin-bottom: 0.75rem; line-height: 1.6; color: #343a40; }
.confirmation-details strong { color: #155724; } /* Dark green for emphasized details */

.back-link-container {
    margin-top: 2rem;
    text-align: center;
}
.back-link-container .button-link { /* For the "Place Another Order" styled as a button */
    background-color: #6c757d; /* Secondary color */
    border-color: #6c757d;
}
.back-link-container .button-link:hover {
    background-color: #5a6268;
    border-color: #545b62;
}