/* ============================================
   Red Opticas - Modern Design System
   Mobile-First, Multi-Tenant Ready
   ============================================ */

/* CSS Variables */
:root {
    /* Brand Colors */
    --primary: #0f172a;
    --secondary: #3b82f6;
    --accent: #f43f5e;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Neutral Colors */
    --light: #f8fafc;
    --dark: #1e293b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Tenant-customizable (overridden by JS) */
    --tenant-primary: var(--secondary);
    --tenant-secondary: var(--primary);

    /* Effects */
    --glass: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--light);
    color: var(--primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Navbar
   ============================================ */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--gray-200);
    padding: var(--space-4) 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-weight: 700;
    color: var(--tenant-primary) !important;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.navbar-brand img {
    height: 40px;
    width: auto;
}

.nav-link {
    font-weight: 500;
    color: var(--gray-700) !important;
    transition: color 0.2s ease;
    padding: var(--space-2) var(--space-4) !important;
}

.nav-link:hover {
    color: var(--tenant-primary) !important;
}

/* Mobile menu */
@media (max-width: 991px) {
    .navbar-collapse {
        background: white;
        padding: var(--space-4);
        border-radius: var(--radius-lg);
        margin-top: var(--space-4);
        box-shadow: var(--shadow-lg);
    }
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 50%, #bfdbfe 100%);
    padding: var(--space-12) 0;
    text-align: center;
    min-height: 60vh;
    display: flex;
    align-items: center;
}

.hero h1 {
    font-weight: 800;
    color: var(--primary);
    margin-bottom: var(--space-6);
    font-size: 2.5rem;
    letter-spacing: -0.025em;
    line-height: 1.1;
}

@media (min-width: 768px) {
    .hero h1 {
        font-size: 3.5rem;
    }
}

@media (min-width: 992px) {
    .hero h1 {
        font-size: 4rem;
    }
}

.hero p {
    font-size: 1.125rem;
    color: var(--gray-600);
    max-width: 600px;
    margin: 0 auto var(--space-8);
}

@media (min-width: 768px) {
    .hero p {
        font-size: 1.25rem;
    }
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    font-weight: 600;
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-6);
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--tenant-primary);
    border: none;
}

.btn-primary:hover {
    background-color: color-mix(in srgb, var(--tenant-primary) 85%, black);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: 1rem;
}

.btn-outline-secondary {
    border: 2px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline-secondary:hover {
    background-color: var(--gray-100);
    border-color: var(--gray-400);
}

/* ============================================
   Feature Cards
   ============================================ */
.feature-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--gray-200);
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--tenant-primary);
    margin-bottom: var(--space-6);
}

.feature-card h3 {
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: var(--space-3);
    color: var(--gray-900);
}

/* Links dentro de feature cards */
a .feature-card h3,
a .feature-card p {
    color: inherit;
}

a .feature-card h3 {
    color: var(--gray-900);
}

a .feature-card p {
    color: var(--gray-600);
}

/* ============================================
   Product Cards (Catalog)
   ============================================ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: var(--space-6);
}

@media (min-width: 576px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.product-card {
    background: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
}

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

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--gray-100);
}

.product-card-body {
    padding: var(--space-4);
}

.product-card-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: var(--space-2);
    color: var(--primary);
}

.product-card-brand {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: var(--space-2);
}

.product-card-price {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--tenant-primary);
}

.product-card-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

/* ============================================
   Login Page
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: var(--space-4);
}

.login-card {
    background: white;
    padding: var(--space-8);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
}

.form-control {
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--gray-300);
    font-size: 1rem;
}

.form-control:focus {
    border-color: var(--tenant-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tenant-primary) 20%, transparent);
    outline: none;
}

.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

/* ============================================
   Dashboard
   ============================================ */
.dashboard-sidebar {
    background: var(--primary);
    color: white;
    min-height: 100vh;
    padding: var(--space-6);
    position: sticky;
    top: 0;
}

.dashboard-nav .nav-link {
    color: rgba(255, 255, 255, 0.7) !important;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transition: all 0.2s ease;
}

.dashboard-nav .nav-link:hover,
.dashboard-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white !important;
}

.stat-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    color: var(--gray-500);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-top: var(--space-2);
}

/* ============================================
   Chatbot Widget
   ============================================ */
.chatbot-widget {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 1000;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: var(--tenant-primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - var(--space-8));
    height: 500px;
    max-height: 70vh;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chatbot-window.open {
    display: flex;
}

.chatbot-header {
    background: var(--tenant-primary);
    color: white;
    padding: var(--space-4);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.chat-message {
    max-width: 85%;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.chat-message.user {
    background: var(--tenant-primary);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: var(--space-1);
}

.chat-message.assistant {
    background: var(--gray-100);
    color: var(--gray-800);
    margin-right: auto;
    border-bottom-left-radius: var(--space-1);
}

.chatbot-input {
    border-top: 1px solid var(--gray-200);
    padding: var(--space-4);
    display: flex;
    gap: var(--space-2);
}

.chatbot-input input {
    flex: 1;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-full);
    padding: var(--space-3) var(--space-4);
    outline: none;
}

.chatbot-input input:focus {
    border-color: var(--tenant-primary);
}

.chatbot-input button {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--tenant-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3);
    border-top: 1px solid var(--gray-200);
}

.chatbot-suggestion {
    font-size: 0.8125rem;
    padding: var(--space-2) var(--space-3);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-suggestion:hover {
    background: var(--tenant-primary);
    color: white;
    border-color: var(--tenant-primary);
}

/* ============================================
   Recipe Upload
   ============================================ */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-xl);
    padding: var(--space-12) var(--space-8);
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--gray-50);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--tenant-primary);
    background: color-mix(in srgb, var(--tenant-primary) 5%, white);
}

.upload-zone i {
    font-size: 3rem;
    color: var(--gray-400);
    margin-bottom: var(--space-4);
}

.upload-zone.dragover i {
    color: var(--tenant-primary);
}

/* ============================================
   Footer
   ============================================ */
footer {
    background: var(--primary);
    color: white;
    padding: var(--space-12) 0 var(--space-8);
}

footer h5 {
    font-weight: 600;
    margin-bottom: var(--space-4);
}

footer a {
    color: var(--gray-400);
    text-decoration: none;
    transition: color 0.2s ease;
}

footer a:hover {
    color: white;
}

/* ============================================
   Utilities
   ============================================ */
.text-tenant {
    color: var(--tenant-primary);
}

.bg-tenant {
    background-color: var(--tenant-primary);
}

.section-padding {
    padding: var(--space-12) 0;
}

@media (min-width: 992px) {
    .section-padding {
        padding: 5rem 0;
    }
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--tenant-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-12);
    color: var(--gray-500);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    color: var(--gray-300);
}

/* Badge */
.badge-service {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--gray-100);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-700);
}

.badge-service i {
    color: var(--tenant-primary);
}

/* Filter Pills */
.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
}

.filter-pill {
    padding: var(--space-2) var(--space-4);
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-pill:hover,
.filter-pill.active {
    background: var(--tenant-primary);
    color: white;
    border-color: var(--tenant-primary);
}
