@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
    /* DEFAULT (LIGHT MODE) */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --accent: #0ea5e9;
    
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-border: #edf2f7;
    --surface-hover: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    
    --success: #10b981;
    --success-bg: #d1fae5;
    --error: #ef4444;
    --error-bg: #fee2e2;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    
    --sidebar-bg: #ffffff;
    --sidebar-border: #edf2f7;
    
    --input-bg: #f8fafc;
    --input-border: #e2e8f0;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
}

body.dark-mode {
    /* DARK MODE VARIANT */
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --secondary: #f472b6;
    --accent: #38bdf8;
    
    --background: #0f172a;
    --surface: #1e293b;
    --surface-border: #334155;
    --surface-hover: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --success: #34d399;
    --success-bg: rgba(16, 185, 129, 0.15);
    --error: #f87171;
    --error-bg: rgba(239, 68, 68, 0.15);
    --warning: #fbbf24;
    --warning-bg: rgba(245, 158, 11, 0.15);
    
    --sidebar-bg: #1e293b;
    --sidebar-border: #334155;
    
    --input-bg: #0f172a;
    --input-border: #334155;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
}

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

body {
    background-color: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
}

/* Background Animations */
.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}
.bg-mesh::before, .bg-mesh::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    animation: float 20s infinite ease-in-out alternate;
}
.bg-mesh::before {
    background: var(--primary);
    top: -10%;
    left: -10%;
}
.bg-mesh::after {
    background: var(--secondary);
    bottom: -10%;
    right: -10%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 50px) scale(1.2); }
}

/* Base Components */
.premium-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.glass-panel {
    background: var(--surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.title-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 14px 0 rgba(139, 92, 246, 0.39);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(139, 92, 246, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--surface-border);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--text-secondary);
}

/* Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.input-group label {
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.input-control {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.input-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

/* Auth Layout (Split Screen) */
.auth-layout {
    display: flex;
    min-height: 100vh;
    width: 100vw;
}

.auth-hero {
    flex: 1;
    display: none;
    background: linear-gradient(135deg, var(--background) 0%, rgba(15, 23, 42, 1) 100%);
    position: relative;
    overflow: hidden;
    padding: 4rem;
    flex-direction: column;
    justify-content: center;
}

@media (min-width: 1024px) {
    .auth-hero { display: flex; }
}

.auth-hero-content {
    position: relative;
    z-index: 10;
    max-width: 600px;
}

.auth-hero h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: white;
}

.auth-hero p {
    font-size: 1.25rem;
    color: #cbd5e1;
}

.auth-hero .decoration {
    position: absolute;
    right: -100px;
    bottom: -100px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
}

.auth-form-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: var(--background);
}

.auth-box {
    width: 100%;
    max-width: 440px;
    animation: fadeIn 0.5s ease-out;
}

.auth-box h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Sidebar Layout */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 50;
}

.sidebar-header {
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-menu {
    flex-grow: 1;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.nav-item.active {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    font-weight: 600;
}

.sidebar-footer {
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: scroll;
    position: relative;
    scroll-behavior: smooth;
}

.top-header {
    padding: 2rem 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: rgba(var(--background), 0.8);
    backdrop-filter: blur(12px);
    z-index: 40;
    border-bottom: 1px solid var(--surface-border);
}

.page-content {
    padding: 2rem 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    animation: fadeIn 0.4s ease-out;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-title {
    font-family: 'Outfit', sans-serif;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 3rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    line-height: 1;
    margin-bottom: 1rem;
}

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

.product-card {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    height: 100%;
}

.product-img-wrapper {
    height: 180px;
    background: #ffffff;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    position: relative;
}

.product-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover .product-img {
    transform: scale(1.05);
}

.product-id {
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.product-title {
    font-size: 1rem;
    font-weight: 500;
    margin: 0.5rem 0 1rem 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--surface-border);
}

.price {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
}
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-error { background: rgba(239, 68, 68, 0.15); color: var(--error); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

/* IA Interactions Chat-like */
.ia-card {
    display: flex;
    flex-direction: column;
    padding: 2rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary);
}

.chat-bubble {
    background: rgba(139, 92, 246, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.1);
    padding: 1.25rem;
    border-radius: 0 16px 16px 16px;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.ia-draft-area {
    width: 100%;
    min-height: 120px;
    resize: vertical;
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, var(--surface-border) 25%, var(--surface-hover) 50%, var(--surface-border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background: var(--surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1), fadeOut 0.3s 3.7s forwards;
    max-width: 350px;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--error); }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
    to { opacity: 0; }
}

/* Toggle Switch CSS */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--surface-border);
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--success);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--success);
}

input:checked + .slider:before {
  -webkit-transform: translateX(22px);
  -ms-transform: translateX(22px);
  transform: translateX(22px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
