/* Futuristic Marketplace - Modern & Professional Design */

:root {
    --primary-color: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary-color: #f59e0b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Gradients */
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-2: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    
    /* Dark Mode Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --dark-bg: #0f172a;
    --dark-surface: #1e293b;
    --dark-border: #334155;
    
    --text-primary: #f1f5f9;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    --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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Light Mode Colors */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --dark-bg: #ffffff;
    --dark-surface: #f8fafc;
    --dark-border: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #1e293b;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    
    --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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Navigation */
.navbar {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--dark-border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Light Mode Navbar */
[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--dark-border);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-links a:hover {
    color: var(--primary-light);
}

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

.nav-links a:hover::after {
    width: 100%;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.theme-toggle:hover {
    background: var(--primary-dark);
    transform: rotate(180deg);
}

.theme-toggle:active {
    transform: rotate(180deg) scale(0.95);
}

/* Theme Toggle Icon Animation */
.theme-toggle svg {
    transition: transform 0.3s ease;
}

[data-theme="light"] .theme-toggle svg {
    transform: rotate(180deg);
}

/* Search bar */
.search-container {
    position: relative;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    flex: 1;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    z-index: 1;
}

/* Theme Toggle Button inside search */
.search-container .theme-toggle {
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.search-container .theme-toggle:hover {
    background: var(--primary-dark);
    transform: rotate(180deg);
}

.search-container .theme-toggle:active {
    transform: rotate(180deg) scale(0.95);
}

/* Hero Section */
.hero {
    padding: 1rem 0;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--dark-surface) 100%);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23334155" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.1;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeInUp 0.8s ease;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--gradient-1);
    color: var(--text-inverse);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.8s ease 0.4s both;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

/* App Store Section */
.app-store-section {
    padding: 4rem 0;
    background: linear-gradient(135deg, var(--dark-surface) 0%, var(--dark-bg) 100%);
    position: relative;
    overflow: hidden;
}

.app-store-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-1);
    opacity: 0.05;
    z-index: 0;
}

.app-store-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.app-store-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-store-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.app-store-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.app-store-button {
    display: inline-block;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.app-store-button:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.app-store-button img {
    width: 100%;
    height: auto;
    display: block;
    max-width: 200px;
}

/* Animation for app store section */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive for app store section */
@media (max-width: 768px) {
    .app-store-section {
        padding: 3rem 0;
    }
    
    .app-store-container {
        padding: 0 1rem;
    }
    
    .app-store-title {
        font-size: 2rem;
    }
    
    .app-store-subtitle {
        font-size: 1rem;
    }
    
    .app-store-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .app-store-button img {
        max-width: 180px;
    }
}

@media (max-width: 480px) {
    .app-store-title {
        font-size: 1.5rem;
    }
    
    .app-store-subtitle {
        font-size: 0.9rem;
    }
    
    .app-store-button img {
        max-width: 160px;
    }
}

/* Product Grid */
.products-section {
    padding: 4rem 0;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 2rem;
    padding-right: 2rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.product-card {
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.product-card[href]:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.product-card[href]:active {
    transform: translateY(-2px) scale(1.01);
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-1);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.product-card:hover::before {
    transform: scaleX(1);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--dark-bg);
}

.product-content {
    padding: 1.5rem;
}

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

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

.product-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.product-category {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Contact Page Responsive */
@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        margin-bottom: 2rem !important;
    }
    
    .contact-form-container,
    .contact-info-container {
        padding: 1.5rem !important;
        margin: 0 1rem !important;
    }
    
    .admin-auth-section {
        padding: 1.5rem !important;
        margin: 0 1rem !important;
    }
    
    .messages-section {
        padding: 1.5rem !important;
        margin: 0 1rem !important;
    }
}

@media (max-width: 480px) {
    .contact-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .contact-form-container,
    .contact-info-container,
    .admin-auth-section,
    .messages-section {
        padding: 1rem !important;
        margin: 0 0.5rem !important;
    }
    
    .form-input,
    .form-textarea,
    .form-select {
        font-size: 16px !important; /* Previene zoom en iOS */
    }
}

/* Forms */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.form-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--dark-bg);
    border: 1px solid var(--dark-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

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

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

.form-submit {
    width: 100%;
    padding: 1rem;
    background: var(--gradient-1);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* File upload */
.file-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: block;
    padding: 2rem;
    background: var(--dark-bg);
    border: 2px dashed var(--dark-border);
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
}

.file-upload:hover .file-upload-label {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 0 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        max-width: 100%;
        overflow-x: auto;
    }

    .nav-links li {
        white-space: nowrap;
    }

    .nav-links a {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }

    .search-container {
        width: 100%;
        max-width: none;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

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

    .form-container {
        padding: 1rem;
        margin: 0 1rem;
    }

    /* Filtros responsive */
    .products-section {
        padding: 2rem 1rem;
    }

    .products-section > div[style*="margin-bottom"] {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch !important;
    }

    .products-section > div[style*="display: flex"] > div[style*="display: flex"] {
        flex-direction: column;
        gap: 0.5rem;
    }

    .form-select {
        width: 100% !important;
    }

    /* Contador de productos */
    .products-section > div[style*="display: flex"] > div:last-child {
        text-align: center;
        order: -1;
    }

    /* Contact form responsive */
    .products-section > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

@media (max-width: 480px) {
    .nav-links {
        gap: 0.25rem;
    }

    .nav-links a {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }

    .hero {
        padding: 2rem 0;
    }

    .hero-content {
        padding: 0 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .product-card {
        margin: 0 0.5rem;
    }

    .form-container {
        margin: 0 0.5rem;
        padding: 1rem;
    }

    .products-section {
        padding: 1rem 0.5rem;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading spinner */
.spinner {
    border: 3px solid var(--dark-border);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

/* Product detail styles */
#productDetail {
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.product-detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 16px;
    overflow: hidden;
}

/* Product detail responsive */
@media (max-width: 768px) {
    .product-detail-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .product-detail-container > div:first-child {
        padding: 1rem !important;
    }
    
    .product-detail-container > div:last-child {
        padding: 1rem !important;
    }
    
    #mainImage {
        width: 100% !important;
        height: 250px !important;
        object-fit: contain !important;
    }
    
    .thumbnail {
        height: 60px !important;
    }
    
    .product-detail-container h1 {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .product-detail-container div[style*="font-size: 2rem"] {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .product-detail-container p {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
    }
    
    .product-detail-container div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .product-detail-container div[style*="display: flex"] a,
    .product-detail-container div[style*="display: flex"] button {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    #mainImage {
        height: 200px !important;
    }
    
    .thumbnail {
        height: 50px !important;
    }
    
    .product-detail-container h1 {
        font-size: 1.25rem !important;
    }
    
    .product-detail-container div[style*="font-size: 2rem"] {
        font-size: 1.25rem !important;
    }
}

/* Image gallery styles */
.thumbnail {
    transition: all 0.3s ease;
    opacity: 0.8;
}

.thumbnail:hover {
    opacity: 1;
    transform: scale(1.05);
}

.thumbnail.active {
    opacity: 1;
    transform: scale(1.05);
}

#mainImage {
    transition: opacity 0.3s ease;
}

/* Product image container */
.product-image-container {
    position: relative;
    overflow: hidden;
}

.product-image-container img {
    transition: transform 0.3s ease;
}

.product-image-container:hover img {
    transform: scale(1.02);
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-color: var(--success);
    color: var(--success);
}

.toast.error {
    border-color: var(--danger);
    color: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
