:root {
    --bg: #0b0e14;
    --card: #1a1c2c;
    --primary: #9d50bb; 
    --accent: #00ff88;
    --text: #ffffff;
    --wpp: #25d366;
    --danger: #ff4b2b;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.promo-bar {
    width: 100%;
    background: linear-gradient(90deg, #9d50bb, #6e48aa);
    color: white;
    text-align: center;
    padding: 10px 0;
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    animation: glow-promo 3s infinite alternate;
}

@keyframes glow-promo {
    from { box-shadow: 0 0 5px rgba(157, 80, 187, 0.5); }
    to { box-shadow: 0 0 20px rgba(157, 80, 187, 0.8); }
}

header { 
    width: 90%;
    max-width: 1200px;
    padding: 40px 0;
    display: flex;
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap;
    gap: 20px;
}

.header-text {
    display: flex;
    flex-direction: column;
    align-items: center; 
    text-align: center;
}

@media (max-width: 850px) {
    header { justify-content: center; }
    .search-container { max-width: 100%; }
}

h1 { 
    color: var(--primary); 
    margin: 0; 
    letter-spacing: 3px; 
    font-size: 2.5rem; 
    text-shadow: 0 0 10px rgba(157, 80, 187, 0.3); 
}

.subtitle { color: #888; margin-top: 5px; font-size: 1.1rem; }

.search-container { width: 100%; max-width: 350px; }
#search-input {
    width: 100%;
    padding: 12px 20px;
    border-radius: 25px;
    border: 2px solid #2d314d;
    background: var(--card);
    color: white;
    outline: none;
    box-sizing: border-box;
    transition: 0.3s;
}

.vitrine {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    width: 90%;
    max-width: 1200px;
    margin-bottom: 80px;
    flex: 1;
}

.livro-card {
    background: var(--card);
    border-radius: 15px;
    padding: 15px;
    border: 1px solid #2d314d;
    text-align: center;
    display: flex;
    flex-direction: column;
    transition: 0.3s;
    position: relative;
}
.livro-card:hover { border-color: var(--primary); transform: translateY(-5px); }

.livro-img-container {
    width: 100%;
    aspect-ratio: 2 / 3;
    background: #080a12; 
    border-radius: 10px;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    border: 1px solid #2d314d;
}
.livro-img { width: 100%; height: 100%; object-fit: cover; }

.badge-last {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 5;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.btn-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    padding: 12px 10px;
    cursor: pointer;
    z-index: 10;
    border-radius: 5px;
    display: none;
    font-weight: bold;
}
.btn-prev { left: 5px; }
.btn-next { right: 5px; }
.livro-card:hover .btn-nav { display: block; }

.preco-unico { font-size: 1.4rem; color: var(--accent); font-weight: bold; margin-bottom: 15px; }

.btn-add {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}
.btn-add:disabled { background: #333; color: #777; cursor: not-allowed; }

#cart-button { 
    position: fixed; bottom: 30px; right: 30px; 
    background: var(--primary); color: white; 
    width: 65px; height: 65px; border-radius: 50%; 
    display: none; justify-content: center; align-items: center; 
    cursor: pointer; z-index: 1000; 
    animation: pulse-cart 2s infinite;
    font-size: 1.5rem;
}

@keyframes pulse-cart {
    0% { transform: scale(1); box-shadow: 0 4px 15px rgba(157, 80, 187, 0.4); }
    50% { transform: scale(1.1); box-shadow: 0 4px 25px rgba(157, 80, 187, 0.6); }
    100% { transform: scale(1); box-shadow: 0 4px 15px rgba(157, 80, 187, 0.4); }
}

#cart-count-badge { position: absolute; top: -5px; right: -5px; background: var(--danger); color: white; font-size: 0.8rem; padding: 4px 8px; border-radius: 50%; }

#toast-container { position: fixed; bottom: 30px; left: 30px; z-index: 3000; pointer-events: none; }
.toast { 
    background: var(--card); color: white; padding: 15px 25px; border-radius: 10px; border-left: 5px solid var(--primary); 
    margin-top: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.5); font-weight: bold; display: flex; align-items: center; gap: 10px;
    animation: slideIn 0.5s ease forwards, fadeOut 0.5s ease 2.5s forwards; 
}
@keyframes slideIn { from { transform: translateX(-120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; transform: translateX(-20px); } }

#cart-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 2000; justify-content: center; align-items: center; backdrop-filter: blur(5px); }
.modal-content { background: var(--card); width: 95%; max-width: 480px; border-radius: 15px; padding: 25px; max-height: 85vh; display: flex; flex-direction: column; border: 1px solid #333;}

#cart-items-list { overflow-y: auto; margin-bottom: 10px; flex: 1; }
.cart-item { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; background: #0b0e14; padding: 12px; border-radius: 10px; }

#error-msg { color: var(--danger); font-size: 0.85rem; text-align: center; margin-bottom: 10px; display: none; font-weight: bold; padding: 10px; border-radius: 8px; border: 1px solid var(--danger); }

.btn-checkout { background: var(--wpp); color: white; border: none; padding: 15px; width: 100%; border-radius: 8px; font-weight: bold; cursor: pointer; margin-top: 15px; }

.btn-esvaziar {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: bold;
    transition: 0.3s;
}
.btn-esvaziar:hover { background: var(--danger); color: white; }

footer { 
    width: 100%; padding: 40px 0; text-align: center; background: #07090d; color: #666; font-size: 0.85rem; 
    border-top: 1px solid #1a1c2c; margin-top: auto; line-height: 1.6;
}
footer a { color: var(--primary); text-decoration: none; font-weight: bold; }
footer a:hover { text-decoration: underline; }