:root {
    --primary-color: #2e7d32;
    --primary-dark: #1b5e20;
    --primary-light: #4caf50;
    --accent-color: #81c784;
    --bg-color: #f1f8e9;
    --chat-bg: #ffffff;
    --text-color: #1a1a1a;
    --text-light: #757575;
    --sidebar-bg: #1b5e20;
    --sidebar-text: #e8f5e9;
    --message-user-bg: #2e7d32;
    --message-user-text: #ffffff;
    --message-bot-bg: #f5f5f5;
    --message-bot-text: #1a1a1a;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

html,
body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-color);
    overflow: hidden;
    /* Prevent scroll on main chat page */
}

/* Admin Page Override */
body.admin-body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    /* Prevent sidebar from shrinking */
}

.sidebar-header h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--primary-light);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--accent-color);
}

.recent-chats {
    flex: 1;
    overflow-y: auto;
    margin-top: 2rem;
}

.recent-chats h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-link {
    color: var(--sidebar-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.admin-link:hover {
    opacity: 1;
}

/* Main Chat Area */
.chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--chat-bg);
    position: relative;
    width: 100%;
    /* Ensure it takes full available width */
    min-width: 0;
    /* Allow flex item to shrink below content size if needed */
}

.chat-header {
    padding: 1rem 2rem;
    background-color: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-header h1 {
    font-size: 1.2rem;
    color: var(--primary-dark);
}

.mobile-only {
    display: none;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.message {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
}

.message-content {
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    line-height: 1.5;
    box-shadow: var(--shadow);
    word-wrap: break-word;
    /* Ensure long words don't overflow */
}

.bot-message .message-content {
    background-color: var(--message-bot-bg);
    color: var(--message-bot-text);
    border-top-left-radius: 0;
}

.user-message .message-content {
    background-color: var(--message-user-bg);
    color: var(--message-user-text);
    border-top-right-radius: 0;
}

.chat-input-area {
    padding: 2rem;
    background-color: var(--glass-bg);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    width: 100%;
}

.input-wrapper {
    display: flex;
    gap: 1rem;
    background-color: var(--message-bot-bg);
    padding: 0.5rem;
    border-radius: 1rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

#user-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.8rem;
    font-size: 1rem;
    outline: none;
    min-width: 0;
    /* Fix for flexbox input sizing */
}

.icon-btn {
    background: none;
    border: none;
    padding: 0.8rem;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.2s;
    border-radius: 50%;
    flex-shrink: 0;
}

.icon-btn:hover {
    color: var(--primary-color);
    background-color: rgba(0, 0, 0, 0.05);
}

.send-btn {
    color: var(--primary-color);
}

.footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        height: 100%;
        z-index: 1000;
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
        /* Add shadow to floating sidebar */
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-only {
        display: block;
        background: none;
        border: none;
        font-size: 1.2rem;
        cursor: pointer;
        color: var(--text-color);
    }

    .chat-messages {
        padding: 1rem;
        /* Reduce padding on mobile */
    }

    .chat-input-area {
        padding: 1rem;
        /* Reduce padding on mobile */
    }

    .message {
        max-width: 90%;
        /* Allow wider messages on mobile */
    }

    .chat-header {
        padding: 0.8rem 1rem;
    }
}

/* Admin Styles */
.admin-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
    padding: 1rem;
    /* Reduced padding for mobile */
    width: 100%;
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    text-align: center;
    color: var(--primary-dark);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.error-message {
    color: #d32f2f;
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Dashboard */
.dashboard-container {
    width: 100%;
    max-width: 1200px;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-bottom: 2rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.btn-secondary {
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.dashboard-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    flex: 1;
}

.card {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.card h3 {
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    font-weight: 500;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.drop-zone {
    border: 2px dashed #ddd;
    border-radius: 1rem;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.drop-zone:hover {
    border-color: var(--primary-color);
    background-color: rgba(46, 125, 50, 0.05);
}

.drop-zone i {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.resources-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.resource-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 0.5rem;
    border-left: 4px solid var(--primary-color);
}

.resource-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.resource-name {
    font-weight: 500;
    color: var(--text-color);
}

.resource-type {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
}

.delete-btn {
    background: none;
    border: none;
    color: #d32f2f;
    cursor: pointer;
    padding: 0.5rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.delete-btn:hover {
    opacity: 1;
}

@media (max-width: 900px) {
    .dashboard-content {
        grid-template-columns: 1fr;
    }
}
/* Voice Input Active State */
.icon-btn.listening {
    color: #d32f2f;
    animation: pulse 1.5s infinite;
    background-color: rgba(211, 47, 47, 0.1);
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.4);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(211, 47, 47, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0);
    }
}
