/* assets/css/styles.css */

/* CSS Variables */
:root {
    --primary-color: #1E90FF;
    --secondary-color: #74EBD5;
    --text-color: #333;
    --background-color: #f4f4f4;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --border-radius: 8px;
    --header-height: 60px;
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
        Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    padding-top: var(--header-height);
    padding-bottom: calc(60px + var(--safe-area-inset-bottom));
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--background-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Fixed Header */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--primary-color);
    color: white;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

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

/* Navigation */
.main-nav {
    display: flex;
    align-items: center;
}

.cart-icon {
    position: relative;
    padding: 0.5rem;
    cursor: pointer;
}

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

/* Main Content */
.main-content {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

.category-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
    cursor: pointer;
}

.category-card:active {
    transform: scale(0.98);
}

.category-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.category-name {
    padding: 0.5rem;
    text-align: center;
    font-weight: 500;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

.product-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.product-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.product-details {
    padding: 0.75rem;
}

.product-name {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.product-price {
    color: var(--primary-color);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.quantity-input {
    width: 40px;
    height: 30px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Cart Overlay */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 2000;
}

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

.cart-content {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 400px;
    background: white;
    padding: 1.5rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cart-overlay.active .cart-content {
    transform: translateX(0);
}

/* Cart Items */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    background: white;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-details h4 {
    margin: 0;
    font-size: 1rem;
    color: #333;
}

.cart-item-price {
    margin: 0.25rem 0;
    color: var(--primary-color);
    font-weight: bold;
}


/* Checkout Button */
.checkout-button {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-weight: bold;
    margin-top: 1rem;
    cursor: pointer;
}

/* Media Queries */
@media (min-width: 768px) {
    .cart-content {
        max-width: 400px;
        right: 1rem;
        left: auto;
        bottom: 1rem;
        border-radius: var(--border-radius);
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (min-width: 1024px) {
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }


/* Authentication Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.auth-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.auth-box {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: #666;
    font-size: 0.9rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #444;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.input-group {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.input-group-text {
    background: #f8f9fa;
    padding: 0.75rem;
    color: #666;
    border-right: 1px solid #ddd;
}

.input-group input,
.input-group textarea {
    flex: 1;
    padding: 0.75rem;
    border: none;
    outline: none;
    font-size: 1rem;
}

.auth-form input:not([type="submit"]),
.auth-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.auth-form input:focus,
.auth-form textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(30, 144, 255, 0.1);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}



.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1a75ff;
}


.btn-secondary {
    background: var(--warning-color);
    color: rgb(15, 1, 1);
}

.btn-secondary:hover {
    background: #029384;
}

.btn-thirdary {
    background: var(--danger-color);
    color: white;
}

.btn-thirdary:hover {
    background: #f70317;
}

.btn-block {
    width: 100%;
}

.auth-links {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Esta regla específica sobrescribirá cualquier otra regla para .btn-primary */
.auth-links .btn-primary {
    color: white !important; /* Texto blanco */
    background-color: blue; /* Fondo azul - ajusta al color exacto que necesites */
}


.phone-number {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--primary-color);
    margin: 1rem 0;
    text-align: center;
}

.verification-code-input {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.verification-code-input input {
    font-size: 2rem;
    letter-spacing: 0.5rem;
    text-align: center;
    padding: 0.5rem;
    width: 200px;
}

.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
}

.alert-danger {
    background: #ffebee;
    color: var(--danger-color);
    border: 1px solid #ffcdd2;
}

.alert-success {
    background: #e8f5e9;
    color: var(--success-color);
    border: 1px solid #c8e6c9;
}

.alert-info {
    background: #e3f2fd;
    color: var(--primary-color);
    border: 1px solid #bbdefb;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    padding: 0;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
}

.btn-link:hover {
    color: #1a75ff;
}

/* Utility Classes */


.add-to-cart-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    margin-top: 0.5rem;
    transition: background-color 0.3s ease;
}

.add-to-cart-btn i {
    font-size: 1.1rem;
}

.add-to-cart-btn:hover {
    background-color: #28a745; /* Color verde para el hover */
}

.empty-cart-message {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.cart-header {
    background: white;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.cart-summary {
    background: white;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.close-cart {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: #333;
    padding: 0.5rem;
}

.close-cart:hover {
    color: var(--primary-color);
}


/* Checkout Styles */
.checkout-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.checkout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .checkout-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.checkout-section {
    padding: 1rem;
    background: #f9f9f9;
    border-radius: var(--border-radius);
}

.checkout-section h3 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.order-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.order-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.order-item .item-details {
    flex: 1;
}

.order-summary {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.summary-row.total {
    font-weight: bold;
    font-size: 1.2rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.btn-block {
    width: 100%;
    margin-top: 1rem;
}


/* Header Styles */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--primary-color);
    color: white;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-content {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo a {
    color: white;
    text-decoration: none;
}

.logo h1 {
    margin: 0;
    font-size: 1.5rem;
}

/* Navigation Menu */
.main-nav ul {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-nav a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    padding: 0.5rem;
}

.main-nav a:hover {
    background: rgba(255,255,255,0.1);
    border-radius: var(--border-radius);
}

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    padding: 0.5rem;
    cursor: pointer;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.mobile-menu.active {
    transform: translateY(0);
    display: block;
}

.mobile-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-menu li {
    border-bottom: 1px solid #eee;
}

.mobile-menu a {
    color: var(--text-color);
    text-decoration: none;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .main-nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
    }

    .mobile-menu {
        display: block;
    }
}



/* Estilos para agregar al final de styles.css */
.main-footer {
    background: #333;
    color: #fff;
    padding: 3rem 0 1rem;
    margin-top: 3rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    color: #fff;
    margin-bottom: 1rem;
}

.footer-section p {
    color: #ccc;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: #fff;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-links a {
    color: #fff;
    font-size: 1.5rem;
}

.contact-info li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ccc;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #ccc;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-section {
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }

    .contact-info li {
        justify-content: center;
    }
}