/* ===== Variables ===== */
:root {
    /* Background */
    --bg-main: #e8f5e9;
    
    /* Card colors */
    --card-green: #2e7d32;
    --card-green-text: #1b5e20;
    
    --card-yellow: #fff9c4;
    --card-yellow-text: #f57f17;
    
    --card-blue: #e3f2fd;
    --card-blue-text: #1565c0;
    
    /* Sidebar */
    --sidebar-bg: #1b5e20;
    --sidebar-hover: #2e7d32;
    --sidebar-text: #ffffff;
    --sidebar-muted: rgba(255,255,255,0.7);
    
    /* Accent */
    --accent: #43a047;
    --accent-hover: #388e3c;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-main);
    color: #1b5e20;
    min-height: 100vh;
    display: flex;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, width 0.3s ease;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 50;
}

.sidebar.collapsed {
    transform: translateX(-260px);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sidebar-text);
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #66bb6a, #43a047);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Navigation */
.nav-links {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background-color 0.2s;
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--sidebar-hover);
}

.nav-link.active {
    background-color: var(--accent);
}

.nav-icon {
    width: 20px;
    height: 20px;
    opacity: 0.9;
}

/* New Chat Button */
.new-chat-section {
    padding: 16px 12px;
    margin-top: 8px;
}

.new-chat-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #66bb6a, #43a047);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* History Section */
.history-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 12px;
    overflow: hidden;
}

.history-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--sidebar-muted);
    padding: 16px 0 12px;
    letter-spacing: 0.05em;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 12px;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.3);
    border-radius: 3px;
}

/* Toggle Button */
.sidebar-toggle {
    position: fixed;
    left: 16px;
    top: 16px;
    width: 44px;
    height: 44px;
    background-color: var(--sidebar-bg);
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

body.sidebar-collapsed .sidebar-toggle {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-close {
    position: absolute;
    right: 12px;
    top: 24px;
    background: none;
    border: none;
    color: var(--sidebar-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}

.sidebar-close:hover {
    color: var(--sidebar-text);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    padding: 40px;
}

body.sidebar-collapsed .main-content {
    margin-left: 0;
}

/* ===== Cards ===== */
.card {
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card-green {
    background-color: var(--card-green);
    color: white;
}

.card-green h2, .card-green h3, .card-green p {
    color: #e8f5e9;
}

.card-yellow {
    background-color: var(--card-yellow);
    color: var(--card-yellow-text);
}

.card-blue {
    background-color: var(--card-blue);
    color: var(--card-blue-text);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    font-weight: 700;
}

.card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.card p {
    line-height: 1.6;
    font-size: 1rem;
}

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--card-green);
    margin-bottom: 8px;
}

.page-header p {
    font-size: 1.1rem;
    color: #558b2f;
}

/* ===== Grid Layout ===== */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ===== Features List ===== */
.features-list {
    list-style: none;
    margin-top: 16px;
}

.features-list li {
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.features-list li:last-child {
    border-bottom: none;
}

.features-list .icon {
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Chat Interface ===== */
.chat-container {
    max-width: 800px;
    margin: 0 auto;
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.chat-welcome h1 {
    font-size: 2rem;
    color: var(--card-green);
    margin-bottom: 12px;
}

.chat-welcome p {
    color: #558b2f;
    font-size: 1.1rem;
}

.input-area {
    padding: 20px 0;
}

.input-wrapper {
    position: relative;
    background-color: white;
    border-radius: 14px;
    border: 2px solid #a5d6a7;
    display: flex;
    align-items: flex-end;
    transition: border-color 0.2s;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.input-wrapper:focus-within {
    border-color: var(--accent);
}

.chat-input {
    flex: 1;
    background: none;
    border: none;
    padding: 18px;
    color: #1b5e20;
    font-size: 1rem;
    resize: none;
    max-height: 200px;
    outline: none;
    font-family: inherit;
}

.chat-input::placeholder {
    color: #81c784;
}

.send-btn {
    padding: 14px 18px;
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

.send-btn:hover {
    color: var(--accent-hover);
    transform: scale(1.1);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state h2 {
    font-size: 1.8rem;
    color: var(--card-green);
    margin-bottom: 12px;
}

.empty-state p {
    color: #558b2f;
    font-size: 1.1rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-260px);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 24px;
    }
    
    .sidebar-toggle {
        opacity: 1;
        pointer-events: auto;
    }
    
    body.sidebar-collapsed .sidebar-toggle {
        opacity: 1;
    }
}
