/* =========================================
   Simple Shop - Core Styles
   ========================================= */

/* 1. Basic Reset & Globals */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    background-color: #f8f9fa;
    color: #333;
}

/* 2. Layout Containers */
header, nav, .container, footer {
    max-width: 1200px;
    margin: 15px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* 3. Header & Cart */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 100;
    flex-wrap: wrap;
    gap: 12px;
}

.header-top {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.user-banner {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin: 0;
}

.user-banner a {
    color: #3498db;
    font-weight: 600;
}

h1 {
    font-size: 1.8em;
    color: #2c3e50;
}

/* Cart Wrapper - Handles Hover Logic */
.cart-wrapper {
    position: relative;
    padding-bottom: 10px; /* Bridge the gap */
    margin-bottom: -10px;
}

.cart-container {
    position: relative;
    padding: 10px 20px;
    border: 2px solid #e74c3c;
    color: #e74c3c;
    cursor: pointer;
    border-radius: 50px;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    background: #fff;
}

.cart-wrapper:hover .cart-container {
    background: #e74c3c;
    color: #fff;
}

.cart-count {
    background: #e74c3c;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    font-size: 0.85em;
    min-width: 20px;
    text-align: center;
    transition: all 0.3s;
}

.cart-wrapper:hover .cart-count {
    background: #fff;
    color: #e74c3c;
}

/* Cart Dropdown - HOVER TRIGGERED */
.cart-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    width: 320px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 1000;
    padding: 20px;
    color: #333;
    
    /* Animation & Visibility */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    
    /* Arrow indicator */
    margin-top: 10px;
}

.cart-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    box-shadow: -2px -2px 5px rgba(0,0,0,0.05);
}

.cart-wrapper:hover .cart-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Cart Items Styling */
.cart-dropdown h3 {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.empty-cart {
    text-align: center;
    color: #95a5a6;
    padding: 20px 0;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f5f5f5;
}

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

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.9em;
    color: #333;
    margin-bottom: 3px;
}

.cart-item-price {
    color: #7f8c8d;
    font-size: 0.85em;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0 10px;
    background: #f8f9fa;
    padding: 2px;
    border-radius: 4px;
}

.qty-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: #fff;
    color: #333;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: background 0.2s;
}

.qty-btn:hover {
    background: #e74c3c;
    color: white;
}

.qty-value {
    min-width: 16px;
    text-align: center;
    font-size: 0.9em;
    font-weight: 600;
}

/* Remove button */
.remove-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 1.4em;
    padding: 0 5px;
    line-height: 1;
    transition: color 0.2s;
}

.remove-btn:hover {
    color: #e74c3c;
}

/* Cart footer */
.cart-footer {
    border-top: 2px solid #f5f5f5;
    padding-top: 15px;
    margin-top: 10px;
}

.cart-total {
    font-weight: bold;
    text-align: right;
    margin-bottom: 15px;
    font-size: 1.1em;
    color: #2c3e50;
}

.checkout-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: #e74c3c;
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 50px;
    font-weight: bold;
    transition: background 0.3s;
}

.checkout-btn:hover {
    background: #c0392b;
}

/* 4. Breadcrumb Navigation */
nav ul {
    list-style: none;
    display: flex;
    gap: 10px;
    font-size: 0.95em;
}

nav ul li::after {
    content: "/";
    margin-left: 10px;
    color: #ccc;
}

nav ul li:last-child::after {
    content: "";
}

nav a {
    text-decoration: none;
    color: #3498db;
}

/* 5. Main Layout */
.container {
    display: flex;
    gap: 25px;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.sidebar {
    width: 240px;
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: fit-content;
}

.sidebar h3 {
    margin-bottom: 20px;
    font-size: 1.2em;
    color: #2c3e50;
    border-left: 4px solid #3498db;
    padding-left: 10px;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin-bottom: 12px;
}

.sidebar a {
    text-decoration: none;
    color: #666;
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar a:hover, .sidebar a.active {
    background: #ebf5fb;
    color: #3498db;
    font-weight: bold;
}

.main-content {
    flex: 1;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* 6. Product Grid & Cards (CRITICAL FIX FOR OVERLAY) */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.product-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

/* Image container must be relative for absolute overlay */
.product-image-container {
    position: relative;
    width: 100%;
    height: 220px;
    background: #f9f9f9;
    overflow: hidden;
}

.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.product-card:hover .product-image-container img {
    transform: scale(1.1);
}

/* THE OVERLAY - MUST BE ABSOLUTE AND COVER THE IMAGE */
.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 20; /* Ensure it is above everything else in the card */
}

.product-card:hover .product-overlay {
    opacity: 1;
    visibility: visible;
}

/* Buttons inside overlay - RESET ANY EXTERNAL BUTTON STYLES */
.product-overlay button {
    width: 75%;
    padding: 12px !important; /* Force override */
    margin: 0 !important;
    border: none !important;
    border-radius: 50px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transform: translateY(20px);
    transition: all 0.3s ease;
    display: block !important;
}

.product-card:hover .product-overlay button {
    transform: translateY(0);
}

.product-overlay .add-btn {
    background: #27ae60 !important;
    color: white !important;
}

.product-overlay .add-btn:hover {
    background: #2ecc71 !important;
}

.product-overlay button:not(.add-btn) {
    background: #fff !important;
    color: #333 !important;
}

/* Product Info Section */
.product-info {
    padding: 20px;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #fff;
    position: relative;
    z-index: 5;
}

.product-name-link {
    font-size: 1.1em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
    text-decoration: none;
    cursor: pointer;
    display: block;
}

.product-name-link:hover {
    color: #3498db;
    text-decoration: underline;
}

.product-card .price {
    color: #e74c3c;
    font-size: 1.3em;
    font-weight: bold;
}

/* 7. Product Detail Page */
.product-detail {
    display: flex;
    gap: 40px;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.product-detail .product-image-container {
    flex: 1;
    height: auto;
    min-height: 400px;
    border-radius: 12px;
    box-shadow: none;
    overflow: hidden;
}

.product-detail .product-image-container img {
    border-radius: 12px;
    cursor: zoom-in;
}

.product-detail .product-image-container:hover img {
    transform: scale(1.15);
}

.product-detail .product-info {
    flex: 1;
    text-align: left;
    background: transparent;
    padding: 10px;
    display: block;
}

.product-detail h2 {
    font-size: 2.2em;
    margin-bottom: 10px;
    color: #2c3e50;
}

#product-category {
    color: #7f8c8d;
    font-size: 0.95em;
    margin-bottom: 20px;
    display: inline-block;
    background: #f0f2f5;
    padding: 5px 12px;
    border-radius: 20px;
}

.product-detail .price {
    font-size: 2em;
    margin: 20px 0;
    display: block;
    color: #e74c3c;
}

.product-detail .desc {
    font-size: 1.05em;
    color: #555;
    margin-bottom: 35px;
    line-height: 1.8;
}

.product-detail .add-btn {
    padding: 16px 50px;
    font-size: 1.1em;
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 15px rgba(39, 174, 96, 0.3);
}

.product-detail .add-btn:hover {
    background: #219150;
    transform: translateY(-3px);
    box-shadow: 0 12px 20px rgba(39, 174, 96, 0.4);
}

.product-detail .add-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 5px 10px rgba(39, 174, 96, 0.3);
}

/* 8. Utility & Global Button Overrides (To prevent the issue in the image) */
/* Reset any stray buttons that might be appearing outside the overlay */
.product-card > button {
    display: none !important;
}

.cart-message {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #2ecc71;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    z-index: 9999;
    display: none;
}

.cart-message.show {
    display: block;
}

/* Gate landing (index.html) */
body.gate-page {
    background: #ecf0f1;
    min-height: 100vh;
}

.gate {
    max-width: 480px;
    margin: 10vh auto;
    padding: 40px 36px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.gate h1 {
    color: #2c3e50;
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.gate p.lead {
    color: #7f8c8d;
    margin-bottom: 32px;
    line-height: 1.5;
}

.gate-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.gate-actions a {
    display: block;
    padding: 14px 20px;
    border-radius: 50px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gate-actions a:hover {
    transform: translateY(-2px);
}

.btn-guest {
    background: #27ae60;
    color: #fff;
}

.btn-login {
    background: #3498db;
    color: #fff;
}

.btn-admin {
    background: #2c3e50;
    color: #fff;
}

.gate-foot {
    margin-top: 28px;
    font-size: 0.88rem;
    color: #95a5a6;
}

.gate-foot a {
    color: #3498db;
}
