/* matpriser-specific.css - Matpriser Norge spesifikk styling */

/* Food price specific gradient (green/fresh theme for groceries) */
body {
    background: linear-gradient(135deg, #10b981 0%, #059669 25%, #047857 50%, #065f46 75%, #064e3b 100%);
}

.calculator-card {
    border: 2px solid rgba(16, 185, 129, 0.3);
    max-width: 1200px;
}

/* Stats Dashboard */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 2px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    border-left: 4px solid #10b981;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.2);
}

.stat-icon {
    display: block;
    font-size: 2em;
    margin-bottom: 8px;
}

.stat-label {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 5px;
    font-weight: 500;
}

.stat-value {
    display: block;
    font-size: 1.2em;
    font-weight: 700;
    color: #065f46;
}

/* Search Section */
.search-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.search-section h3 {
    color: #065f46;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.search-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#productSearch {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #d1fae5;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
}

#productSearch:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.search-btn {
    padding: 12px 25px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.filter-row select {
    padding: 10px;
    border: 2px solid #d1fae5;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-row select:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Search Results */
.search-results {
    margin-bottom: 25px;
}

.search-results h3 {
    color: #065f46;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.product-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    border: 2px solid rgba(16, 185, 129, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-color: #10b981;
}

.product-card img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    margin-bottom: 10px;
    border-radius: 8px;
    background: #f9fafb;
}

.product-card h4 {
    font-size: 0.95em;
    color: #1f2937;
    margin-bottom: 5px;
    min-height: 40px;
    line-height: 1.3;
}

.product-card .brand {
    font-size: 0.85em;
    color: #6b7280;
    margin-bottom: 8px;
}

.product-card .price {
    font-size: 1.3em;
    font-weight: 700;
    color: #065f46;
    margin-bottom: 3px;
}

.product-card .unit-price {
    font-size: 0.9em;
    color: #6b7280;
    margin-bottom: 10px;
}

.product-actions {
    display: flex;
    gap: 5px;
    margin-top: auto;
}

.product-actions button {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.85em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.product-actions button:first-child {
    background: #10b981;
    color: white;
}

.product-actions button:first-child:hover {
    background: #059669;
}

.product-actions button:last-child {
    background: #e5e7eb;
    color: #374151;
}

.product-actions button:last-child:hover {
    background: #d1d5db;
}

/* Comparison Section */
.comparison-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.comparison-section h3 {
    color: #065f46;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.basket-builder {
    margin-bottom: 20px;
}

.basket-items {
    background: #f9fafb;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    min-height: 100px;
}

.basket-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
}

.basket-item button {
    padding: 5px 10px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85em;
}

.basket-item button:hover {
    background: #dc2626;
}

.info-text {
    color: #6b7280;
    text-align: center;
    font-style: italic;
}

/* Comparison Results */
.comparison-results {
    margin-top: 20px;
}

.comparison-results h4 {
    color: #065f46;
    margin-bottom: 15px;
}

.store-totals {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.store-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.store-total.cheapest {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 2px solid #10b981;
}

.store-name {
    font-weight: 600;
    color: #1f2937;
}

.store-price {
    font-weight: 700;
    color: #065f46;
    font-size: 1.1em;
}

.badge {
    background: #10b981;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

/* Price History Section */
.price-history-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.price-history-section h3 {
    color: #065f46;
    margin-bottom: 15px;
    font-size: 1.1em;
}

/* Store Finder Section */
.store-finder-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.store-finder-section h3 {
    color: #065f46;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.location-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#locationSearch {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid #d1fae5;
    border-radius: 10px;
    font-size: 15px;
}

.location-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.location-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.store-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.store-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.store-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.store-card h4 {
    color: #065f46;
    margin-bottom: 10px;
}

.store-card p {
    color: #6b7280;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.opening-hours {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.opening-hours strong {
    display: block;
    color: #374151;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.opening-hours p {
    margin: 3px 0;
    font-size: 0.85em;
}

/* Override calculate button for food theme */
.calculate-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calculate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(16, 185, 129, 0.4);
}

/* Info Note */
.info-note {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    font-size: 14px;
    color: #065f46;
}

/* No results message */
.no-results {
    text-align: center;
    padding: 40px;
    color: #6b7280;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .stats-dashboard {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .search-controls {
        flex-direction: column;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .location-controls {
        flex-direction: column;
    }
    
    .location-btn {
        width: 100%;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .product-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-dashboard {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .store-results {
        grid-template-columns: 1fr;
    }
}

/* ---- Overrides merged in ---- */

/* matpriser-mobile-overrides.css — lightweight tweaks only */

/* Slightly smaller product cards (keep original look) */
.results-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.product-card { padding: 12px; border-radius: 12px; }
.product-card img { height: 130px; }

/* Keep secondary buttons subtle, primary full-width */
.product-actions-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.product-actions-primary .primary { width: 100%; font-weight: 700; }

/* Toggle state for basket button (red when removing) */
.product-actions-primary .primary.remove {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: #fff !important;
}

/* Load-more button styling (match theme) */
.load-more-container { text-align:center; margin-top: 12px; }
.load-more-btn {
  padding: 10px 18px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff; border: 0; border-radius: 10px; font-weight: 700;
}
.load-more-btn:disabled { opacity: .6; }

/* Floating 'Se kurv' button */
.floating-cart-btn {
  position: fixed; right: 14px; bottom: 84px; z-index: 50;
  padding: 10px 14px; border-radius: 9999px; border: 0;
  background: #065f46; color: #fff; font-weight: 700;
  box-shadow: 0 6px 16px rgba(6,95,70,.25);
}

/* Mobile-first refinements (only small tweaks) */
@media (max-width: 640px) {
  .results-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .product-card { padding: 10px; }
  .product-card img { height: 110px; }
  .product-card h4 { font-size: .95em; min-height: 36px; }
  .product-card .brand { font-size: .85em; }
  .product-card .price { font-size: 1.15em; }
  .product-card .unit-price { font-size: .85em; }

  /* Stack all action buttons on phones so nothing overflows */
  .product-actions-secondary { display: flex; flex-direction: column; gap: 6px; }
  .product-actions-secondary button { width: 100%; }
  .product-actions-primary .primary { padding: 10px 12px; }
}

/* Ultra-narrow screens */
@media (max-width: 360px) {
  .results-grid { grid-template-columns: 1fr; }
  .product-card img { height: 100px; }
}

/* ---- Quantity controls + badge (added) ---- */
.qty-controls { display:flex; justify-content: center; gap: 8px; margin-top: 8px; }
.qty-btn {
  padding: 8px 12px; border: none; border-radius: 10px;
  background:#e5e7eb; color:#111827; font-weight:700; font-size:16px; line-height:1;
}
.qty-btn:active { transform: translateY(1px); }
.qty-badge {
  margin-top: 8px; text-align:center; padding:8px 10px; border-radius: 10px;
  background:#f3f4f6; color:#374151; font-weight:700; font-size: 0.95em;
}
.qty-badge.has-items { background:#d1fae5; color:#065f46; }

/* Basket list styling adjustments for qty */
.basket-item { padding:8px 10px; border-bottom:1px solid #f3f4f6; }
.basket-line { display:grid; grid-template-columns: 1fr auto auto auto; gap:8px; align-items:center; }
.basket-qty-controls { display:flex; gap:6px; align-items:center; }
.basket-qty-controls .qty-btn { padding:6px 10px; }
.basket-price { font-weight:700; color:#065f46; }
.remove-line { border:none; background:#fee2e2; color:#b91c1c; border-radius:8px; padding:6px 8px; }

@media (max-width: 640px) {
  .basket-line { grid-template-columns: 1fr auto auto; grid-template-areas: 
    "name qty remove"
    "price qty remove"; 
  }
  .basket-name { grid-area: name; }
  .basket-price { grid-area: price; }
}

/* Keep secondary buttons subtle and stacked on mobile (already in merged overrides) */


/* --- Quantity controls visual polish --- */
.qty-controls {
  display:flex; align-items:center; justify-content:center; gap:10px; margin-top:8px;
}
.qty-btn {
  padding: 10px 14px; border:none; border-radius: 12px;
  color:#fff; font-weight:800; font-size:18px; line-height:1; cursor:pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.qty-btn.minus { background: linear-gradient(135deg,#ef4444,#dc2626); }
.qty-btn.plus  { background: linear-gradient(135deg,#10b981,#059669); }
.qty-btn:active { transform: translateY(1px); }

.qty-count {
  min-width: 32px; text-align:center; font-weight:800; color:#111827;
  background:#f3f4f6; border-radius:10px; padding:6px 8px;
  box-shadow: inset 0 0 0 1px #e5e7eb;
}

@media (max-width: 640px) {
  .qty-btn { padding: 10px 12px; font-size: 18px; }
  .qty-count { min-width: 28px; }
}

/* --- Prevent iOS Safari zoom on form focus --- */
html { -webkit-text-size-adjust: 100%; }
input, select, textarea, button { font-size: 16px !important; }
input[type="search"] { -webkit-appearance: none; font-size: 16px !important; }

/* --- Search loader (shown during product search) --- */
.search-loader { display: none; align-items: center; gap: 8px; margin-top: 8px; font-weight: 600; }
.search-loader.show { display: inline-flex; }
.search-loader .spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(0,0,0,.15); border-top-color: currentColor; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Make 'Se kurv' button more obvious --- */
.floating-cart-btn {
  position: fixed; right: 14px; bottom: 84px; z-index: 60;
  padding: 14px 18px; border-radius: 9999px; border: 0;
  background: linear-gradient(135deg,#f59e0b,#d97706); color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 12px 24px rgba(217,119,6,.35), 0 0 0 3px rgba(255,255,255,.65) inset;
  transform: translateZ(0);
}
.floating-cart-btn:hover { transform: scale(1.04); }
.floating-cart-btn::after { content: '↑'; margin-left: 8px; font-weight: 900; }
@media (max-width: 640px) {
  .floating-cart-btn { bottom: 68px; padding: 12px 16px; font-size: 14px; }
}


/* --- Floating cart button badge & arrow --- */
.floating-cart-btn { position: fixed; right: 14px; bottom: 84px; z-index: 60; display: inline-flex; align-items: center; gap: 10px; }
.floating-cart-btn .cart-count-badge {
  display: inline-flex; align-items:center; justify-content:center;
  min-width: 24px; height: 24px; padding: 0 6px;
  background: #111827; color: #fff; font-weight: 800; border-radius: 9999px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.floating-cart-btn .cart-count-badge.has-items { background: #ef4444; }
.floating-cart-btn::after { content: '↓'; font-weight: 900; margin-left: 6px; }

/* Ensure plus/minus retain green/red colors */
.qty-btn.minus { background: linear-gradient(135deg,#ef4444,#dc2626); color:#fff; }
.qty-btn.plus  { background: linear-gradient(135deg,#10b981,#059669); color:#fff; }

/* Search loader visibility already handled; no change needed */
