/*
Theme Name: Catálogo Virtual
Theme URI: https://example.com
Author: Seu Nome
Author URI: https://example.com
Description: Tema WordPress focado em catálogo virtual responsivo com carrinho e orçamento
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: catalogo-virtual
*/

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #f9fafb;
    --white: #ffffff;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.site-header {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    line-height: 1;
}

.site-logo {
    max-height: 50px;
    width: auto;
    display: block;
    object-fit: contain;
}

@media (max-width: 768px) {
    .site-title {
        font-size: 1.2rem;
    }
    
    .site-logo {
        max-height: 40px;
    }
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-toggle,
.cart-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    position: relative;
    color: var(--text-color);
}

.cart-count {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Search Bar */
.search-bar {
    background: var(--white);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: none;
}

.search-bar.active {
    display: block;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
}

.search-button {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
}

/* Categories */
.categories-section {
    background: var(--white);
    padding: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.categories-list {
    display: flex;
    gap: 0.75rem;
    list-style: none;
    min-width: min-content;
}

.category-item {
    flex-shrink: 0;
}

.category-link {
    display: block;
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border-radius: 2rem;
    text-decoration: none;
    color: var(--text-color);
    white-space: nowrap;
    transition: all 0.3s ease;
}

.category-link:hover,
.category-link.active {
    background: var(--primary-color);
    color: var(--white);
}

/* Products Grid */
.products-section {
    padding: 1.5rem 1rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

.product-card {
    background: var(--white);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.product-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--success-color);
    color: var(--white);
    padding: 0.35rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-color);
}

.product-info {
    padding: 1rem;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.add-to-cart-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}

.add-to-cart-btn:hover {
    background: var(--secondary-color);
}

/* Cart Sidebar */
.cart-sidebar {
    position: fixed;
    right: -100%;
    top: 0;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    transition: right 0.3s ease;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.active {
    right: 0;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1999;
}

.cart-overlay.active {
    display: block;
}

.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.cart-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 0.5rem;
    background: var(--bg-color);
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.cart-item-price {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.qty-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    background: var(--white);
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 700;
}

.qty-value {
    min-width: 30px;
    text-align: center;
}

.remove-item {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    padding: 0.5rem;
}

.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.checkout-btn {
    width: 100%;
    padding: 1rem;
    background: var(--success-color);
    color: var(--white);
    border: none;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
}

.empty-cart {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

/* Modal de Produto */
.product-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 3000;
    overflow-y: auto;
}

.product-modal.active {
    display: block;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    max-width: 900px;
    margin: 2rem auto;
    background: var(--white);
    border-radius: 1rem;
    padding: 2rem;
    z-index: 1;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-color);
    z-index: 10;
}

/* Galeria do Modal */
.modal-gallery {
    margin-bottom: 1.5rem;
}

.modal-gallery-main {
    position: relative;
    width: 100%;
    max-height: 500px;
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--bg-color);
}

.modal-image {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    display: block;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 5;
}

.gallery-nav:hover {
    background: var(--white);
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gallery-prev {
    left: 10px;
}

.gallery-next {
    right: 10px;
}

.gallery-counter {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 5;
}

.modal-gallery-thumbs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.modal-gallery-thumbs::-webkit-scrollbar {
    height: 6px;
}

.modal-gallery-thumbs::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 3px;
}

.modal-gallery-thumbs::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.gallery-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.gallery-thumb:hover {
    border-color: var(--primary-color);
    opacity: 0.8;
}

.gallery-thumb.active {
    border-color: var(--primary-color);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-title {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.modal-description {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.modal-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

/* Checkout Page */
.checkout-section {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.checkout-form {
    background: var(--white);
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.form-section {
    margin-bottom: 2rem;
}

.form-section h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.order-summary {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.summary-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
}

.submit-order-btn {
    width: 100%;
    padding: 1rem;
    background: var(--success-color);
    color: var(--white);
    border: none;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
}

/* Responsividade Mobile-First */
@media (max-width: 768px) {
    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
    }
}

/* Ocultar categorias na página de checkout */
.page-template-page-finalizar-orcamento .categories-section {
    display: none;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Notifications */
.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success-color);
    color: var(--white);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 4000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
    }
    to {
        transform: translateX(0);
    }
}
