:root {
    color-scheme: light dark;
    /* Color Palette */
    --primary: hsl(142, 71%, 45%);
    --primary-hover: hsl(142, 60%, 40%);
    --secondary: hsl(210, 100%, 50%);
    --bg-dark: transparent;
    --bg-card: hsla(0, 0%, 100%, 0.8);
    --bg-panel: hsla(0, 0%, 100%, 0.85);
    --border-color: hsla(0, 0%, 0%, 0.1);
    --shadow-color: hsla(0, 0%, 0%, 0.1);
    --text-main: hsl(220, 20%, 10%);
    --text-muted: hsl(220, 10%, 40%);
    --bg-hover: hsla(0, 0%, 0%, 0.05);
    --bg-input: hsla(0, 0%, 0%, 0.03);
    
    /* Layout Tokens */
    --nav-height: 80px;
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-card: hsla(0, 0%, 15%, 0.8);
        --bg-panel: hsla(0, 0%, 18%, 0.85);
        --border-color: hsla(0, 0%, 100%, 0.1);
        --shadow-color: hsla(0, 0%, 0%, 0.4);
        --text-main: hsl(0, 0%, 95%);
        --text-muted: hsl(0, 0%, 70%);
        --bg-hover: hsla(0, 0%, 100%, 0.1);
        --bg-input: hsla(0, 0%, 100%, 0.05);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Glassmorphism Utilities */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px var(--shadow-color);
}

/* Typography */
.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, #34d399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.btn {
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px hsla(142, 71%, 45%, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px hsla(142, 71%, 45%, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 2px solid var(--border-color);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-main);
}

.btn-ghost:hover {
    background: var(--bg-hover);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.w-100 {
    width: 100%;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-main);
    text-decoration: none;
}

.icon-btn:hover {
    background: hsla(142, 71%, 45%, 0.1);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow-color);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--nav-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    z-index: 100;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links {
    display: flex;
    height: 100%;
    align-items: center;
}

.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-item > a {
    color: var(--text-main);
    text-decoration: none;
    margin: 0 16px;
    font-weight: 500;
    transition: var(--transition);
    padding: 28px 0; /* Creates a large hover area */
}

.nav-item:hover > a {
    color: var(--primary);
}

.mega-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    width: max-content;
    min-width: 320px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 16px;
    padding: 20px;
    z-index: 100;
}

.nav-item:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-item.profile-dropdown .mega-menu {
    left: auto;
    right: 0;
    transform: translateY(20px);
}

.nav-item.profile-dropdown:hover .mega-menu {
    transform: translateY(0);
}

.mega-menu-column h4 {
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mega-menu-column a {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    text-decoration: none;
    color: var(--text-main);
    padding: 12px;
    border-radius: 12px;
    transition: var(--transition);
    margin: 0 0 4px 0 !important;
}

.mega-menu-column a:hover {
    background: var(--bg-hover);
}

.mega-menu-column a .icon {
    font-size: 1.5rem;
    background: hsla(142, 71%, 45%, 0.1);
    padding: 8px;
    border-radius: 10px;
}

.mega-menu-column a div strong {
    display: block;
    margin-bottom: 4px;
    font-size: 1rem;
    color: var(--text-main);
}

.mega-menu-column a div p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

.nav-actions {
    display: flex;
    gap: 12px;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: calc(var(--nav-height) + 40px) 5% 40px;
    position: relative;
    overflow: hidden;
}

.hero-content {
    flex: 1;
    max-width: 600px;
    z-index: 2;
}

.badge {
    display: inline-block;
    padding: 6px 16px;
    background: hsla(142, 71%, 45%, 0.15);
    color: var(--primary);
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 24px;
    border: 1px solid hsla(142, 71%, 45%, 0.3);
}

.hero h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -1px;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 40px;
}

.hero-cta {
    display: flex;
    gap: 16px;
}

.hero-visual {
    flex: 1;
    position: relative;
    height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Hero Farmer Image */
.hero-farmer-image {
    position: relative;
    z-index: 2;
    max-width: 100%;
    max-height: 550px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 20px 40px hsla(0, 0%, 0%, 0.1));
    /* Added initial scale for zoom animation */
    transform: scale(1);
    /* Float animation is added by JS after zoom completes, or we could handle it entirely in CSS */

}

@keyframes float-subtle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Blobs */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 1;
    opacity: 0.5;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: hsla(142, 71%, 45%, 0.4);
    top: -50px;
    right: -50px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: hsla(210, 100%, 50%, 0.3);
    bottom: 0;
    left: 10%;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: hsla(0, 0%, 0%, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 480px;
    padding: 40px;
    border-radius: 24px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.close-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    background: var(--bg-hover);
    border: none;
    color: var(--text-main);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
}

.close-btn:hover {
    background: var(--border-color);
    transform: rotate(90deg);
}

.modal h2 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.modal p {
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* Forms */
.input-group {
    margin-bottom: 20px;
}

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

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-hover);
    box-shadow: 0 0 0 4px hsla(142, 71%, 45%, 0.1);
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    user-select: none;
}

.toggle-password:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.role-selector {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.role-option {
    flex: 1;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.role-option .icon {
    font-size: 2rem;
}

.role-option.active {
    border-color: var(--primary);
    background: hsla(142, 71%, 45%, 0.1);
    box-shadow: 0 4px 12px hsla(142, 71%, 45%, 0.2);
}

.modal-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.modal-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.modal-footer a:hover {
    text-decoration: underline;
}

/* Chatbot */
.chatbot-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 10px 30px hsla(0, 0%, 0%, 0.5);
    z-index: 999;
    transition: var(--transition);
}

.chatbot-trigger:hover {
    transform: scale(1.1);
}

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 hsla(142, 71%, 45%, 0.4); }
    50% { box-shadow: 0 0 0 15px hsla(142, 71%, 45%, 0); }
}

.pulse {
    animation: pulse-glow 2s infinite;
}

.slide-up {
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.fade-in {
    animation: fadeIn 1.2s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Tagline Typewriter Classes */
.typing-char {
    opacity: 0;
    transition: opacity 0.05s ease-in-out;
}

.typing-char.visible {
    opacity: 1;
}

/* Zoom Image Class */
.zoom-in-effect {
    transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1);
    transform: scale(1.1);
}

@keyframes float-zoomed {
    0%, 100% { transform: scale(1.1) translateY(0); }
    50% { transform: scale(1.1) translateY(-10px); }
}

.float-animated {
    animation: float-zoomed 8s ease-in-out infinite forwards;
}

/* ========== Toast Notifications ========== */
.toast-container {
    position: fixed;
    top: 100px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 380px;
    width: 100%;
}

.toast {
    pointer-events: all;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 14px;
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 40px -8px var(--shadow-color);
    position: relative;
    overflow: hidden;
    animation: toastSlideIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border-left: 4px solid var(--primary);
}

.toast.toast-exit {
    animation: toastSlideOut 0.35s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

.toast-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
    color: var(--text-main);
}

.toast-message {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.45;
    word-break: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: var(--transition);
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-close:hover {
    color: var(--text-main);
    transform: scale(1.15);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 0 14px;
    background: var(--primary);
    animation: toastProgress linear forwards;
}

/* Toast Variants */
.toast-success {
    border-left-color: hsl(142, 71%, 45%);
}
.toast-success .toast-progress {
    background: hsl(142, 71%, 45%);
}

.toast-error {
    border-left-color: hsl(0, 72%, 51%);
}
.toast-error .toast-icon {
    color: hsl(0, 72%, 51%);
}
.toast-error .toast-progress {
    background: hsl(0, 72%, 51%);
}

.toast-info {
    border-left-color: hsl(210, 100%, 50%);
}
.toast-info .toast-icon {
    color: hsl(210, 100%, 50%);
}
.toast-info .toast-progress {
    background: hsl(210, 100%, 50%);
}

.toast-warning {
    border-left-color: hsl(38, 92%, 50%);
}
.toast-warning .toast-icon {
    color: hsl(38, 92%, 50%);
}
.toast-warning .toast-progress {
    background: hsl(38, 92%, 50%);
}

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

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(120%) scale(0.9);
    }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ========== Image Carousel ========== */
.carousel-container {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.carousel-track {
    width: 100%;
    height: 100%;
    position: relative;
}

.carousel-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.45s ease, transform 0.45s ease;
    background-size: cover;
    background-position: center;
    transform: scale(1.03);
}

.carousel-slide.active {
    opacity: 1;
    transform: scale(1);
    z-index: 1;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: hsla(0, 0%, 0%, 0.45);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    backdrop-filter: blur(8px);
}

.carousel-container:hover .carousel-btn {
    opacity: 1;
}

.carousel-btn:hover {
    background: hsla(0, 0%, 0%, 0.7);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev {
    left: 8px;
}

.carousel-next {
    right: 8px;
}

.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    gap: 7px;
    padding: 4px 10px;
    border-radius: 20px;
    background: hsla(0, 0%, 0%, 0.3);
    backdrop-filter: blur(6px);
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: hsla(0, 0%, 100%, 0.45);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.carousel-dot.active {
    background: var(--primary);
    transform: scale(1.3);
    box-shadow: 0 0 8px hsla(142, 71%, 45%, 0.5);
}

/* ========== Cart Sidebar ========== */
.cart-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: hsla(0, 0%, 0%, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cart-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px var(--shadow-color);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.cart-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.cart-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px dashed var(--border-color);
}

.cart-item-info h4 {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--text-main);
}

.cart-item-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.cart-item-remove {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.cart-item-remove:hover {
    opacity: 1;
    text-decoration: underline;
}

.cart-item-price {
    font-weight: 700;
    color: var(--primary);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
}

/* ========== Chat Interface ========== */
.chat-popup-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 360px;
    height: 500px;
    z-index: 998;
    display: none; /* Controlled by JS */
    flex-direction: column;
    animation: chatSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-popup-container.active {
    display: flex;
}

.chat-popup {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 40px hsla(0, 0%, 0%, 0.2);
}

.chat-header {
    padding: 16px 20px;
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header .status-indicator {
    width: 8px;
    height: 8px;
    background: #34d399;
    border-radius: 50%;
    box-shadow: 0 0 8px #34d399;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: radial-gradient(circle at top right, hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.03), transparent);
}

.chat-product-context {
    background: hsla(0, 0%, 100%, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px 20px;
    margin-bottom: 24px;
    text-align: center;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.5s ease;
}

.product-context-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1.5px;
    margin-bottom: 6px;
    opacity: 0.8;
}

.product-context-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.product-context-icon {
    font-size: 1.2rem;
}

.product-context-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.msg {
    max-width: 80%;
    padding: 10px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    animation: msgPop 0.3s ease-out forwards;
}

.msg-received {
    align-self: flex-start;
    background: var(--bg-hover);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

.msg-sent {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-system {
    align-self: center;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 4px;
    text-align: center;
    max-width: 90%;
}

.chat-input-area {
    padding: 16px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--text-main);
    outline: none;
    font-size: 0.95rem;
    transition: var(--transition);
}

.chat-input:focus {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.typing-indicator {
    padding: 8px 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    display: none;
}

@keyframes chatSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes msgPop {
    from { opacity: 0; transform: translateY(5px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ========== Chat Sidebar & Conversations ========== */
.chat-sidebar-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: hsla(0, 0%, 0%, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.chat-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.chat-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100%;
    background: var(--bg-panel);
    backdrop-filter: blur(25px);
    border-left: 1px solid var(--border-color);
    z-index: 1101;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.chat-sidebar-overlay.active .chat-sidebar {
    right: 0;
}

.chat-sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversations-list {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conversation-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    gap: 12px;
}

.conversation-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    background: var(--bg-hover);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.conv-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.conv-info {
    flex: 1;
    min-width: 0;
}

.conv-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.conv-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.conv-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.delete-chat-btn {
    background: #ff4444;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 6px 14px;
    border-radius: 20px;
    opacity: 1;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px hsla(0, 100%, 50%, 0.2);
}

.delete-chat-btn:hover {
    background: #ff0000;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 15px hsla(0, 100%, 50%, 0.3);
}

.delete-chat-btn:active {
    transform: translateY(0) scale(0.95);
}

#chat-badge {
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 hsla(210, 100%, 50%, 0.7); }
    70% { transform: scale(1.2); box-shadow: 0 0 0 10px hsla(210, 100%, 50%, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 hsla(210, 100%, 50%, 0); }
}

.conv-crop {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 4px;
}

.conv-preview {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== AI Chatbot Interface ========== */
.ai-chat-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 580px;
    z-index: 998;
    display: none;
    flex-direction: column;
    animation: aiChatSlideIn 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 20px 50px hsla(0, 0%, 0%, 0.25));
}

.ai-chat-container.active {
    display: flex;
}

.ai-chat-popup {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    overflow: hidden;
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
}

/* AI Chat Header */
.ai-chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, hsl(142, 71%, 42%), hsl(170, 60%, 40%), hsl(200, 70%, 45%));
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.ai-chat-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 120px;
    height: 120px;
    background: hsla(0, 0%, 100%, 0.1);
    border-radius: 50%;
    pointer-events: none;
}

.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-avatar {
    width: 38px;
    height: 38px;
    background: hsla(0, 0%, 100%, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    backdrop-filter: blur(8px);
}

.ai-chat-header-text h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.3px;
}

.ai-chat-header-text span {
    font-size: 0.72rem;
    opacity: 0.85;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-chat-header-text .ai-status-dot {
    width: 6px;
    height: 6px;
    background: #6ee7b7;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px #6ee7b7;
    animation: aiStatusPulse 2s infinite;
}

.ai-chat-header-actions {
    display: flex;
    gap: 6px;
}

.ai-header-btn {
    background: hsla(0, 0%, 100%, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.ai-header-btn:hover {
    background: hsla(0, 0%, 100%, 0.25);
    transform: scale(1.08);
}

/* AI Chat Messages Area */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: radial-gradient(
        ellipse at top right,
        hsla(142, 60%, 50%, 0.04),
        transparent 60%
    ), radial-gradient(
        ellipse at bottom left,
        hsla(210, 70%, 50%, 0.03),
        transparent 60%
    );
    scroll-behavior: smooth;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: hsla(0, 0%, 50%, 0.3);
    border-radius: 10px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

/* AI Welcome Screen */
.ai-chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 20px;
    gap: 16px;
    animation: fadeIn 0.6s ease;
}

.ai-welcome-icon {
    font-size: 3rem;
    background: linear-gradient(135deg, hsla(142, 60%, 50%, 0.15), hsla(200, 70%, 50%, 0.15));
    width: 80px;
    height: 80px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.ai-welcome-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.ai-welcome-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
    max-width: 280px;
}

.ai-suggested-prompts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
}

.ai-suggested-prompt {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.82rem;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Outfit', sans-serif;
}

.ai-suggested-prompt:hover {
    border-color: var(--primary);
    background: hsla(142, 71%, 45%, 0.08);
    transform: translateX(4px);
    box-shadow: 0 2px 8px hsla(142, 71%, 45%, 0.1);
}

.ai-suggested-prompt .prompt-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

/* AI Message Bubbles */
.ai-msg {
    max-width: 85%;
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.55;
    position: relative;
    animation: msgPop 0.3s ease-out forwards;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ai-msg-sent {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 6px;
}

.ai-msg-received {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-bottom-left-radius: 6px;
}

.ai-msg-received p {
    margin: 0 0 8px 0;
    line-height: 1.55;
}

.ai-msg-received p:last-child {
    margin-bottom: 0;
}

.ai-msg-received ul {
    margin: 6px 0;
    padding-left: 18px;
}

.ai-msg-received ul li {
    margin-bottom: 4px;
    line-height: 1.5;
}

.ai-msg-received h3, .ai-msg-received h4 {
    margin: 8px 0 4px 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.ai-msg-received strong {
    color: var(--primary);
    font-weight: 700;
}

.ai-msg-system {
    align-self: center;
    background: hsla(38, 92%, 50%, 0.1);
    border: 1px solid hsla(38, 92%, 50%, 0.2);
    color: var(--text-main);
    font-size: 0.8rem;
    text-align: center;
    border-radius: 12px;
    max-width: 90%;
    padding: 8px 14px;
}

.ai-msg-time {
    font-size: 0.65rem;
    opacity: 0.5;
    margin-top: 4px;
    text-align: right;
}

.ai-msg-sent .ai-msg-time {
    color: hsla(0, 0%, 100%, 0.7);
}

/* AI Code Blocks */
.ai-code-block {
    background: hsla(0, 0%, 0%, 0.06);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    margin: 6px 0;
    overflow-x: auto;
    font-family: 'SFMono-Regular', 'Menlo', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
}

.ai-inline-code {
    background: hsla(0, 0%, 0%, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SFMono-Regular', 'Menlo', monospace;
    font-size: 0.82rem;
}

/* AI Message Attachments (inside sent messages) */
.ai-msg-attachments {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.ai-msg-attachment-img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid hsla(0, 0%, 100%, 0.3);
}

.ai-msg-attachment-file {
    background: hsla(0, 0%, 100%, 0.2);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    backdrop-filter: blur(4px);
}

/* AI Typing Indicator */
.ai-typing-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 12px 18px;
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    animation: msgPop 0.3s ease-out forwards;
}

.ai-typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.ai-typing-dot {
    width: 7px;
    height: 7px;
    background: var(--primary);
    border-radius: 50%;
    animation: aiTypingBounce 1.4s infinite ease-in-out;
    opacity: 0.6;
}

.ai-typing-dot:nth-child(2) {
    animation-delay: 0.16s;
}

.ai-typing-dot:nth-child(3) {
    animation-delay: 0.32s;
}

.ai-typing-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

/* AI Input Area */
.ai-chat-input-area {
    padding: 12px 16px 14px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-attachment-preview {
    display: none;
    gap: 8px;
    flex-wrap: wrap;
    padding: 4px 0;
}

.ai-attachment-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 4px;
    animation: msgPop 0.2s ease;
}

.ai-attachment-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
}

.ai-attachment-file-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--bg-input);
    border-radius: 8px;
}

.ai-attachment-name {
    font-size: 0.72rem;
    color: var(--text-muted);
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-attachment-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: 2px solid var(--bg-card);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.ai-attachment-remove:hover {
    transform: scale(1.15);
    background: #dc2626;
}

.ai-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.ai-attach-btn {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-attach-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: hsla(142, 71%, 45%, 0.08);
    transform: scale(1.05);
}

.ai-chat-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 14px;
    color: var(--text-main);
    outline: none;
    font-size: 0.9rem;
    font-family: 'Outfit', sans-serif;
    transition: all 0.25s ease;
    resize: none;
    min-height: 40px;
    max-height: 100px;
}

.ai-chat-input:focus {
    border-color: var(--primary);
    background: var(--bg-hover);
    box-shadow: 0 0 0 3px hsla(142, 71%, 45%, 0.08);
}

.ai-chat-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.ai-send-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.ai-send-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
    box-shadow: 0 4px 12px hsla(142, 71%, 45%, 0.3);
}

.ai-send-btn:active {
    transform: scale(0.95);
}

/* Drag and drop overlay */
.ai-chat-container.ai-drag-over .ai-chat-popup {
    border: 2px dashed var(--primary);
    background: hsla(142, 71%, 45%, 0.05);
}

/* AI Chatbot Animations */
@keyframes aiChatSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes aiTypingBounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    40% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

@keyframes aiStatusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .ai-chat-container {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .ai-chat-popup {
        border-radius: 0;
    }

    .ai-chat-header {
        padding: 14px 16px;
        border-radius: 0;
    }
}
