:root {
    /* M3-inspired Color Tokens */
    --md-sys-color-primary: #006492;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #cazen9;
    --md-sys-color-on-primary-container: #001e30;

    --md-sys-color-surface: #f8fdff;
    --md-sys-color-on-surface: #001f2b;
    --md-sys-color-surface-variant: #dde3ea;
    --md-sys-color-on-surface-variant: #41484d;

    --md-sys-color-outline: #71787e;
    --md-sys-color-outline-variant: #c1c7ce;

    --md-sys-color-background: #fdfcff;

    /* Elevations (Shadows) */
    --elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
    --elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
    --elevation-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.15), 0px 1px 3px 0px rgba(0, 0, 0, 0.3);

    font-family: 'Roboto', system-ui, sans-serif;
    color: var(--md-sys-color-on-surface);
    background-color: var(--md-sys-color-background);
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f0f4f8;
    /* Soft distinctive background */
}

/* Material Web Component Overrides */
md-elevated-button {
    --md-elevated-button-container-shape: 20px;
}

md-outlined-text-field {
    --md-outlined-text-field-container-shape: 12px;
}

/* --- App Header --- */
header {
    background: var(--md-sys-color-surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.3s ease;
}

.top-app-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 72px;
    /* Taller header */
    max-width: 1200px;
    margin: 0 auto;
}

.top-app-bar h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--md-sys-color-primary);
    letter-spacing: -0.5px;
}

/* Cart Badge */
#cart-btn {
    position: relative;
    --md-icon-button-icon-color: var(--md-sys-color-on-surface-variant);
}

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: #ba1a1a;
    /* Error color for badge */
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* --- Main Layout --- */
main#app {
    flex: 1;
    padding: 2.5rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* --- Components --- */

/* Promo Banner */
.promo-banner {
    background: linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)), url('/images/summer_sale_bg.png');
    background-size: cover;
    background-position: center;
    padding: 3rem 2rem;
    border-radius: 28px;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--md-sys-color-primary);
    box-shadow: var(--elevation-1);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.2, 0.0, 0.2, 1), box-shadow 0.3s;
    border: 1px solid white;
}

.promo-banner:hover {
    transform: translateY(-4px);
    box-shadow: var(--elevation-2);
}

.promo-banner h3 {
    margin: 0 0 0.5rem 0;
    font-size: 2.5rem;
    font-weight: 500;
    color: var(--md-sys-color-primary);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.promo-banner p {
    font-size: 1.1rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 1.5rem;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.product-card {
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    /* Very subtle default */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.5);
    height: 100%;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
    /* Premium float effect */
}

.card-img {
    height: 320px;
    /* Portrait format */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: white;
    /* Match image background better */
    transition: transform 0.5s ease;
}

.product-card:hover .card-img {
    transform: scale(1.03);
    /* Subtle zoom */
}

.card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    position: relative;
}

.card-content h4 {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
    font-weight: 500;
}

.card-content .price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    margin-bottom: 1.5rem;
}

.card-content .view-btn {
    margin-top: auto;
    width: 100%;
}

/* Product Detail */
.product-detail {
    display: flex;
    gap: 3rem;
    background: white;
    padding: 3rem;
    border-radius: 32px;
    box-shadow: var(--elevation-1);
    flex-wrap: wrap;
    align-items: flex-start;
}

.detail-img {
    flex: 1;
    min-width: 320px;
    border-radius: 24px;
    overflow: hidden;
    background: #f9f9f9;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.03);
}

.detail-img img {
    width: 100%;
    height: auto;
    display: block;
    mix-blend-mode: multiply;
    /* Better integration for white BG images */
}

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

.detail-info h2 {
    font-size: 2.5rem;
    margin: 0 0 0.5rem;
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
}

.detail-price {
    font-size: 2rem;
    color: var(--md-sys-color-primary);
    margin: 1rem 0 2rem;
    font-weight: 700;
}

.detail-info p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 2rem;
}

.detail-info .actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Cart & Checkout */
.cart-list,
#checkout-content {
    background: white;
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--elevation-1);
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--md-sys-color-surface-container);
    transition: background 0.2s;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item .info strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.cart-summary {
    margin-top: 2rem;
    text-align: right;
    padding: 2rem;
    background: var(--md-sys-color-surface-container);
    /* Subtle highlight block */
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
}

/* Forms */
#checkout-content form label {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

#checkout-content form label:hover {
    background: var(--md-sys-color-surface-container);
    border-color: var(--md-sys-color-outline);
}

#checkout-content input[type="radio"] {
    accent-color: var(--md-sys-color-primary);
    width: 1.2rem;
    height: 1.2rem;
    margin-right: 1rem;
}

/* --- Developer Panel (Bottom Right) --- */
#dev-panel {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 2000;
    width: 320px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    font-family: 'Roboto', sans-serif;
    transform-origin: bottom right;
    transition: width 0.3s;
}

.dev-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: var(--md-sys-color-surface-container);
    border-radius: 16px 16px 0 0;
    /* Top rounding */
}

/* When content is hidden, round all corners */
#dev-content-area[hidden]+.dev-header,
/* fallback selector logic */
.dev-content[hidden]~.dev-header {
    /* CSS doesn't select parent based on child, but we can rely on JS logic or just have constant styling.
       Actually, standard simple rounded corners are fine. The dev-header is at top. */
}

/* Fix for rounded corners when collapsed: Logic needs to handle "full rounded" if content hidden.
   Since content is below header, we just keep header top-rounded. Bottom of container is rounded. */

.dev-header:hover {
    background: #e2e7ec;
    /* Slightly darker */
}

.dev-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
}

.dev-content[hidden] {
    display: none !important;
}

/* --- Misc --- */
footer {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Snackbar */
.snackbar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: #1a1c1e;
    /* Inverse Surface */
    color: #e2e2e6;
    /* Inverse On Surface */
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--elevation-3);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 320px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3000;
    font-weight: 500;
}

.snackbar.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}