/* Custom CSS for AgriPulse Dashboard */

/* ---------------------------------- */
/* 1. THEME DEFINITIONS (Custom Props) */
/* ---------------------------------- */
:root {
    /* Base Green Theme (Default) */
    --color-primary: #10B981; /* Emerald 500 */
    --color-primary-dark: #059669; /* Emerald 600 */
    --color-secondary: #1F2937; /* Gray 800 */
    --color-secondary-hover: #374151; /* Gray 700 */
    --color-secondary-active: #111827; /* Gray 900 */
    --color-border-color: #4B5563; /* Gray 600 for dark surfaces */
}

.theme-blue {
    --color-primary: #3B82F6; /* Blue 500 */
    --color-primary-dark: #2563EB; /* Blue 600 */
    --color-secondary: #0A3D62; /* Darker Blue/Navy */
    --color-secondary-hover: #145DA0;
    --color-secondary-active: #042D4A;
}

.theme-earth {
    --color-primary: #CA8A04; /* Amber 600 */
    --color-primary-dark: #A16207; /* Amber 700 */
    --color-secondary: #583F2F; /* Brown/Dark Earth */
    --color-secondary-hover: #6F5441;
    --color-secondary-active: #473223;
}

/* Custom colors for modals */
.bg-whatsapp { background-color: #25D366; }
.hover\:bg-whatsapp-dark:hover { background-color: #128C7E; }

/* Apply custom properties to Tailwind classes */
.bg-primary { background-color: var(--color-primary); }
.hover\:bg-primary-dark:hover { background-color: var(--color-primary-dark); }
.text-primary { color: var(--color-primary); }
.focus\:ring-primary:focus { --tw-ring-color: var(--color-primary); }
.focus\:border-primary:focus { border-color: var(--color-primary); }

.bg-secondary { background-color: var(--color-secondary); }
.bg-secondary-active { background-color: var(--color-secondary-active); }
.hover\:bg-secondary-hover:hover { background-color: var(--color-secondary-hover); }
.border-border-color { border-color: var(--color-border-color); }

/* ---------------------------------- */
/* 2. ANIMATIONS (PROFESSIONAL) */
/* ---------------------------------- */

/* Fade-in for page content after load/switch */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Fade-out for login screen (simulated for clean transition) */
@keyframes fadeOutUp {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

.fade-out-up {
    animation: fadeOutUp 0.3s ease-out forwards;
}

/* ---------------------------------- */
/* 3. MOBILE RESPONSIVENESS FIXES */
/* ---------------------------------- */

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 30; /* Below sidebar (z-40) but above content */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 1023px) {
    /* Prevent body scroll when mobile menu is open */
    .overflow-hidden {
        overflow: hidden !important;
    }

    /* Ensure the sticky nav content fills the sidebar on mobile */
    nav .p-4.sticky {
        top: 0; 
        height: 100vh;
        overflow-y: auto;
    }
}


/* ---------------------------------- */
/* 4. UTILITY & COMPONENT STYLES */
/* ---------------------------------- */

/* Chart Containers (optional but good practice) */
.chart-container {
    position: relative;
    /* Optional: min-height: 200px; */ 
}

/* Crop Doctor Drop Area Animation */
.file-drop-area {
    border: 3px dashed var(--color-primary);
    background-color: #F9FAFB;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.file-drop-area:hover {
    border-color: var(--color-primary-dark);
    background-color: #F3F4F6;
}

.file-drop-area.active {
    border-color: #EF4444; /* Red border when actively dragging */
    background-color: #FEF2F2; /* Light red background */
}

/* Page Content Toggling */
.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

/* Chat Bubbles and Typing Indicator */
.chat-bubble {
    max-width: 80%;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
}

.user-bubble {
    background-color: #3B82F6;
    color: white;
    margin-left: auto; /* Aligns to the right */
    border-top-right-radius: 0.25rem;
}

.agripulse-bubble {
    background-color: #E5E7EB;
    color: #1F2937;
    margin-right: auto; /* Aligns to the left */
    border-top-left-radius: 0.25rem;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    background-color: #E5E7EB;
    max-width: 80px; /* Make it small */
    margin-right: auto;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: #9CA3AF;
    border-radius: 50%;
    margin-right: 4px;
    animation: bounce 1.4s infinite ease-in-out;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
    margin-right: 0;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
}