@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #16a34a;
    --primary-light: #22c55e;
    --primary-dark: #15803d;
    --accent: #f59e0b;
    --bg-main: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --glass: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --brand-green-gradient: linear-gradient(135deg, #2e7d32 0%, #4caf50 100%);
    --brand-green-hover: linear-gradient(135deg, #388e3c 0%, #66bb6a 100%);
}

/* =========================
   Global Navbar (AgriTech)
   ========================= */

.navbar {
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-content {
  max-width: 1400px;
  margin: auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: #16a34a;
  text-decoration: none;
}

.navbar-brand img {
  width: 36px;
  height: 36px;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
}

.nav-links a {
  text-decoration: none;
  font-weight: 500;
  color: #1f2937;
}

.nav-links a:hover {
  color: #16a34a;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-search {
  display: flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
}

.nav-search input {
  border: none;
  padding: 0.45rem 0.6rem;
  outline: none;
}

.nav-search button {
  background: #16a34a;
  border: none;
  color: white;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

.nav-btn {
 background: var(--brand-green-gradient) !important; /* Unified Green Palette */
    color: #ffffff !important;
    border: none !important;
    padding: 0.6rem 1.25rem;
    border-radius: 25px; /* Pill-shaped aesthetic */
    font-weight: 700;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    /* Bouncy Interaction Logic */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow 0.3s ease, background 0.3s ease;
}

.nav-btn:hover {
    transform: scale(1.08) translateY(-2px);
    background: var(--brand-green-hover) !important;
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.4);
}

.nav-btn.primary {
    background: #16a34a !important; /* Standout register button */
}

.forum-layout {
  margin-top: 1rem;
}

body.dark-mode {
    --bg-main: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.8);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --glass: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.05);
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    transition: background-color 0.4s ease;
    line-height: 1.5;
}

.forum-layout {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: 2rem;
    max-width: 1440px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Sidebar & Widgets */
.sidebar,
.widgets {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card h3 {
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

/* Categories List */
.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
}

.category-item:hover,
.category-item.active {
    background: rgba(34, 197, 94, 0.15); /* Green Glow highlight */
    color: var(--primary-light);
    transform: scale(1.02) translateX(8px);
}

.category-item .count {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* Feed Column */
.feed-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 500px;
}

.search-container i {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 3rem;
    border-radius: 15px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: 0.3s;
}

.search-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.1);
}

.btn-ask {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.85rem 1.5rem;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: 0.3s;
}

.btn-ask:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(22, 163, 74, 0.3);
}

/* Thread Card */
.thread-card {
    margin-bottom: 1.5rem;
    transition: 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.thread-card:hover {
    transform: translateY(-5px);
}

.thread-card.pinned::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
}

.thread-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.thread-preview {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.thread-tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    background: rgba(22, 163, 74, 0.1);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

.thread-footer {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.thread-footer span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.upvote-active {
    color: var(--primary);
    font-weight: 600;
}

/* AI Highlight */
.ai-badge {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: 0.3s;
}

.modal-content {
    width: 100%;
    max-width: 700px;
    transform: translateY(20px);
    transition: 0.3s;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

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

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.thread-card {
    animation: slideIn 0.5s ease backwards;
}

@media (max-width: 1100px) {
    .forum-layout {
        grid-template-columns: 240px 1fr;
    }

    .widgets {
        display: none;
    }
}

@media (max-width: 768px) {
    .forum-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }
}/* ===== Dark Mode ===== */
body.dark-mode {
  background: #121212 !important;
  color: #ffffff !important;
}

body.dark-mode .navbar,
body.dark-mode .card,
body.dark-mode .sidebar,
body.dark-mode .widgets,
body.dark-mode .modal-content {
  background: #1e1e1e !important;
  color: #ffffff !important;
}

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
  background: #2a2a2a !important;
  color: #ffffff !important;
  border: 1px solid #444 !important;
}

body.dark-mode .nav-btn {
  background: #2a2a2a !important;
  color: #ffffff !important;
  border: 1px solid #444 !important;
}

body.dark-mode a {
  color: #4CAF50 !important;
}

/* Animated Theme Toggle  */
.theme-toggle {
    background: var(--bg-main, #f8fafc);
    border: 1px solid #d1d5db ;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    color: var(--text-main, #1e293b);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    flex-shrink: 0;
    align-self: center;
    box-shadow: none !important;
}

body.dark-mode .theme-toggle {
    background: transparent;
    border: 1px solid var(--border, #475569);
    color: var(--text-main, #f1f5f9);
}

.theme-toggle:hover {
    background-color: var(--bg-secondary, #f3f4f6);
    border-color: var(--primary-green, #16a34a) !important;
}

.theme-icon {
    width: 22px;
    height: 22px;
    overflow: visible;
    transition: transform 0.6s cubic-bezier(0.68, -0.6, 0.32, 1.6);
    display: block;
}

.sun-core {
    transform-origin: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.sun-rays {
    transform-origin: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

.moon-bite {
    transform-origin: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light mode → Sun */
[data-theme="light"] .theme-icon {
    transform: rotate(0deg);
}

[data-theme="light"] .sun-core {
    transform: scale(1);
}

[data-theme="light"] .sun-rays {
    transform: scale(1.1);
    opacity: 1;
}

[data-theme="light"] .moon-bite {
    transform: translate(20px, -20px);
}

/* Dark mode → Moon */
[data-theme="dark"] .theme-icon {
    transform: rotate(-10deg);
}

[data-theme="dark"] .sun-core {
    transform: scale(1.4);
}

[data-theme="dark"] .sun-rays {
    transform: scale(0.1);
    opacity: 0;
}

[data-theme="dark"] .moon-bite {
    transform: translate(5px, -1.5px) scale(0.6);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}