/* Greggs Calorie Checker - Scoped Styles Only */
/* Updated: 2025-01-XX - Emoji-only UI */

/* Hero Banner */
.greggs-hero {
    position: relative;
    width: 100%;
    min-height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0;
}

.greggs-hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Fallback gradient */
    background: linear-gradient(135deg, #1e88e5 0%, #1565c0 50%, #fff8e1 100%);
    /* Background image removed - using img tag instead to avoid duplicate requests */
    z-index: 0;
}

.greggs-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.greggs-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.7) 100%);
    z-index: 1;
}

.greggs-hero-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    padding: 4rem 2rem;
    text-align: center;
    color: #fff;
}

.greggs-hero-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    text-shadow: 0 3px 12px rgba(0,0,0,0.6);
    color: #fff;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.greggs-hero-subtitle {
    font-size: 1.4rem;
    margin-bottom: 2rem;
    text-shadow: 0 2px 6px rgba(0,0,0,0.5);
    opacity: 0.95;
    line-height: 1.5;
    font-weight: 400;
}

.greggs-hero-disclaimer {
    font-size: 0.85rem;
    opacity: 0.85;
    background: rgba(0,0,0,0.4);
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    display: inline-block;
    border: 1px solid rgba(255,255,255,0.2);
    margin-bottom: 2rem;
    font-weight: 400;
}

.greggs-hero-cta {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: #c41e3a;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    text-transform: none;
    letter-spacing: 0.5px;
}

.greggs-hero-cta:hover {
    background: #b71c1c;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    color: #fff;
}

.greggs-hero-cta:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .greggs-hero {
        min-height: 400px;
    }
    
    .greggs-hero-content {
        padding: 3rem 1.5rem;
    }
    
    .greggs-hero-content h1 {
        font-size: 2.2rem;
        margin-bottom: 1rem;
    }
    
    .greggs-hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }
    
    .greggs-hero-disclaimer {
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
        margin-bottom: 1.5rem;
    }
    
    .greggs-hero-cta {
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }
}

.greggs-tool-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

@media (max-width: 768px) {
    .greggs-tool-container {
        padding: 2rem 1rem;
    }
}

.greggs-search-section {
    margin-bottom: 3rem;
}

.greggs-search-section h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #111827;
    letter-spacing: -0.02em;
}

@media (max-width: 768px) {
    .greggs-search-section h2 {
        font-size: 1.5rem;
    }
}

.greggs-search-box {
    position: relative;
    margin-bottom: 1rem;
}

.greggs-search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    color: #111827;
    box-sizing: border-box;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.greggs-search-input:focus {
    outline: none;
    border-color: #c41e3a;
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.greggs-search-input::placeholder {
    color: #9ca3af;
}

.greggs-category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    position: sticky;
    top: 0;
    background: #ffffff;
    padding: 12px 0;
    z-index: 10;
    border-bottom: 1px solid #f3f4f6;
}

.greggs-category-btn {
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.greggs-category-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.greggs-category-btn.active {
    background: #c41e3a;
    color: #ffffff;
    border-color: #c41e3a;
    box-shadow: 0 2px 4px 0 rgba(196, 30, 58, 0.2);
}

.greggs-category-btn.active:hover {
    background: #b71c1c;
    border-color: #b71c1c;
}

/* Products Grid */
.greggs-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    padding: 0;
    background: transparent;
}

@media (min-width: 768px) {
    .greggs-products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1024px) {
    .greggs-products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 767px) {
    .greggs-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .greggs-products-grid {
        grid-template-columns: 1fr;
    }
}

/* Product Card - Emoji-only UI */
.gs-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px;
    background: transparent;
    border: none;
    box-shadow: none;
    margin: 0;
    gap: 6px;
}

/* Professional Emoji Size */
.gs-emoji {
    font-size: 72px;
    line-height: 1;
    display: block;
    text-align: center;
    margin: 0 auto;
    background: transparent;
    border: none;
    box-shadow: none;
    width: auto;
    height: auto;
    padding: 0;
}

@media (max-width: 1023px) {
    .gs-emoji {
        font-size: 64px;
    }
}

@media (max-width: 767px) {
    .gs-emoji {
        font-size: 56px;
    }
}

@media (max-width: 479px) {
    .gs-emoji {
        font-size: 52px;
    }
}

/* Product Name */
.gs-name {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #111827;
    margin: 0;
    text-align: center;
    letter-spacing: -0.01em;
}

/* Kcal */
.gs-kcal {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0;
    font-weight: 500;
    text-align: center;
}

/* Badge */
.gs-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f3f4f6;
    color: #4b5563;
    padding: 4px 10px;
    border-radius: 12px;
    margin: 0;
    width: fit-content;
    border: none;
}

/* Add Button - Compact Pill */
.gs-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    padding: 8px 14px;
    background: #c41e3a;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    margin: 0;
    letter-spacing: 0.01em;
    min-height: 36px;
}

.gs-add:hover {
    background: #b71c1c;
    transform: scale(1.02);
}

.gs-add:active {
    background: #a01818;
    transform: scale(0.98);
}

.gs-add:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.gs-add .greggs-processing {
    color: #ffffff;
}

.gs-add .greggs-spinner {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
}

/* Selected Items Section */
.greggs-selected-section {
    margin-top: 3rem;
    padding: 2rem;
    background: #ffffff;
    border: 2px solid #c41e3a;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.greggs-selected-section h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary, #333);
}

@media (max-width: 768px) {
    .greggs-selected-section {
        padding: 1.5rem;
    }
    
    .greggs-selected-section h2 {
        font-size: 1.5rem;
    }
}

.greggs-selected-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.greggs-selected-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    background: var(--card-background, #fff);
}

.greggs-selected-thumb {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #c41e3a 0%, #fff8e1 100%);
}

.greggs-selected-thumb svg {
    width: 100%;
    height: 100%;
    display: block;
}

.greggs-selected-info {
    flex: 1;
    min-width: 0;
}

.greggs-selected-name {
    font-weight: 600;
    color: var(--text-primary, #333);
    margin-bottom: 0.25rem;
}

.greggs-selected-nutrition {
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
}

.greggs-quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.greggs-qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color, #ddd);
    background: var(--surface, #f5f5f5);
    color: var(--text-primary, #333);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.greggs-qty-btn:hover {
    background: var(--primary-color, #007bff);
    color: white;
    border-color: var(--primary-color, #007bff);
}

.greggs-qty-value {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary, #333);
}

.greggs-remove-btn {
    padding: 0.5rem 1rem;
    background: var(--secondary-color, #dc3545);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: opacity 0.3s ease;
}

.greggs-remove-btn:hover {
    opacity: 0.9;
}

.greggs-totals-section {
    padding: 1.5rem;
    background: var(--card-background, #fff);
    border: 2px solid var(--primary-color, #007bff);
    border-radius: 8px;
    margin-top: 1rem;
}

.greggs-totals-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary, #333);
}

.greggs-totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.greggs-total-item {
    display: flex;
    flex-direction: column;
}

.greggs-total-label {
    font-size: 0.9rem;
    color: var(--text-secondary, #666);
    margin-bottom: 0.25rem;
}

.greggs-total-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color, #007bff);
}

.greggs-clear-btn {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--secondary-color, #dc3545);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: opacity 0.3s ease;
}

.greggs-clear-btn:hover {
    opacity: 0.9;
}

.greggs-empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary, #666);
}

/* Product emoji icon (for selected items, keep small) */
.greggs-tool .greggs-product-emoji {
    font-size: 1.5rem;
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
    flex-shrink: 0;
}

/* Processing state */
.greggs-processing {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #ffffff;
    font-size: 0.875rem;
}

.greggs-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.greggs-results-header {
    text-align: center;
    padding: 1rem;
    color: var(--text-secondary, #666);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color, #ddd);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .greggs-tool-container {
        padding: 1rem 0.5rem;
    }
    
    .greggs-products-grid {
        gap: 14px;
    }
    
    .greggs-selected-item {
        flex-wrap: wrap;
        padding: 0.75rem;
    }
    
    .greggs-totals-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .greggs-total-value {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .greggs-selected-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .greggs-quantity-controls {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   REMOVE ALL LEGACY CARD STYLES
   Ensure no white boxes/shadows appear
   ============================================ */

/* Hide legacy product item classes */
.greggs-tool .greggs-product-item,
.greggs-tool .psa-card,
.greggs-tool .greggs-product-tile {
    display: none !important;
}

/* Remove any image/thumbnail wrappers */
.greggs-tool [class*="img-wrap"],
.greggs-tool [class*="thumb"],
.greggs-tool [class*="overlay"],
.greggs-tool .image-wrap,
.greggs-tool .thumb,
.greggs-tool .overlay,
.greggs-tool .psa-thumb,
.greggs-tool .product-img-wrap,
.greggs-tool .psa-thumb-overlay,
.greggs-tool .greggs-product-image,
.greggs-tool .greggs-product-placeholder {
    display: none !important;
}

/* Nuclear override - ensure .gs-card has NO background/shadow/border */
body.greggs-calorie-checker .gs-card,
.greggs-calorie-checker .gs-card,
.greggs-tool .gs-card {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 12px !important;
    margin: 0 !important;
    gap: 6px !important;
}

body.greggs-calorie-checker .gs-card::before,
body.greggs-calorie-checker .gs-card::after,
.greggs-calorie-checker .gs-card::before,
.greggs-calorie-checker .gs-card::after,
.greggs-tool .gs-card::before,
.greggs-tool .gs-card::after {
    display: none !important;
    content: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* Professional emoji sizing - override any conflicting styles */
body.greggs-calorie-checker .gs-emoji,
.greggs-calorie-checker .gs-emoji,
.greggs-tool .gs-emoji {
    font-size: 72px;
    line-height: 1;
    text-align: center;
    margin: 0 auto;
    display: block;
    background: transparent;
    border: none;
    box-shadow: none;
    width: auto;
    height: auto;
    padding: 0;
}

@media (max-width: 1023px) {
    body.greggs-calorie-checker .gs-emoji,
    .greggs-calorie-checker .gs-emoji,
    .greggs-tool .gs-emoji {
        font-size: 64px;
    }
}

@media (max-width: 767px) {
    body.greggs-calorie-checker .gs-emoji,
    .greggs-calorie-checker .gs-emoji,
    .greggs-tool .gs-emoji {
        font-size: 56px;
    }
}

@media (max-width: 479px) {
    body.greggs-calorie-checker .gs-emoji,
    .greggs-calorie-checker .gs-emoji,
    .greggs-tool .gs-emoji {
        font-size: 52px;
    }
}

/* ============================================
   FINAL HARD OVERRIDE - GUARANTEE EMOJI-ONLY UI
   Target the exact container ID to ensure styles apply
   ============================================ */
#greggsProducts .gs-card,
#greggsProducts .gs-card * {
    box-shadow: none !important;
}

#greggsProducts .gs-card {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    padding: 12px !important;
    margin: 0 !important;
    gap: 6px !important;
}

#greggsProducts .gs-emoji {
    font-size: 72px;
    line-height: 1;
    text-align: center;
    margin: 0 auto;
    display: block;
    background: transparent;
    border: none;
    box-shadow: none;
    width: auto;
    height: auto;
    padding: 0;
}

@media (max-width: 1023px) {
    #greggsProducts .gs-emoji {
        font-size: 64px;
    }
}

@media (max-width: 767px) {
    #greggsProducts .gs-emoji {
        font-size: 56px;
    }
}

@media (max-width: 479px) {
    #greggsProducts .gs-emoji {
        font-size: 52px;
    }
}
