/* Reset e configurações globais */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header atualizado */
.header {
    background-color: #000;
    color: #fff;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Logo e perfil lado a lado */
.logo-and-profile {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    background: #f5f5f5;
    border: 2px solid white;
}

/* Perfil ao lado da logo */
.header-profile {
    position: relative;
    margin-left: auto;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background-color 0.3s;
    font-size: 14px;
}

.profile-btn:hover {
    background-color: rgba(255,255,255,0.1);
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.profile-info {
    text-align: left;
}

.profile-name {
    font-weight: 500;
    font-size: 14px;
}

.profile-email {
    font-size: 12px;
    opacity: 0.8;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Menu do perfil dropdown */
.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    min-width: 200px;
    z-index: 1001;
    display: none;
    margin-top: 5px;
    border: 1px solid #eee;
}

.profile-dropdown.active {
    display: block;
    animation: slideDown 0.3s ease;
}

.dropdown-header {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    border-radius: 8px 8px 0 0;
}

.dropdown-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    margin: 0 auto 10px;
}

.dropdown-email {
    font-size: 14px;
    color: #666;
    text-align: center;
    word-break: break-all;
    padding: 0 10px;
}

.dropdown-actions {
    padding: 10px 0;
}

.dropdown-action {
    width: 100%;
    padding: 12px 20px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
    font-size: 14px;
    transition: background 0.3s;
}

.dropdown-action:hover {
    background: #f5f5f5;
}

.dropdown-action.logout {
    color: #dc3545;
    border-top: 1px solid #eee;
}

/* Botões de autenticação */
.auth-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-link {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s;
    padding: 6px 12px;
    border-radius: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.auth-link:hover {
    color: #ddd;
    background-color: rgba(255,255,255,0.1);
}

/* Search bar */
.search-bar {
    flex: 1;
    max-width: 500px;
    display: flex;
}

.search-bar input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    background: white;
}

.search-bar button {
    background-color: #555;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-bar button:hover {
    background-color: #666;
}

/* Cart icon */
.cart-icon {
    position: relative;
}

.cart-icon span {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #fff;
    color: #000;
    font-size: 12px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Botão de compra direta */
.btn-buy {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.3s;
    width: 100%;
    justify-content: center;
    margin-top: 10px;
}

.btn-buy:hover {
    background-color: #218838;
}

.btn-buy:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Modal base */
.modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    position: relative;
    animation: modalOpen 0.3s;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-scrollable {
    overflow-y: auto;
    flex: 1;
    padding-right: 5px;
    margin-right: -5px;
}

.modal-scrollable::-webkit-scrollbar {
    width: 5px;
}

.modal-scrollable::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-scrollable::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.modal-scrollable::-webkit-scrollbar-thumb:hover {
    background: #555;
}

@keyframes modalOpen {
    from {transform: scale(0.8); opacity: 0;}
    to {transform: scale(1); opacity: 1;}
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
    z-index: 1000;
}

.close:hover {
    color: #000;
    background-color: #f5f5f5;
}

/* Modal de checkout */
.checkout-modal {
    max-width: 500px;
}

.checkout-products {
    max-height: 200px;
    overflow-y: auto;
    margin: 20px 0;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
}

.checkout-product {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.checkout-product:last-child {
    border-bottom: none;
}

.checkout-product-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 15px;
    background: #f5f5f5;
}

.checkout-product-info {
    flex: 1;
}

.checkout-product-name {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
}

.checkout-product-price {
    color: #666;
    font-size: 13px;
}

.checkout-currency-selector {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.checkout-currency-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.currency-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.currency-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.currency-option:hover {
    border-color: #999;
}

.currency-option.selected {
    border-color: #000;
    background: #f8f9fa;
}

.currency-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.currency-name {
    flex: 1;
    font-size: 13px;
}

.checkout-total {
    display: flex;
    justify-content: space-between;
    font-size: 20px;
    font-weight: bold;
    margin: 20px 0;
    padding-top: 20px;
    border-top: 2px solid #000;
}

.checkout-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.checkout-btn {
    flex: 1;
    padding: 15px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.checkout-btn:hover {
    background-color: #218838;
}

/* Modal de Autenticação */
.auth-modal {
    max-width: 400px;
    animation: modalOpen 0.4s ease;
}

.auth-tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 2px solid #eee;
    gap: 10px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    color: #333;
    background-color: #f8f9fa;
}

.tab-btn.active {
    color: #000;
    border-bottom: 3px solid #000;
    background-color: #f8f9fa;
    font-weight: 600;
}

.tab-btn i {
    font-size: 14px;
}

.auth-form {
    display: none;
    animation: fadeIn 0.5s ease;
}

.auth-form.active {
    display: block;
}

.auth-form .form-group {
    margin-bottom: 20px;
    position: relative;
}

.auth-form input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    background-color: #fff;
    color: #333;
}

.auth-form input:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.auth-form input::placeholder {
    color: #999;
}

.btn-submit {
    width: 100%;
    padding: 15px;
    background-color: #000;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-submit:hover {
    background-color: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-submit:active {
    transform: translateY(0);
}

/* Campo de senha */
.password-wrapper {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    padding: 5px;
    border-radius: 4px;
    transition: color 0.3s;
}

.toggle-password:hover {
    color: #000;
    background-color: #f5f5f5;
}

/* Links adicionais */
.auth-links {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.auth-links a {
    color: #000;
    text-decoration: none;
    font-weight: 500;
    margin: 0 5px;
    transition: color 0.3s;
}

.auth-links a:hover {
    color: #333;
    text-decoration: underline;
}

/* Carrossel */
.banner-section {
    margin-bottom: 40px;
}

.carousel {
    position: relative;
    height: 400px;
    overflow: hidden;
}

.carousel-slides {
    height: 100%;
    position: relative;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background-size: cover !important;
    background-position: center !important;
}

.slide.active {
    opacity: 1;
}

.slide-content {
    text-align: center;
    padding: 40px;
    background: rgba(0,0,0,0.7);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    max-width: 80%;
}

.slide-content h2 {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.slide-content p {
    font-size: 24px;
    opacity: 0.9;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-btn:hover {
    background: rgba(255,255,255,0.3);
}

.carousel-btn.prev {
    left: 20px;
}

.carousel-btn.next {
    right: 20px;
}

.carousel-dots {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.3s;
}

.dot.active {
    background: white;
}

/* Produtos */
.products-section {
    padding: 40px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 40px;
    font-size: 32px;
    color: #333;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #eee;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f5f5f5;
}

.product-info {
    padding: 20px;
}

.product-title {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
    height: 40px;
    overflow: hidden;
}

.product-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    height: 60px;
    overflow: hidden;
}

.product-price {
    font-size: 20px;
    font-weight: bold;
    color: #000;
    margin-bottom: 15px;
}

/* Footer */
.footer {
    background-color: #000;
    color: #fff;
    padding: 40px 0 20px;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: #fff;
}

.footer-section p {
    margin-bottom: 10px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-section i {
    width: 20px;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #333;
    opacity: 0.6;
    font-size: 14px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
    grid-column: 1 / -1;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* RESPONSIVIDADE PARA CELULAR */
@media (max-width: 768px) {
    /* Header para celular */
    .header {
        padding: 10px 0;
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .logo-and-profile {
        width: 100%;
        justify-content: space-between;
        order: 1;
    }
    
    .logo {
        flex-shrink: 0;
    }
    
    .logo-img {
        width: 40px;
        height: 40px;
    }
    
    .header-profile {
        margin-left: 0;
    }
    
    .profile-btn {
        padding: 5px 8px;
    }
    
    .profile-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .profile-info {
        display: none;
    }
    
    .auth-buttons {
        order: 2;
        width: 100%;
        justify-content: center;
        gap: 15px;
    }
    
    .search-bar {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin-top: 5px;
    }
    
    .search-bar input {
        padding: 12px 15px;
        font-size: 16px;
    }
    
    /* Menu dropdown em mobile */
    .profile-dropdown {
        position: fixed;
        top: 70px;
        left: 10px;
        right: 10px;
        max-width: calc(100vw - 20px);
        max-height: 70vh;
        overflow-y: auto;
        z-index: 10000;
    }
    
    .dropdown-email {
        font-size: 13px;
        padding: 0 5px;
    }
    
    /* Modal para celular */
    .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 10px auto !important;
        padding: 20px 15px !important;
        max-height: 90vh;
    }
    
    .auth-modal {
        max-height: 85vh;
    }
    
    .auth-tabs {
        flex-direction: column;
        gap: 5px;
    }
    
    .tab-btn {
        width: 100%;
        padding: 14px;
        font-size: 15px;
    }
    
    .auth-form input {
        font-size: 16px;
        padding: 15px;
    }
    
    /* Modal checkout mobile */
    .checkout-modal {
        max-height: 85vh;
    }
    
    .currency-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .currency-option {
        flex-direction: column;
        text-align: center;
        padding: 10px;
        min-height: 70px;
        justify-content: center;
    }
    
    .currency-icon {
        font-size: 24px;
        margin-bottom: 5px;
    }
    
    .currency-name {
        font-size: 11px;
        line-height: 1.2;
    }
    
    .checkout-total {
        font-size: 18px;
        padding: 15px 0;
    }
    
    .checkout-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }
    
    .checkout-btn, .btn-secondary.close-checkout {
        width: 100%;
        padding: 16px;
    }
    
    /* Carrossel mobile */
    .carousel {
        height: 250px;
    }
    
    .slide-content {
        padding: 20px;
        max-width: 90%;
    }
    
    .slide-content h2 {
        font-size: 24px;
        margin-bottom: 10px;
    }
    
    .slide-content p {
        font-size: 16px;
    }
    
    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    /* Produtos mobile */
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .product-card {
        border-radius: 6px;
    }
    
    .product-image {
        height: 150px;
    }
    
    .product-info {
        padding: 12px;
    }
    
    .product-title {
        font-size: 14px;
        height: 36px;
    }
    
    .product-description {
        font-size: 12px;
        height: 48px;
        -webkit-line-clamp: 3;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .product-price {
        font-size: 16px;
    }
    
    .btn-buy {
        padding: 10px;
        font-size: 13px;
    }
    
    /* Footer mobile */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
        text-align: center;
    }
    
    .footer-section p {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    /* Ajustes para telas muito pequenas */
    .currency-options {
        grid-template-columns: 1fr;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .product-card {
        margin: 0;
    }
    
    .product-image {
        height: 120px;
    }
    
    .carousel {
        height: 200px;
    }
    
    .slide-content h2 {
        font-size: 20px;
    }
    
    .slide-content p {
        font-size: 14px;
    }
    
    /* Header mais compacto */
    .auth-link span {
        display: none;
    }
    
    .auth-link i {
        font-size: 18px;
    }
    
    .auth-link {
        padding: 8px 12px;
        min-width: 40px;
        justify-content: center;
    }
    
    /* Modal otimizado */
    .modal-content {
        padding: 15px 12px !important;
        margin: 5px auto !important;
    }
    
    .auth-tabs {
        margin-bottom: 15px;
    }
    
    .tab-btn {
        padding: 12px;
        font-size: 14px;
    }
}

/* Melhorias para iOS */
@supports (-webkit-touch-callout: none) {
    .modal-content {
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
    
    input, textarea, select {
        font-size: 16px !important;
    }
    
    /* Melhorar área de toque */
    .btn-primary, .btn-secondary, .btn-submit, .tab-btn, .profile-btn {
        min-height: 44px;
    }
    
    .close {
        min-width: 44px;
        min-height: 44px;
    }
    
    .auth-link {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Suporte para safe areas */
.sidebar {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.profile-dropdown {
    padding-top: env(safe-area-inset-top);
}