:root {
    --primary-color: #2e7d32;
    --primary-dark: #1b5e20;
    --primary-light: #4caf50;
    --accent-color: #ffca28;
    --text-color: #1f2937;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --border-color: #e5e7eb;
    --error-color: #ef4444;
    --success-color: #10b981;
    --border-radius: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;

    --hero-bg: linear-gradient(to bottom, #f0fdf4, #ffffff);
    --header-bg: linear-gradient(135deg, #1b5e20, #2e7d32);

    /* Message Colors (Light Mode) */
    --msg-success-bg: rgba(16, 185, 129, 0.1);
    --msg-success-border: var(--success-color);
    --msg-error-bg: rgba(239, 68, 68, 0.1);
    --msg-error-border: var(--error-color);
}

body.dark-mode {
    --primary-color: #4ade80;
    /* Brighter green for dark mode */
    --primary-dark: #22c55e;
    --primary-light: #86efac;
    --text-color: #f3f4f6;
    --bg-color: #111827;
    /* Dark background */
    --card-bg: #1f2937;
    /* Darker card background */
    --input-bg: #374151;
    --border-color: #374151;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --hero-bg: linear-gradient(to bottom, #111827, #1f2937);
    --header-bg: linear-gradient(135deg, #1f2937, #111827);

    /* Message Colors (Dark Mode) - Darker backgrounds for better contrast */
    --msg-success-bg: rgba(16, 185, 129, 0.15);
    --msg-success-border: #4ade80;
    --msg-error-bg: rgba(239, 68, 68, 0.2);
    --msg-error-border: #f87171;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background-color: var(--primary-dark);
    background: var(--header-bg) !important;
    color: white;
    padding: 1rem 2rem;
    border-radius: 0 0 30px 30px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.title-area h1 {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0;
}

.title-area h1 i {
    color: var(--primary-light);
}

.title-area p {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 5px;
}

/* Language Selector */
.theme-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin: 0;
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* Header Controls Container */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Language Switcher Wrapper */
.language-wrapper {
    position: relative;
    display: inline-block;
    width: fit-content;
}

.language-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    height: 40px;
    line-height: normal;
    padding: 0 40px 0 15px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    backdrop-filter: blur(5px);
    outline: none;
    margin: 0;
    width: auto;
    display: block;
}

.language-wrapper select:hover {
    background: rgba(255, 255, 255, 0.25);
}

.language-wrapper select option {
    background: #333;
    color: white;
}

/* Arrow Icon */
.language-wrapper::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    pointer-events: none;
    font-size: 0.75rem;
}

/* Wrapper */
.wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.section-title {
    font-size: 1.5rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid #e5e7eb;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

ul {
    list-style: none;
}

li {
    padding: 0.8rem 0;
    border-bottom: 1px solid #e5e7eb;
}

li:last-child {
    border-bottom: none;
}

.assistant-hero {
    background: var(--hero-bg);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.3s ease;
}

body.dark-mode .assistant-hero {
    background: linear-gradient(to bottom, #111827, #1f2937) !important;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    padding-bottom: 3rem;
}

/* Sections/Cards */
.section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.weather-section {
    grid-column: 1 / -1;
}

.section:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

h2 {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 0.5rem;
    font-weight: 600;
}

/* Buttons */
button {
    background-color: var(--primary-color);
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
}

button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

/* Form Elements */
input[type="text"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    background: #f9fafb;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
    background: white;
}

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

/* Results & Loaders */
.loader {
    color: var(--primary-color);
    font-weight: 500;
    margin-top: 1rem;
    padding: 1rem;
    background: #f0fdf4;
    border-radius: 8px;
    display: none;
}

.loader.active {
    display: block;
}

pre {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    white-space: pre-wrap;
    font-family: inherit;
    border: 1px solid #e2e8f0;
}

/* Weather Dashboard */
.weather-dashboard {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2rem;
    align-items: start;
}

.current-weather-card {
    background: linear-gradient(135deg, #e0f2f1 0%, #b2dfdb 100%);
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.temp-display {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1;
}

.condition-display {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-top: 0.5rem;
    font-weight: 600;
}

.weather-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.weather-detail-item {
    background: #f8fafc;
    padding: 0.8rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.weather-detail-label {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.weather-detail-value {
    font-weight: 700;
    color: #334155;
    font-size: 1.1rem;
}

/* Forecast Scroll */
.forecast-container {
    margin-top: 1.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.forecast-grid {
    display: flex;
    gap: 1rem;
}

.forecast-card {
    min-width: 120px;
    background: white;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

.forecast-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-light);
}

/* Image Preview */
#preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    margin-top: 1rem;
    display: none;
    object-fit: cover;
    box-shadow: var(--shadow-sm);
}

/* Footer */
footer {
    background-color: var(--primary-dark);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    font-size: 0.9rem;
}

/* Full-Width Assistant Hero */
.assistant-hero {
    background: var(--hero-bg);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-content {
    width: 800px;
    max-width: 95vw;
    display: flex;
    flex-direction: column;
    height: auto;
}

/* Unified Assistant & Chat Styles */
.assistant-section {
    background: var(--card-bg);
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.assistant-container {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 500px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    flex: none;
    gap: 1rem;
    overflow: hidden;
}

.chat-output {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 1rem;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.welcome-message {
    text-align: center;
    color: #64748b;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.welcome-message i {
    font-size: 2rem;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}

/* Chat Bubbles */
.chat-bubble {
    padding: 1rem;
    border-radius: 12px;
    max-width: 90%;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
    box-shadow: var(--shadow-sm);
    max-height: none;
    overflow-y: visible;
    word-wrap: break-word;
    flex-shrink: 0;
}

/* Custom Scrollbar for Chat Output */
.chat-output::-webkit-scrollbar {
    width: 8px;
}

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

.chat-output::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.chat-output::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.chat-bubble::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 2px;
    max-height: none;
}

.chat-bubble.bot {
    align-self: flex-start;
    background: var(--card-bg);
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 2px;
}

/* Input Area Polish */
.input-area {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--input-bg);
    padding: 0.8rem 1.2rem;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.2s, background-color 0.3s;
    flex-shrink: 0;
    min-height: 60px;
}

.input-area:focus-within {
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
    border-color: var(--primary-color);
}

.input-area textarea {
    border: none;
    background: transparent;
    padding: 0.2rem;
    margin: 0;
    font-size: 1rem;
    min-height: 24px;
    max-height: 100px;
    resize: none;
    box-shadow: none;
    flex: 1;
    color: var(--text-color);
}

#assistant-output {
    min-height: 200px;
    padding: 1rem;
}

.input-area textarea:focus {
    box-shadow: none;
    outline: none;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    border: none;
    padding: 0;
}

.icon-btn {
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    box-shadow: none;
    font-size: 1.1rem;
}

.icon-btn:hover {
    background: #f1f5f9;
    color: var(--primary-color);
    transform: none;
    box-shadow: none;
}

.send-btn {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Image Preview Polish */
#image-preview-container {
    position: relative;
    display: inline-block;
    margin: 0.5rem 0 0 1rem;
}

#preview {
    height: 80px;
    width: auto;
    border-radius: 8px;
    border: 2px solid white;
    box-shadow: var(--shadow-md);
}

.remove-img-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 10px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Weather & General Polish */
.weather-section {
    padding: 1.5rem !important;
}

.weather-dashboard {
    gap: 1.5rem;
}

.temp-display {
    font-size: 3rem;
    letter-spacing: -1px;
}

.full-width-btn {
    width: 100%;
    justify-content: center;
    padding: 1rem;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bottom Grid Container */
.main-grid {
    padding-top: 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    max-width: 1300px;
    margin: 0 auto;
    padding-bottom: 4rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .weather-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .weather-dashboard {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .container {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    .assistant-hero {
        padding: 0.5rem;
        min-height: auto;
    }

    .hero-content {
        width: 100%;
        max-width: 100%;
    }

    .assistant-container {
        height: 80vh !important;
        width: 100% !important;
        padding: 1rem;
    }

    .main-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Force cards to fit screen on mobile */
    .main-grid .section {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 400px;
    }

    .weather-strip {
        gap: 1rem;
        font-size: 0.8rem;
    }
}

/* Enhanced Bottom Cards */
.main-grid .section {
    border-top: 5px solid var(--primary-color);
    background: var(--card-bg);
    height: 100%;
}

.weather-section-bottom {
    border-top-color: #3b82f6 !important;
}

/* Internal Weather Card Layout (Compact Card) */
.weather-card-inner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    text-align: center;
}

.weather-main-info {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.weather-main-info h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #64748b;
}

.weather-main-info .temp {
    font-size: 3rem;
    font-weight: 800;
    color: #3b82f6;
    line-height: 1.2;
}

.weather-main-info .cond {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
}

.weather-details-mini-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    width: 100%;
    margin-top: 0.5rem;
}

.wd-item {
    background: #f8fafc;
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.main-grid .section:nth-child(2) {
    border-top-color: var(--primary-color);
}

.main-grid .section:nth-child(3) {
    border-top-color: var(--accent-color);
}

/* Forecast Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.modal-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 24px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.show .modal-content {
    transform: scale(1);
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close-modal:hover {
    color: #000;
}

.forecast-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-forecast-card {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 16px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s;
}

.modal-forecast-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.modal-date {
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.5rem;
    display: block;
}

.modal-icon {
    font-size: 1.5rem;
    margin: 0.5rem 0;
    display: block;
}

.modal-temp {
    font-weight: 600;
    color: #0f172a;
}

.modal-rain {
    color: #3b82f6;
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

/* === SCROLLABLE RESOURCE CARDS === */
.main-grid .section {
    height: 450px;
    width: 400px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#market-price-output,
#schemes-output,
#weather-output {
    flex: 1;
    overflow-y: auto;
    margin-top: 1rem;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

#market-price-output::-webkit-scrollbar,
#schemes-output::-webkit-scrollbar,
#weather-output::-webkit-scrollbar {
    width: 6px;
}

#market-price-output::-webkit-scrollbar-track,
#schemes-output::-webkit-scrollbar-track,
#weather-output::-webkit-scrollbar-track {
    background: transparent;
}

#market-price-output::-webkit-scrollbar-thumb,
#schemes-output::-webkit-scrollbar-thumb,
#weather-output::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

#market-price-output p,
#schemes-output p {
    margin: 0;
}

/* === TOAST NOTIFICATIONS === */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 5px solid #2e7d32;
    font-weight: 500;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.success {
    border-left-color: #10b981;
}

.toast-icon {
    font-size: 1.2rem;
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.success .toast-icon {
    color: #10b981;
}

.toast.info .toast-icon {
    color: #3b82f6;
}

body.dark-mode {
    --primary-color: #4ade80;
    /* Brighter green for dark mode */
    --primary-dark: #22c55e;
    --primary-light: #86efac;
    --text-color: #f3f4f6;
    --bg-color: #111827;
    /* Dark background */
    --card-bg: #1f2937;
    /* Darker card background */
    --input-bg: #374151;
    --border-color: #374151;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --hero-bg: linear-gradient(to bottom, #111827, #1f2937);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('../images/farm.jpg');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 1rem 2rem;
    border-radius: 0 0 30px 30px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.title-area h1 {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0;
}

.title-area h1 i {
    color: var(--primary-light);
}

.title-area p {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 5px;
}

/* Compact Language Selector */
.theme-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin: 0;
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.lang-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    /* Enforce container height */
}

.lang-selector select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    height: 40px;
    line-height: 1.2;
    /* Normal line height */
    padding: 0 35px 0 15px;
    /* Horizontal padding only */
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    backdrop-filter: blur(5px);
    outline: none;
    display: flex;
    align-items: center;
    /* Try to center content for browsers that support it */
    margin: 0;
    box-sizing: border-box;
    /* Critical */
}

.lang-selector select:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lang-selector select option {
    background: #333;
    color: white;
}

/* Chevron */
.lang-selector::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 1rem;
    color: white;
    pointer-events: none;
    font-size: 0.8rem;
}

/* Common Section Wrapper */
.wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.section-title {
    font-size: 1.5rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid #e5e7eb;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* List Styles */
ul {
    list-style: none;
}

li {
    padding: 0.8rem 0;
    border-bottom: 1px solid #e5e7eb;
}

li:last-child {
    border-bottom: none;
}

/* Full-Width Assistant Hero */
.assistant-hero {
    background: var(--hero-bg);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.3s ease;
}

/* Explicit fallback/override for dark mode if variable fails */
body.dark-mode .assistant-hero {
    background: linear-gradient(to bottom, #111827, #1f2937) !important;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    /* Video/Dashboard style */
    gap: 1.5rem;
    padding-bottom: 3rem;
}

/* Sections/Cards */
.section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.weather-section {
    grid-column: 1 / -1;
    /* Full width for weather */
}

.section:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

h2 {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 0.5rem;
    font-weight: 600;
}

/* Buttons */
button {
    background-color: var(--primary-color);
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
}

button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

/* Form Elements */
input[type="text"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    background: #f9fafb;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
    background: white;
}

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

/* Results & Loaders */
.loader {
    color: var(--primary-color);
    font-weight: 500;
    margin-top: 1rem;
    padding: 1rem;
    background: #f0fdf4;
    border-radius: 8px;
    display: none;
    /* Hidden by default */
}

.loader.active {
    display: block;
}

pre {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    white-space: pre-wrap;
    font-family: inherit;
    border: 1px solid #e2e8f0;
}

/* Weather Dashboard */
.weather-dashboard {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2rem;
    align-items: start;
}

.current-weather-card {
    background: linear-gradient(135deg, #e0f2f1 0%, #b2dfdb 100%);
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.temp-display {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1;
}

.condition-display {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-top: 0.5rem;
    font-weight: 600;
}

.weather-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.weather-detail-item {
    background: #f8fafc;
    padding: 0.8rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.weather-detail-label {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.weather-detail-value {
    font-weight: 700;
    color: #334155;
    font-size: 1.1rem;
}

/* Forecast Scroll */
.forecast-container {
    margin-top: 1.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    /* Space for scrollbar */
}

.forecast-grid {
    display: flex;
    gap: 1rem;
}

.forecast-card {
    min-width: 120px;
    background: white;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

.forecast-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-light);
}

/* Image Preview */
#preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    margin-top: 1rem;
    display: none;
    object-fit: cover;
    box-shadow: var(--shadow-sm);
}

/* Footer */
footer {
    background-color: var(--primary-dark);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    font-size: 0.9rem;
}

/* List Styles */
ul {
    list-style-type: none;
    padding: 0;
}

li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
}

li:last-child {
    border-bottom: none;
}

/* Full-Width Assistant Hero */
.assistant-hero {
    background: linear-gradient(to bottom, #f0fdf4, #ffffff);
    padding: 2rem 1rem;
    /* Removed min-height, let fixed container drive it */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-content {
    width: 800px;
    /* STRICT FIXED WIDTH */
    max-width: 95vw;
    /* Mobile fallback */
    display: flex;
    flex-direction: column;
    height: auto;
}

/* Unified Assistant & Chat Styles */
.assistant-section {
    background: var(--card-bg);
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.assistant-container {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 500px;
    /* Fixed height for the widget */
    border: 1px solid rgba(0, 0, 0, 0.05);
    flex: none;
    gap: 1rem;
    overflow: hidden;
    /* Input stays at bottom, content scrolls inside chat-output */
}

.chat-output {
    flex: 1;
    overflow-y: auto;
    /* Scrollbar IS HERE (The "Box") */
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 1rem;
    min-height: 0;
    /* Allow shrinking */
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.welcome-message {
    text-align: center;
    color: #64748b;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.welcome-message i {
    font-size: 2rem;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}

/* Chat Bubbles */
.chat-bubble {
    padding: 1rem;
    border-radius: 12px;
    max-width: 90%;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
    box-shadow: var(--shadow-sm);
    /* NO SCROLLBAR ON BUBBLES */
    max-height: none;
    overflow-y: visible;
    word-wrap: break-word;
    flex-shrink: 0;
}

/* Custom Scrollbar for Chat Output */
.chat-output::-webkit-scrollbar {
    width: 8px;
}

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

.chat-output::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.chat-output::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.chat-bubble::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 2px;
    /* User messages usually short, but just in case */
    max-height: none;
}

.chat-bubble.bot {
    align-self: flex-start;
    background: var(--card-bg);
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 2px;
}

/* Input Area Polish */
.input-area {
    display: flex;
    align-items: center;
    /* Center Vertically */
    gap: 0.8rem;
    background: var(--input-bg);
    /* Dynamic Background */
    padding: 0.8rem 1.2rem;
    border-radius: 30px;
    /* Pill shape */
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.2s, background-color 0.3s;
    flex-shrink: 0;
    /* Prevent input from shrinking */
    min-height: 60px;
    /* Force minimum height */
}

.input-area:focus-within {
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
    border-color: var(--primary-color);
}

.input-area textarea {
    border: none;
    background: transparent;
    padding: 0.2rem;
    margin: 0;
    font-size: 1rem;
    min-height: 24px;
    /* Init height */
    max-height: 100px;
    resize: none;
    box-shadow: none;
    flex: 1;
    /* Take remaining space */
    color: var(--text-color);
}

/* Ensure Chat Output Maintains Size */
#assistant-output {
    min-height: 200px;
    padding: 1rem;
    /* max-height removed to allow expansion */
    /* overflow-y removed to prevent scrollbar */
}

.input-area textarea:focus {
    box-shadow: none;
    outline: none;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    border: none;
    /* Removed top border */
    padding: 0;
}

.icon-btn {
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    box-shadow: none;
    font-size: 1.1rem;
}

.icon-btn:hover {
    background: #f1f5f9;
    color: var(--primary-color);
    transform: none;
    box-shadow: none;
}

.send-btn {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Image Preview Polish */
#image-preview-container {
    position: relative;
    display: inline-block;
    margin: 0.5rem 0 0 1rem;
}

#preview {
    height: 80px;
    width: auto;
    border-radius: 8px;
    border: 2px solid white;
    box-shadow: var(--shadow-md);
}

.remove-img-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 10px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Weather & General Polish */
.weather-section {
    padding: 1.5rem !important;
    /* Restore some padding */
}

.weather-dashboard {
    gap: 1.5rem;
}

.temp-display {
    font-size: 3rem;
    letter-spacing: -1px;
}

.full-width-btn {
    width: 100%;
    justify-content: center;
    padding: 1rem;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bottom Grid Container */
.main-grid {
    padding-top: 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    /* Adaptive 3-column */
    gap: 1.5rem;
    max-width: 1300px;
    margin: 0 auto;
    padding-bottom: 4rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .weather-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .weather-dashboard {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .container {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    .assistant-hero {
        padding: 0.5rem;
        min-height: auto;
    }

    .hero-content {
        width: 100%;
        /* Full width on mobile */
        max-width: 100%;
    }

    .assistant-container {
        height: 80vh !important;
        /* Force override */
        width: 100% !important;
        padding: 1rem;
    }

    .main-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Force cards to fit screen on mobile */
    .main-grid .section {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 400px;
    }

    .weather-strip {
        gap: 1rem;
        font-size: 0.8rem;
    }
}

/* Enhanced Bottom Cards */
.main-grid .section {
    border-top: 5px solid var(--primary-color);
    /* distinctive top border */
    background: var(--card-bg);
    /* Use variable for dark mode */
    height: 100%;
}

.weather-section-bottom {
    border-top-color: #3b82f6 !important;
    /* Blue Accent for Weather */
}

/* Internal Weather Card Layout (Compact Card) */
.weather-card-inner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    text-align: center;
}

.weather-main-info {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.weather-main-info h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #64748b;
}

.weather-main-info .temp {
    font-size: 3rem;
    font-weight: 800;
    color: #3b82f6;
    line-height: 1.2;
}

.weather-main-info .cond {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
}

.weather-details-mini-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    width: 100%;
    margin-top: 0.5rem;
}

.wd-item {
    background: #f8fafc;
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.main-grid .section:nth-child(2) {
    border-top-color: var(--primary-color);
    /* Green for Market */
}

.main-grid .section:nth-child(3) {
    border-top-color: var(--accent-color);
    /* Gold for Schemes */
}

/* Subtle Hero Pattern */
.assistant-hero {
    background-color: #f0fdf4;
    opacity: 1;
    background-image: radial-gradient(#2e7d32 0.5px, transparent 0.5px), radial-gradient(#2e7d32 0.5px, #f0fdf4 0.5px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    /* Softens the pattern */
    background-blend-mode: overlay;
    background: radial-gradient(circle at center, #ffffff 30%, #f0fdf4 100%);
}

/* Forecast Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.modal-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 24px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.show .modal-content {
    transform: scale(1);
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close-modal:hover {
    color: #000;
}

.forecast-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-forecast-card {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 16px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s;
}

.modal-forecast-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.modal-date {
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.5rem;
    display: block;
}

.modal-icon {
    font-size: 1.5rem;
    margin: 0.5rem 0;
    display: block;
}

.modal-temp {
    font-weight: 600;
    color: #0f172a;
}

.modal-rain {
    color: #3b82f6;
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

/* === SCROLLABLE RESOURCE CARDS (User Request) === */
/* === SCROLLABLE RESOURCE CARDS (User Request) === */
.main-grid .section {
    height: 450px;
    /* Adjusted to 450px as requested */
    width: 400px;
    /* User requested locked width */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent card itself from scrolling, inner content will scroll */
}

/* Make the output containers scrollable and fill remaining space */
#market-price-output,
#schemes-output,
#weather-output {
    flex: 1;
    /* Take all remaining height */
    overflow-y: auto;
    /* Enable vertical scroll inside this area */
    margin-top: 1rem;
    padding-right: 0.5rem;
    /* Space for scrollbar */
    /* Custom Scrollbar for these areas too */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

#market-price-output::-webkit-scrollbar,
#schemes-output::-webkit-scrollbar,
#weather-output::-webkit-scrollbar {
    width: 6px;
}

#market-price-output::-webkit-scrollbar-track,
#schemes-output::-webkit-scrollbar-track,
#weather-output::-webkit-scrollbar-track {
    background: transparent;
}

#market-price-output::-webkit-scrollbar-thumb,
#schemes-output::-webkit-scrollbar-thumb,
#weather-output::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

/* Ensure empty state text or loader is centered if needed, or just let it flow */
#market-price-output p,
#schemes-output p {
    margin: 0;
}

/* === TOAST NOTIFICATIONS === */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    /* Let clicks pass through container */
}

.toast {
    background: white;
    color: #333;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 1px solid rgba(0, 0, 0, 0.05);
    pointer-events: auto;
    /* Enable clicks on actual toasts */
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.success {
    border-left: 4px solid #22c55e;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

.toast-icon {
    font-size: 1.2rem;
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.success .toast-icon {
    color: #22c55e;
}

.toast.info .toast-icon {
    color: #3b82f6;
}

/* TTS Button */
.tts-btn {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    margin-left: 0.5rem;
    padding: 0.2rem;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    vertical-align: middle;
    float: right;
    /* Align to right bottom of bubble */
    margin-top: 0.5rem;
}

.tts-btn:hover {
    opacity: 1;
    color: var(--primary-dark);
}

.tts-btn.speaking {
    color: var(--error-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Secondary Language Selector (Desktop) */
.assistant-header-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Align next to each other */
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    width: 100%;
    border-bottom: 2px solid var(--border-color);
    /* The long line */
    padding-bottom: 1rem;
}

#assistant-title {
    border-bottom: none !important;
    text-decoration: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

.language-wrapper-secondary {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-top: 12px;
    height: 38px;
    /* Force height match */
}

.language-wrapper-secondary select {
    appearance: none;
    -webkit-appearance: none;
    height: 100%;
    /* Fill wrapper */
    width: 100%;
    /* Fill wrapper */
    padding: 0 40px 0 15px;
    background: var(--card-bg);
    border: 2px solid var(--primary-light);
    border-radius: 20px;
    color: var(--primary-dark);
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    outline: none;
    transition: all 0.3s ease;
}

.language-wrapper-secondary select:hover,
.language-wrapper-secondary select:focus {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.language-wrapper-secondary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 15px;
    top: 0;
    height: 100%;
    /* Fill height */
    display: flex;
    /* Flexbox centering */
    align-items: center;
    /* Vertical center */
    /* Remove previous transform/top hacks */
    transform: none;
    color: var(--primary-color);
    pointer-events: none;
    font-size: 0.75rem;
    transition: color 0.3s;
}

.language-wrapper-secondary:hover::after {
    color: var(--primary-dark);
}

/* Hide secondary selector on mobile if too crowded */
@media (max-width: 600px) {
    .language-wrapper-secondary {
        display: none;
    }
}