/* =========================================
   Base Theme & Body
   ========================================= */
body {
    font-family: 'Poppins', sans-serif;
    background: #0f172a; /* Dark blue-gray background */
    color: #f8fafc; /* Light text color */
    margin: 0;
    padding: 0;
    /* Add padding-top if header is fixed to prevent content overlap */
    /* Adjust 70px based on actual fixed header height */
    padding-top: 70px;
}

/* =========================================
   Header Styles
   ========================================= */
header {
    background: rgba(26, 31, 53, 0.95); /* Semi-transparent dark background */
    padding: 1rem; /* Padding inside the header */
    position: fixed; /* Fixed at the top */
    width: 100%;
    top: 0;
    left: 0; /* Added for completeness with position: fixed */
    z-index: 1000; /* Ensure header stays on top */
    backdrop-filter: blur(10px); /* Frosted glass effect */
    display: flex;
    align-items: center;
    justify-content: space-between; /* Space out logo and nav */
    flex-wrap: wrap; /* Allow items to wrap if needed */
    height: 70px; /* Explicit height */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); /* Subtle shadow */
}

header .ra-logo, header .logo {
    height: 50px; /* Logo height */
    margin-right: 1rem; /* Space after logo */
    display: block;
    flex-shrink: 0; /* Prevent logo from shrinking */
}

/* =========================================
   Navigation Styles (Desktop/Base)
   ========================================= */
nav ul {
    list-style: none;
    display: flex; /* Horizontal layout for desktop */
    gap: 2rem; /* Space between nav items */
    margin: 0;
    padding: 0;
    align-items: center; /* Align items vertically */
}

nav a {
    color: #94a3b8; /* Muted text color for links */
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease; /* Smooth color transition */
    padding: 0.5rem; /* Padding for clickable area */
    display: inline-block; /* Needed for padding */
}

/* Interactive States */
nav a:hover,
nav a:focus {
    color: #38bdf8; /* Bright color on hover/focus */
    outline: none; /* Remove default outline */
}

/* Hide mobile menu toggle by default */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #94a3b8; /* Match nav link color */
    font-size: 1.5rem; /* Icon size */
    cursor: pointer;
}

/* =========================================
   Component Styles
   ========================================= */

/* --- Chatbot Styles --- */
.chatbot-container {
    background: #1e293b;
    border-radius: 1rem;
    padding: 1.5rem;
    height: 500px; /* Consider using min-height/max-height or flex */
    display: flex;
    flex-direction: column;
    margin: 2rem; /* Example margin */
}

.chat-history {
    /* Merged rules */
    position: relative; /* For potential stacking context */
    z-index: 1; /* Above container background */
    flex: 1; /* Take available vertical space */
    overflow-y: auto; /* Enable scrolling for messages */
    padding: 1rem;
    margin-bottom: 1rem;
    background: #0f172a; /* Match body background */
    border-radius: 0.5rem;
}

.message {
    margin-bottom: 1rem;
    padding: 0.8rem;
    border-radius: 0.5rem;
    max-width: 80%;
    line-height: 1.4; /* Improve readability */
}

.user-message {
    background: #38bdf8; /* User message background */
    color: #0f172a; /* Dark text on light background */
    margin-left: auto; /* Align to the right */
}

.bot-message {
    background: #334155; /* Bot message background */
    color: #f8fafc; /* Light text */
    margin-right: auto; /* Align to the left */
}

.chat-input {
    display: flex;
    gap: 1rem;
    margin-top: auto; /* Push input to the bottom if container uses flex */
}

.chat-input input {
    flex: 1; /* Take available horizontal space */
    padding: 0.8rem;
    border: none;
    border-radius: 0.5rem;
    background: #0f172a; /* Match history background */
    color: #f8fafc; /* Light text */
    font-size: 1rem; /* Ensure readable font size */
}
.chat-input input:focus {
     outline: 2px solid #38bdf8; /* Focus outline */
     outline-offset: 2px;
}


.chat-input button {
    /* Merged rules */
    position: relative; /* For potential pseudo-elements */
    background: #38bdf8;
    color: #0f172a; /* Dark text on light button */
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease; /* Updated transition */
    font-weight: 500;
}

.chat-input button:hover {
    background: #0ea5e9; /* Slightly different blue for hover */
}
.chat-input button:active {
    transform: scale(0.98); /* Add slight press effect */
}

/* Button Accessibility */
.chat-input button:focus {
    outline: 2px solid #f8fafc; /* Use light color for focus ring on dark button */
    outline-offset: 2px;
}


/* --- Feature/Card Styles --- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem; /* Padding around the grid */
}

.feature-card {
    background: #1e293b; /* Card background */
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* Smooth transitions */
}

.feature-card:hover {
    transform: translateY(-5px); /* Lift effect on hover */
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05); /* Enhance shadow */
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #38bdf8; /* Icon color */
}

/* --- Dashboard/Layout Styles --- */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem;
}

.chart-container {
    /* Merged rules */
    min-height: 300px; /* Minimum height */
    background: #1e293b; /* Background for chart area */
    border-radius: 1rem;
    padding: 1.5rem;
    /* Add display: flex or block as needed for chart library */
}

/* --- Sustainability/Progress Styles --- */
.sustainability-panel {
    background: #1e293b;
    border-radius: 1rem;
    padding: 2rem;
    margin: 2rem; /* Example margin */
}

.progress-tracker {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 2rem;
    margin-top: 1.5rem;
    justify-content: center; /* Center items if they wrap */
}

.progress-item {
    flex: 1; /* Allow items to grow/shrink */
    min-width: 120px; /* Minimum width before wrapping */
    text-align: center;
}

.progress-circle {
    /* Merged rules */
    width: 100px;
    height: 100px;
    border-radius: 50%;
    /* Example gradient, adjust percentage (75%) as needed */
    background: conic-gradient(#38bdf8 0% 75%, #334155 75% 100%);
    margin: 0 auto 1rem; /* Center horizontally, add bottom margin */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem; /* Text size inside circle */
    color: #f8fafc; /* Text color inside */
    animation: progress 2s linear infinite; /* Apply defined animation */
}


/* =========================================
   Footer Styles
   ========================================= */
footer {
    background: #1e293b; /* Footer background */
    padding: 2rem;
    margin-top: 3rem; /* Space above footer */
    text-align: center;
    color: #94a3b8; /* Muted text color */
    font-size: 0.9rem;
}

/* =========================================
   Mobile Navigation & Overrides (max-width: 768px)
   ========================================= */
@media (max-width: 768px) {
    /* Adjust body padding if header height changes on mobile */
    /* body { padding-top: 60px; } */
    /* header { height: 60px; } */

    /* Hide desktop nav list */
    nav ul {
        display: none;
    }

    /* Show mobile menu toggle button */
    .menu-toggle {
        display: block; /* Show the button */
    }

    /* Styles for the mobile navigation container WHEN ACTIVE */
    nav.active ul {
        display: flex; /* Show the list */
        flex-direction: column; /* Stack items vertically */
        position: fixed; /* Fixed position relative to viewport */
        top: 70px; /* Position below the fixed header */
        left: 0;
        right: 0; /* Full width */
        background: #1e293b; /* Mobile menu background */
        padding: 1rem 0; /* Vertical padding */
        margin: 0; /* Reset margin */
        z-index: 999; /* Below header but above content */
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Optional shadow */
        border-top: 1px solid rgba(248, 250, 252, 0.1); /* Optional top border */
        max-height: calc(100vh - 70px); /* Max height */
        overflow-y: auto; /* Allow scrolling */
    }

    /* Style individual links in active mobile menu */
    nav.active ul a {
        padding: 1rem 1.5rem; /* Larger padding for touch */
        text-align: center; /* Center text */
        width: 100%; /* Ensure full width */
        border-bottom: 1px solid rgba(248, 250, 252, 0.1); /* Separator */
    }

    nav.active ul li:last-child a {
        border-bottom: none; /* Remove border from last item */
    }

    /* Adjust grid/component padding/layout for mobile if needed */
    .feature-grid, .dashboard, .sustainability-panel, .chatbot-container {
        padding: 1.5rem;
        margin: 1rem; /* Reduce margin on mobile */
    }
}

/* =========================================
   Animations
   ========================================= */
@keyframes progress {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

