:root {
  --bg-primary: #ffffff;        /* Pure white for main body */
  --bg-secondary: #f8fafc;      /* Slightly off-white for contrast */
  --bg-surface: #ffffff;        /* Pure white for surface components */
  --text-primary: #0f172a;      /* Deep dark slate for readable text */
  --text-secondary: #64748b;    /* Muted gray for lesser text */
  --border-color: #e2e8f0;      /* Light crisp gray for borders */
  --accent-primary: #FF007F;    /* Ultra Energetic Neon Pink */
  --accent-secondary: #00E5FF;  /* Ultra Energetic Neon Cyan */
  --glass-bg: rgba(255, 255, 255, 0.9); 
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
  --toggle-on: #10b981;         
  --toggle-off: #cbd5e1;        
}

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

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(255, 0, 127, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(255, 0, 127, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 0, 127, 0); }
}

@keyframes floatParticle {
    0% { transform: translateY(0) rotate(0deg); opacity: 0.8; }
    50% { transform: translateY(-20px) rotate(180deg); opacity: 0.4; }
    100% { transform: translateY(0) rotate(360deg); opacity: 0.8; }
}

.animate-fade-in-up { animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
.animate-fade-in-left { animation: fadeInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
.animate-fade-in-right { animation: fadeInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
.animate-scale-in { animation: scaleIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
.animate-pulse { animation: pulseGlow 2s infinite; }
.animate-float { animation: floatParticle 6s ease-in-out infinite; }

/* Stagger Delays for Tables/Lists */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }

.hover-lift { transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.hover-lift:hover { transform: translateY(-8px); box-shadow: 0 20px 40px -10px rgba(255, 0, 127, 0.2); }

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-surface: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.4);
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-primary);
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.6;
    mix-blend-mode: multiply;
}

.blob-1 {
    top: -5%;
    left: -5%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
    animation: float-1 8s infinite ease-in-out alternate;
}

.blob-2 {
    bottom: -5%;
    right: -5%;
    width: 900px;
    height: 900px;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    animation: float-2 10s infinite ease-in-out alternate-reverse;
}

@keyframes float-1 {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    100% { transform: translate(150px, 100px) scale(1.3) rotate(45deg); }
}

@keyframes float-2 {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    100% { transform: translate(-150px, -100px) scale(1.4) rotate(-45deg); }
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    padding: 2.5rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: -0.5px;
}

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

.nav-links a:hover, .nav-links a.active {
    color: var(--accent-primary);
    text-shadow: none;
}

.logout-btn {
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.3);
}

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

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

input, textarea, select {
    width: 100%;
    padding: 1rem 1.2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
    appearance: none;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(91, 83, 237, 0.2);
    background: var(--bg-surface);
}
.hero-section {
    position: relative; /* Essential for containing the absolute layers */
    width: 100%;
    min-height: 100vh; /* Adjust height as needed (e.g., 600px or 100vh) */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Crops/scales smoothly without stretching layout proportions */
    z-index: 1;
}

.hero-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4); /* Darkens video by 40% so white text pops */
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3; /* Pushes text content to the very top layer */
    text-align: center;
    color: #ffffff; /* Forces text to white for optimal contrast */
    max-width: 800px;
    padding: 20px;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem center;
    background-size: 1.2em;
    padding-right: 2.5rem;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

button {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    position: relative;
    overflow: hidden;
}

button::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.2), transparent);
    transform: translateX(-100%);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -5px rgba(91, 83, 237, 0.4);
}

button:hover::after {
    transform: translateX(100%);
    transition: transform 0.6s ease;
}

button:active {
    transform: translateY(0);
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.auth-header h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    font-family: 'Outfit', sans-serif;
}

.auth-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.auth-link a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}
.auth-link a:hover {
    text-decoration: underline;
}

.dashboard-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 3rem 5%;
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.panel-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.result-stat {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 2rem;
}

.stat-box {
    background: rgba(15, 23, 42, 0.5);
    padding: 1.5rem 1rem;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
}
.stat-box:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.4);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    font-family: 'Outfit', sans-serif;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.conclusion-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px;
    line-height: 1.6;
}

.competitor-list {
    margin-top: 1.5rem;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 0.5rem;
}
.competitor-list::-webkit-scrollbar {
    width: 6px;
}
.competitor-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}
.competitor-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.competitor-item {
    display: flex;
    justify-content: space-between;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}
.competitor-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.chat-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 5%;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    animation: fadeUp 0.6s ease-out forwards;
}

.chat-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    max-width: 85%;
    padding: 1.25rem 1.5rem;
    border-radius: 20px;
    animation: fadeUp 0.3s ease-out forwards;
    line-height: 1.6;
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.message.ai {
    align-self: flex-start;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-input-area {
    padding: 1.5rem 2rem;
    background: var(--glass-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.chat-input-area input {
    flex: 1;
    margin-bottom: 0;
    border-radius: 99px;
    padding: 1rem 1.5rem;
}

.chat-input-area button {
    width: auto;
    border-radius: 99px;
    padding: 1rem 1.5rem;
}

.loader {
    display: none;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto;
}

/* Premium Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--toggle-off);
    transition: .4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 26px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
input:checked + .toggle-slider {
    background-color: var(--toggle-on);
}
input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--toggle-on);
}
input:checked + .toggle-slider:before {
    transform: translateX(20px);
}
.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-top: 1rem;
    justify-content: space-between;
}
.toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s;
}
.toggle-label.active {
    color: var(--toggle-on);
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

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

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

@media (max-width: 768px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }
}
/* Forces the table container to stretch across the full width of the grid */
#products-table-container {
    grid-column: 1 / -1; 
    width: 100% !important;
}
#history-table-container {
    grid-column: 1 / -1; 
    width: 100% !important;
}

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

.spin {
    animation: spin 1s linear infinite;
}