/* ==========================================================================
   Guia Caqui — Estilos principais
   ========================================================================== */

/* ── Reset e variáveis globais ──────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient : linear-gradient(135deg, #B71C1C 0%, #C62828 50%, #FF8F00 100%);
    --secondary-gradient: linear-gradient(135deg, #2E7D32 0%, #4CAF50 100%);
    --accent-gradient  : linear-gradient(135deg, #B71C1C 0%, #FF8F00 100%);
    --text-color       : #2c3e50;
    --light-text       : #ecf0f1;
    --bg-color         : #f8f9fa;
    --card-bg          : #ffffff;
    --border-radius    : 16px;
    --shadow           : 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-hover     : 0 20px 40px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
                 Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
header {
    background: var(--primary-gradient);
    color: var(--light-text);
    padding: 4rem 1rem 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(20px); }
}

h1 {
    font-family: Helvetica, Arial, sans-serif;
    font-size: 3rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    position: relative;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: -1px;
}

h1 img {
    height: 80px;
    width: auto;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

h1 img:hover {
    transform: scale(1.05);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
    line-height: 3;
}

/* ── Search container ───────────────────────────────────────────────────── */
.search-container {
    max-width: 800px;
    width: 75%;
    margin: -50px auto 80px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.search-box {
    display: flex;
    background: var(--card-bg);
    border-radius: 50px;
    box-shadow: var(--shadow);
    overflow: hidden;
    padding: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    box-shadow: var(--shadow-hover);
    transform: translateY(-5px);
}

#searchInput {
    flex: 1;
    border: none;
    padding: 18px 28px;
    font-size: 1.1rem;
    outline: none;
    border-radius: 50px 0 0 50px;
    background: transparent;
    color: var(--text-color);
    font-weight: 500;
}

#searchInput::placeholder {
    color: #bdc3c7;
    font-weight: 400;
}

#searchBtn {
    background: #f06440;
    color: white;
    border: none;
    padding: 0 40px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

#searchBtn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

#searchBtn:active:not(:disabled) {
    transform: scale(0.98);
}

#searchBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Container principal ────────────────────────────────────────────────── */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
    width: 100%;
}

.status-message {
    text-align: center;
    margin: 30px 0 20px;
    font-size: 1.1rem;
    color: #7f8c8d;
    font-weight: 500;
}

/* ── Loader ─────────────────────────────────────────────────────────────── */
.loader {
    display: none;
    width: 50px;
    height: 50px;
    margin: 40px auto;
    border: 4px solid #ecf0f1;
    border-top: 4px solid #e74c3c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Grid de resultados ─────────────────────────────────────────────────── */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 30px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Cards de ofertas ───────────────────────────────────────────────────── */
.offer-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid #ecf0f1;
    position: relative;
    overflow: hidden;
}

.offer-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b6b 0%, #ff8c42 100%);
}

.offer-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: #e74c3c;
}

.supermarket-badge {
    display: inline-block;
    background: var(--secondary-gradient);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-name {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.4;
    color: var(--text-color);
}

.product-details {
    color: #95a5a6;
    font-size: 0.95rem;
    margin-bottom: 16px;
    font-weight: 500;
}

.price-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.current-price {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8c42 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.original-price {
    text-decoration: line-through;
    color: #bdc3c7;
    font-size: 1.1rem;
    font-weight: 500;
}

.discount-badge {
    background: var(--secondary-gradient);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.update-time {
    font-size: 0.85rem;
    color: #bdc3c7;
    text-align: right;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #ecf0f1;
    font-weight: 500;
}

/* ── Botões de ação (Compartilhar e Visitar Loja) ───────────────────────── */
.card-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #ecf0f1;
}

.action-button {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    text-align: center;
}

.action-button img {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.share-button {
    background: linear-gradient(135deg, #FF5252 0%, #E53935 100%);
    color: white;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgb(243, 139, 3);
}

.supermarket-link {
    background: linear-gradient(135deg, #E53935 0%, #B71C1C 100%);
    color: white;
}

.supermarket-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgb(243, 139, 3);
}

.action-button:active {
    transform: translateY(0);
}

/* ── Rodapé ─────────────────────────────────────────────────────────────── */
footer {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #ecf0f1;
    padding: 40px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    width: 100%;
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.footer-links {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.footer-links a {
    color: #ecf0f1;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
}

.footer-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
}

.footer-links a:hover::after { width: 100%; }
.footer-links a:hover         { color: #ff8f00; }

.footer-copyright {
    text-align: center;
    font-size: 0.9rem;
    color: #95a5a6;
    font-weight: 500;
}

/* ── Alertas ────────────────────────────────────────────────────────────── */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin: 20px 0;
    border-left: 4px solid;
    display: none;
    animation: slideIn 0.3s ease;
    font-weight: 500;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

.alert.show { display: block; }

.alert-error   { background: linear-gradient(135deg, #fadbd8, #f5b7b1); color: #c0392b; border-left-color: #e74c3c; }
.alert-warning { background: linear-gradient(135deg, #fef5e7, #fdebd0); color: #d68910; border-left-color: #f39c12; }
.alert-success { background: linear-gradient(135deg, #d5f4e6, #abebc6); color: #186a3b; border-left-color: #27ae60; }
.alert-info    { background: linear-gradient(135deg, #d6eaf8, #aed6f1); color: #0c5460; border-left-color: #3498db; }

/* ── Estado vazio ───────────────────────────────────────────────────────── */
.empty-state       { text-align: center; padding: 60px 20px; color: #95a5a6; }
.empty-state-icon  { font-size: 3rem; margin-bottom: 20px; }
.empty-state-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 10px; color: var(--text-color); }
.empty-state-text  { font-size: 1rem; color: #95a5a6; }

/* ── Responsividade ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    h1           { font-size: 2.2rem; }
    .subtitle    { font-size: 1rem; }

    .search-container { margin: -30px auto 40px; }

    .search-box {
        flex-direction: column;
        border-radius: 16px;
        padding: 12px;
    }

    #searchInput {
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 16px 20px;
    }

    #searchBtn {
        border-radius: 12px;
        padding: 16px 20px;
        width: 100%;
    }

    .results-grid { grid-template-columns: 1fr; gap: 16px; }
    .offer-card   { padding: 20px; }
    .current-price { font-size: 1.8rem; }
    .product-name  { font-size: 1.2rem; }

    .footer-links a      { font-size: 0.85rem; }
    .footer-links        { gap: 20px; }
    .footer-copyright    { font-size: 0.8rem; }
}

@media (max-width: 480px) {
    header { padding: 2rem 1rem 1.5rem; }
    h1     { font-size: 1.8rem; }
    .subtitle          { font-size: 0.95rem; }
    .search-container  { margin: -25px auto 30px; }
    .container         { padding: 15px; }
    .alert             { padding: 12px 16px; font-size: 0.95rem; }
}
