/* FRED Mobile-First Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #E8F5E8 0%, #F1F8E9 100%);
    height: 100vh;
    color: #2E7D32;
    line-height: 1.6;
    overflow: hidden;
    margin: 0;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

/* Header */
.fred-header {
    background: linear-gradient(135deg, #2E7D32 0%, #388E3C 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 2rem;
}

.fred-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tractor-icon {
    font-size: 2.5rem;
}

.fred-logo h1 {
    font-size: 2rem;
    font-weight: bold;
    margin: 0;
}

.fred-logo p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0;
}

.farm-name {
    flex: 1;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.95;
}

.header-controls {
    position: relative;
}

/* Main Layout */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Sidebar - 30% */
.sidebar {
    width: 30%;
    min-width: 280px;
    max-width: 400px;
    background: white;
    border-right: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}


.sidebar-nav {
    padding: 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 0.875rem 1rem;
    margin-bottom: 0.25rem;
    border: none;
    border-radius: 8px;
    background: none;
    color: #4B5563;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.nav-item:hover {
    background: #F3F4F6;
    color: #2E7D32;
}

.nav-item.active {
    background: #E8F5E9;
    color: #2E7D32;
    font-weight: 600;
}

.nav-icon {
    font-size: 1.25rem;
    width: 1.5rem;
    text-align: center;
}

.nav-label {
    flex: 1;
}

.nav-divider {
    height: 1px;
    background: #E5E7EB;
    margin: 1rem 0;
}

/* Content Area - 70% */
.content-area {
    flex: 1;
    overflow: hidden;
    background: white;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Recent Answers Content */
.recent-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.recent-header {
    margin-bottom: 2rem;
}

.recent-header h2 {
    color: #2E7D32;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.recent-header p {
    color: #666;
    font-size: 0.95rem;
}

.recent-answers-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.recent-answer-item {
    background: #F8F9FA;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.recent-answer-item:hover {
    background: white;
    border-color: #2E7D32;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.recent-answer-question {
    font-weight: 600;
    color: #2E7D32;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recent-answer-text {
    color: #666;
    line-height: 1.5;
    max-height: 100px;
    overflow: hidden;
    position: relative;
}

.recent-answer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #E5E7EB;
    font-size: 0.85rem;
    color: #999;
}

.recent-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.user-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.user-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* User Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-info {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid #E0E0E0;
}

.user-name {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.user-role {
    display: block;
    font-size: 0.875rem;
    color: #666;
    text-transform: capitalize;
}

.dropdown-divider {
    height: 1px;
    background: #E0E0E0;
    margin: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    color: #333;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.dropdown-item:hover {
    background: #F5F5F5;
    color: #2E7D32;
}

.dropdown-icon {
    width: 1.5rem;
    text-align: center;
}

/* Demo Mode Indicator */
.demo-indicator {
    background: #FF6B6B;
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    animation: pulse 2s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.create-account-btn {
    background: white;
    color: #2E7D32;
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.create-account-btn:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.create-account-btn:active {
    transform: translateY(0);
}

/* Create Account Section in Welcome Message */
.create-account-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.create-account-text {
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: #555;
}

.create-account-btn-main {
    background: #2E7D32;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.create-account-btn-main:hover {
    background: #1B5E20;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.create-account-btn-main:active {
    transform: translateY(0);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.mode-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 20px;
    background: transparent;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background: white;
    color: #2E7D32;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Mode Content */
.mode-content {
    display: none;
    height: 100%;
}

.mode-content.active {
    display: flex;
    flex-direction: column;
}

/* Allow scrolling for teach and expert modes */
#teachMode, #expertMode {
    overflow-y: auto;
}

/* Chat Interface */
.chat-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    padding-bottom: 0;
}

.chat-header {
    padding: 0.5rem 1rem;
    background: #F8F9FA;
    border-bottom: 1px solid #E0E0E0;
    display: flex;
    justify-content: flex-end;
}

.new-conversation-btn {
    background: white;
    border: 1px solid #E0E0E0;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #2E7D32;
    font-weight: 500;
}

.new-conversation-btn:hover {
    background: #E8F5E9;
    border-color: #4CAF50;
    transform: translateY(-1px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    scroll-behavior: smooth;
}

.message {
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-bubble {
    padding: 1rem;
    border-radius: 20px;
    max-width: 85%;
    word-wrap: break-word;
}

.user-message .message-bubble {
    background: #E3F2FD;
    color: #1976D2;
    margin-left: auto;
    margin-right: 0;
}

.fred-message .message-bubble {
    background: #E8F5E8;
    color: #2E7D32;
    border: 1px solid #C8E6C9;
}

.fred-bubble {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.fred-bubble.clarification {
    background: #FFF3E0;
    border: 2px solid #FF9800;
}

.clarification-indicator {
    font-weight: 600;
    color: #F57C00;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.fred-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
}

.message-content p {
    margin-bottom: 0.5rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.confidence-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

.confidence-bar {
    flex: 1;
    height: 4px;
    background: rgba(0,0,0,0.1);
    border-radius: 2px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: #4CAF50;
    transition: width 0.3s ease;
}

/* Feedback Buttons */
.feedback-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    align-items: center;
}

.feedback-btn {
    background: none;
    border: 1px solid #E0E0E0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.feedback-btn:hover:not(:disabled) {
    border-color: #4CAF50;
    transform: scale(1.1);
}

.feedback-btn:disabled {
    cursor: not-allowed;
}

.feedback-thanks {
    font-size: 0.8rem;
    color: #4CAF50;
    margin-left: 0.5rem;
    font-style: italic;
}

/* Chat Input */
.chat-input-container {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.95), white);
    border-top: 3px solid #2E7D32;
    padding: 1.5rem 2rem;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.12);
    z-index: 100;
    backdrop-filter: blur(10px);
}

.input-hint {
    font-size: 0.875rem;
    color: #1B5E20;
    margin-bottom: 0.75rem;
    text-align: center;
    font-weight: 500;
    background: #E8F5E9;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid #A5D6A7;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

#questionInput {
    flex: 1;
    padding: 1rem 1.25rem;
    border: 2px solid #E0E0E0;
    border-radius: 25px;
    resize: none;
    font-family: inherit;
    font-size: 1.1rem;
    max-height: 120px;
    transition: all 0.3s ease;
    background: #FAFAFA;
}

#questionInput:focus {
    outline: none;
    border-color: #2E7D32;
    background: white;
    box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.1);
}

.send-btn {
    background: linear-gradient(135deg, #2E7D32 0%, #388E3C 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 1rem 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.05rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.send-btn:hover {
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}

.send-btn:disabled {
    background: #BDBDBD;
    cursor: not-allowed;
    transform: none;
}

/* Teach FRED Interface */
.teach-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.teach-header {
    text-align: center;
    margin-bottom: 2rem;
}

.teach-header h2 {
    color: #2E7D32;
    margin-bottom: 0.5rem;
}

.quick-topics {
    margin-bottom: 2rem;
}

.topic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.topic-chip {
    background: #E8F5E8;
    border: 1px solid #C8E6C9;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.topic-chip:hover {
    background: #C8E6C9;
    transform: translateY(-1px);
}

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

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2E7D32;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #2E7D32;
}

.teach-btn {
    width: 100%;
    background: #2E7D32;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.teach-btn:hover {
    background: #1B5E20;
    transform: translateY(-2px);
}

.teach-btn:disabled {
    background: #BDBDBD;
    cursor: not-allowed;
    transform: none;
}

.teach-result {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 10px;
    background: #E8F5E8;
    border: 1px solid #C8E6C9;
}

.teach-result.success {
    background: #E8F5E8;
    border-color: #4CAF50;
}

.teach-result.error {
    background: #FFEBEE;
    border-color: #F44336;
    color: #D32F2F;
}

/* File Upload Section */
.file-upload-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #F8F9FA;
    border-radius: 12px;
    border: 1px solid #E0E0E0;
}

.file-upload-section h3 {
    margin-bottom: 0.5rem;
    color: #2E7D32;
}

.upload-area {
    margin-top: 1rem;
    border: 2px dashed #C8E6C9;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
}

.upload-area.drag-over {
    border-color: #4CAF50;
    background: #E8F5E8;
    transform: scale(1.02);
}

.upload-prompt {
    color: #666;
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.browse-btn {
    background: none;
    border: none;
    color: #2E7D32;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
}

.file-list {
    margin-top: 1rem;
    text-align: left;
}

/* Uploaded Documents Section */
.uploaded-docs-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.uploaded-docs-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #2E7D32;
}

.uploaded-docs-list {
    display: grid;
    gap: 0.75rem;
}

.uploaded-doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.uploaded-doc-item:hover {
    border-color: #2E7D32;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.doc-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.doc-icon {
    font-size: 1.5rem;
}

.doc-details {
    display: flex;
    flex-direction: column;
}

.doc-name {
    font-weight: 600;
    color: #333;
}

.doc-meta {
    font-size: 0.875rem;
    color: #666;
}

.doc-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.status-processed {
    color: #2E7D32;
}

.status-processing {
    color: #FF9800;
}

.status-error {
    color: #f44336;
}
.doc-knowledge {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.25rem;
}
.doc-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.delete-doc-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}
.delete-doc-btn:hover {
    background: #d32f2f;
    transform: translateY(-1px);
}
.document-type-selection {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 8px;
}
.radio-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}
.radio-label:hover {
    border-color: #2E7D32;
}
.radio-label input[type="radio"] {
    margin-right: 0.5rem;
}
.radio-label input[type="radio"]:checked + .radio-text {
    color: #2E7D32;
    font-weight: 600;
}
.radio-label input[type="radio"]:checked ~ small {
    color: #2E7D32;
}
.radio-text {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}
.radio-label small {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
}
.reference-doc {
    background: #fff8e1;
    border-color: #ffc107;
}
.reference-badge {
    background: #ffc107;
    color: #000;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #E8F5E8;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-name {
    font-weight: 500;
    color: #2E7D32;
}

.file-size {
    font-size: 0.8rem;
    color: #666;
}

.remove-file-btn {
    background: none;
    border: none;
    color: #F44336;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
}

.upload-files-btn {
    width: 100%;
    background: #2E7D32;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.upload-files-btn:hover {
    background: #1B5E20;
    transform: translateY(-2px);
}

.divider {
    text-align: center;
    color: #999;
    margin: 2rem 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background: #E0E0E0;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

/* Expert Help Interface */
.expert-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.expert-header {
    text-align: center;
    margin-bottom: 2rem;
}

.expert-header h2 {
    color: #2E7D32;
    margin-bottom: 0.5rem;
}

.expert-queue {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.expert-question {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    border-left: 4px solid #FF9800;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.expert-question.answered {
    border-left-color: #4CAF50;
    opacity: 0.7;
}

.expert-question.unhelpful {
    border-left-color: #F44336;
    background: #FFF3E0;
}

.unhelpful-badge {
    background: #F44336;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.question-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.question-text {
    font-weight: 500;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #2E7D32;
}

.question-meta {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.fred-attempt {
    background: #F5F5F5;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.fred-attempt .label {
    font-weight: 500;
    color: #666;
    margin-bottom: 0.5rem;
}

.expert-answer-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.expert-answer-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
}

.expert-answer-input:focus {
    outline: none;
    border-color: #2E7D32;
}

.expert-answer-buttons {
    display: flex;
    gap: 1rem;
}

.expert-submit-btn {
    background: #2E7D32;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.expert-submit-btn:hover {
    background: #1B5E20;
    transform: translateY(-1px);
}

.expert-skip-btn {
    background: #BDBDBD;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.expert-skip-btn:hover {
    background: #9E9E9E;
}

.expert-dismiss-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 5px;
}

.expert-dismiss-btn:hover {
    background: #c82333;
}

.expert-answer-display {
    background: #E8F5E8;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid #C8E6C9;
}

.expert-answer-display .label {
    font-weight: 500;
    color: #2E7D32;
    margin-bottom: 0.5rem;
}

/* Sidebar Sections */
.sidebar-section {
    padding: 1rem;
    border-top: 1px solid #E0E0E0;
    max-height: 200px;
    overflow-y: auto;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

/* Compact Activity List for Sidebar */
.activity-list.compact .activity-item {
    background: white;
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    border: 1px solid #E0E0E0;
    font-size: 0.75rem;
}

.activity-list.compact .question {
    font-weight: 500;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.activity-list.compact .answer {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.activity-list.compact .meta {
    display: none;
}

.recent-activity h3 {
    margin-bottom: 1rem;
    color: #2E7D32;
}

.activity-item {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid #2E7D32;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.activity-item:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    transform: translateX(2px);
}

.activity-item .question {
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: #1976D2;
    line-height: 1.2;
    font-size: 0.85rem;
}

.activity-item .question::before {
    content: "Q: ";
    font-weight: 700;
    color: #666;
}

.activity-item .answer {
    font-size: 0.82rem;
    color: #333;
    background: #F0F7F0;
    padding: 0.4rem 0.6rem;
    border-radius: 5px;
    line-height: 1.3;
    border-left: 3px solid #4CAF50;
}

.activity-item .answer::before {
    content: "A: ";
    font-weight: 700;
    color: #2E7D32;
}

.activity-item .meta {
    font-size: 0.75rem;
    color: #999;
    font-style: italic;
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E0E0E0;
    border-top: 4px solid #2E7D32;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Authentication & User Management */
#loginModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

#loginModal.active {
    display: flex !important;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.login-container {
    text-align: center;
}

.login-header {
    margin-bottom: 2rem;
}

.login-header .tractor-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.login-header h2 {
    color: #2E7D32;
    margin-bottom: 0.5rem;
}

.login-step {
    display: none;
}

.login-step.active {
    display: block;
}

/* Login Method Toggle */
.login-method-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.login-tab {
    flex: 1;
    padding: 0.75rem;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.login-tab.active {
    background: #2E7D32;
    color: white;
    border-color: #2E7D32;
}

.login-tab:hover:not(.active) {
    background: #e8e8e8;
}

.login-hint {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #666;
    text-align: center;
}

.login-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    text-align: center;
    transition: border-color 0.3s ease;
}

.login-input:focus {
    outline: none;
    border-color: #2E7D32;
}

.login-btn {
    width: 100%;
    background: #2E7D32;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.login-btn:hover {
    background: #1B5E20;
    transform: translateY(-2px);
}

.login-btn:disabled {
    background: #BDBDBD;
    cursor: not-allowed;
    transform: none;
}

.login-btn-secondary {
    width: 100%;
    background: transparent;
    color: #666;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn-secondary:hover {
    border-color: #2E7D32;
    color: #2E7D32;
}

.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.login-error {
    background: #FFEBEE;
    border: 1px solid #F44336;
    color: #D32F2F;
    padding: 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    text-align: center;
}

.user-container {
    max-width: 500px;
}

.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: #F5F5F5;
}

.user-info {
    background: #F8F9FA;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
}

.user-info h3 {
    margin-bottom: 1rem;
    color: #2E7D32;
}

.logout-btn {
    background: #F44336;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 1rem;
}

.logout-btn:hover {
    background: #D32F2F;
}

.admin-section {
    border-top: 1px solid #E0E0E0;
    padding-top: 2rem;
}

.user-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.user-form input,
.user-form select {
    padding: 0.75rem;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    font-size: 1rem;
}

.user-form input:focus,
.user-form select:focus {
    outline: none;
    border-color: #2E7D32;
}

.create-user-btn {
    background: #2E7D32;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.create-user-btn:hover {
    background: #1B5E20;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-item {
    background: white;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.user-item:hover {
    border-color: #2E7D32;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sm:hover {
    background: #F5F5F5;
}

.btn-danger {
    color: #D32F2F;
    border-color: #ffcdd2;
}

.btn-danger:hover {
    background: #ffebee;
    border-color: #ef5350;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.user-meta {
    font-size: 0.9rem;
    color: #666;
}

.role-badge {
    background: #E3F2FD;
    color: #1976D2;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.role-badge.manager {
    background: #E8F5E8;
    color: #2E7D32;
}

.role-badge.expert {
    background: #FFF3E0;
    color: #F57C00;
}

/* Utility Classes */
.hidden {
    display: none;
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Hide sidebar on mobile by default */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 60px;
        bottom: 0;
        width: 80%;
        max-width: 300px;
        z-index: 999;
        transition: left 0.3s ease;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    /* Full width content on mobile */
    .content-area {
        width: 100%;
    }
    
    .fred-logo {
        gap: 0.5rem;
    }
    
    .tractor-icon {
        font-size: 2rem;
    }
    
    .fred-logo h1 {
        font-size: 1.5rem;
    }
    
    .input-wrapper {
        gap: 0.25rem;
    }
    
    .send-btn {
        padding: 0.75rem;
    }
    
    .send-btn span {
        display: none;
    }
    
    .topic-chips {
        gap: 0.25rem;
    }
    
    .topic-chip {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

/* PWA and iOS Safari optimizations */
@media (display-mode: standalone) {
    .fred-header {
        padding-top: env(safe-area-inset-top, 1rem);
    }
}

/* Auto-resize textarea */
.auto-resize {
    min-height: 20px;
    resize: none;
    overflow: hidden;
}

/* User Management Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex !important;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 10px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    margin-top: 40px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    color: #2E7D32;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.users-section {
    margin-bottom: 30px;
}

.users-section h4 {
    margin: 0 0 15px 0;
    color: #333;
}

.users-list {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

.user-item:last-child {
    border-bottom: none;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: bold;
    color: #333;
}

.user-details {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

.user-role {
    background: #4CAF50;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    text-transform: uppercase;
}

.user-role.manager {
    background: #2196F3;
}

.user-role.expert {
    background: #FF9800;
}

.user-role.admin {
    background: #9C27B0;
}

.add-user-section {
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
}

.add-user-section h4 {
    margin: 0 0 15px 0;
    color: #333;
}

.add-user-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.form-group small {
    color: #666;
    font-size: 12px;
    margin-top: 3px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

@media (max-width: 768px) {
    .modal-content {
        margin: 10px;
        margin-top: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .user-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}


/* Farm and Expert Styles */
.farm-header {
    background: #F8F9FA;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 10px;
    font-weight: 600;
    color: #2E7D32;
    text-align: center;
    font-size: 1.1rem;
}

.expert-badge {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 1rem;
    vertical-align: middle;
    animation: pulse 2s infinite;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.expert-toggle-btn {
    background: #F8F9FA;
    border: 1px solid #E0E0E0;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.expert-toggle-btn:hover {
    background: #E8F5E9;
    border-color: #4CAF50;
}

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

/* Permissions Grid Styles */
.permissions-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #E0E0E0;
}

.permissions-section h4 {
    margin-bottom: 1rem;
    color: #2E7D32;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.8rem;
}

.permission-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: #F8F9FA;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.permission-item:hover {
    background: #E8F5E9;
}

.permission-item input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.permission-item span {
    font-size: 0.9rem;
    color: #333;
    user-select: none;
}

/* User item with permissions display */
.user-permissions {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.permission-badge {
    background: #E8F5E9;
    color: #2E7D32;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Analytics Dashboard Styles */
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.analytics-header h2 {
    margin: 0;
    color: var(--primary-color);
}

.date-range-select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: white;
    font-size: 14px;
}

.analytics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: #666;
}

.analytics-tabs-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.analytics-tabs {
    display: flex;
    gap: 8px;
}

.analytics-tab {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.analytics-tab:hover {
    background: #f0f7f0;
}

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

.analytics-tab-content {
    display: none;
}

.analytics-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.analytics-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.analytics-table thead {
    background: #f5f5f5;
}

.analytics-table th,
.analytics-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.analytics-table th {
    font-weight: 600;
    color: #333;
}

.question-text {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.fred_answered {
    background: #e3f2fd;
    color: #1976d2;
}

.status-badge.expert_answered {
    background: #f3e5f5;
    color: #7b1fa2;
}

.status-badge.needs_expert {
    background: #fff3e0;
    color: #f57c00;
}

.categories-bars {
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.category-bar {
    display: grid;
    grid-template-columns: 120px 1fr 80px;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.category-name {
    font-weight: 500;
}

.category-progress {
    background: #f5f5f5;
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
}

.category-progress-bar {
    background: var(--primary-color);
    height: 100%;
    transition: width 0.5s ease;
}

.category-count {
    text-align: right;
    font-size: 14px;
    color: #666;
}

.no-data {
    text-align: center;
    color: #666;
    padding: 40px;
    background: #f9f9f9;
    border-radius: 8px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Manager-focused Analytics Styles */
.stat-card.primary {
    background: #2E7D32;
    color: white;
}

.stat-card.primary .stat-value {
    color: white;
}

.stat-sublabel {
    font-size: 18px;
    font-weight: normal;
    opacity: 0.9;
}

.time-savings-highlight {
    background: #E8F5E9;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
    text-align: center;
}

.time-savings-highlight p {
    margin: 8px 0;
    font-size: 18px;
    color: #2E7D32;
}

.time-savings-highlight strong {
    font-size: 24px;
    color: #1B5E20;
}

.overview-content h4 {
    margin-top: 32px;
    margin-bottom: 16px;
    color: #333;
}

.trends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.trend-week {
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.week-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.trend-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.trend-stat {
    text-align: center;
}

.trend-value {
    display: block;
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.trend-stat.highlight .trend-value {
    color: #2E7D32;
}

.trend-label {
    display: block;
    font-size: 11px;
    color: #666;
    margin-top: 4px;
}

.success-bar {
    background: #f0f0f0;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.success-bar-fill {
    background: #4CAF50;
    height: 100%;
    transition: width 0.5s ease;
}

.trend-summary {
    background: #F5F5F5;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.trend-summary p {
    margin: 0;
    color: #555;
}

.trend-note {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 16px;
}

/* User Management Grid Styles */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.user-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.user-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.user-card-header {
    background: #f8f9fa;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.user-card-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.user-role-badge {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.user-role-badge.employee {
    background: #e3f2fd;
    color: #1976d2;
}

.user-role-badge.manager,
.user-role-badge.admin {
    background: #f3e5f5;
    color: #7b1fa2;
}

.user-role-badge.vendor {
    background: #fff3e0;
    color: #f57c00;
}

.user-role-badge.expert {
    background: #e8f5e9;
    color: #2e7d32;
}

.user-card-body {
    padding: 20px;
}

.user-detail {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.detail-label {
    width: 100px;
    font-weight: 500;
    color: #666;
    font-size: 14px;
}

.user-detail span:last-child {
    color: #333;
    font-size: 14px;
}

.status-available {
    color: #4CAF50;
    font-weight: 500;
}

.status-unavailable {
    color: #f44336;
    font-weight: 500;
}

.user-permissions-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.user-card-actions {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.user-card-actions .btn {
    padding: 6px 12px;
    font-size: 13px;
}

.error-message {
    text-align: center;
    color: #f44336;
    padding: 40px;
    font-size: 16px;
}

/* Primary button style for Add User */
.btn-primary {
    background: #4CAF50 !important;
    color: white !important;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-primary:hover {
    background: #388E3C !important;
}

/* User card action buttons */
.user-card-actions .btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.user-card-actions .btn:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.user-card-actions .btn-danger {
    background: #f44336;
}

.user-card-actions .btn-danger:hover {
    background: #d32f2f;
}

/* Form styling for user creation */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"],
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Generic button styles to ensure visibility */
.btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    background: #388E3C;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Specific style for Add New User button */
#addNewUserBtn {
    background: #4CAF50 !important;
    color: white !important;
    padding: 10px 20px !important;
}

/* Phone Management Styles */
.phones-list {
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
}

/* Phone management buttons */
.phone-actions button {
    background: #4CAF50 !important;
    color: white !important;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.phone-actions button:hover {
    background: #388E3C !important;
}

.phone-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.phone-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.phone-number {
    font-weight: 500;
    font-size: 16px;
    color: #333;
}

.phone-label {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.add-phone-form {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.add-phone-form h3 {
    margin: 0 0 16px 0;
    color: var(--primary-color);
    font-size: 18px;
}

.add-phone-form .form-group {
    margin-bottom: 16px;
}

.add-phone-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.add-phone-form input[type="tel"],
.add-phone-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.phone-instructions {
    background: #e8f5e9;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.phone-instructions h4 {
    margin: 0 0 12px 0;
    color: var(--primary-color);
}

.phone-instructions ol {
    margin: 0;
    padding-left: 20px;
}

.phone-instructions li {
    margin-bottom: 8px;
}

.phone-instructions ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.phone-instructions strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Farm Profile Styles */
.profile-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Profile Tabs - Enhanced Farm Style */
.profile-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 12px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.profile-tab {
    background: transparent;
    border: 2px solid transparent;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    color: #666;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-tab:hover {
    background: rgba(46, 125, 50, 0.05);
    color: #2E7D32;
    transform: translateY(-1px);
}

.profile-tab.active {
    background: white;
    color: #2E7D32;
    font-weight: 600;
    border-color: #2E7D32;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.15);
}

/* Search Input - Enhanced Farm Style */
.search-input {
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    width: 300px;
    transition: all 0.3s ease;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E") no-repeat 0.75rem center;
    background-size: 20px;
}

.search-input:focus {
    outline: none;
    border-color: #2E7D32;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.search-input::placeholder {
    color: #999;
}

/* Knowledge List - Enhanced Farm Style */
.knowledge-list {
    display: grid;
    gap: 1.25rem;
    max-height: 600px;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.knowledge-item {
    background: white;
    border: 2px solid #e8f5e9;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: start;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.knowledge-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #2E7D32;
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.knowledge-item:hover {
    border-color: #2E7D32;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.15);
    transform: translateY(-2px);
}

.knowledge-item:hover::before {
    transform: scaleY(1);
}

.knowledge-content {
    flex: 1;
}

.knowledge-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.knowledge-text {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.knowledge-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #999;
}

.knowledge-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.knowledge-actions button {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.edit-btn {
    background: #e8f5e9;
    color: #2E7D32;
    border-color: #e8f5e9;
}

.edit-btn:hover {
    background: #2E7D32;
    color: white;
    border-color: #2E7D32;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(46, 125, 50, 0.2);
}

.delete-btn {
    background: #ffebee;
    color: #d32f2f;
    border-color: #ffebee;
}

.delete-btn:hover {
    background: #d32f2f;
    color: white;
    border-color: #d32f2f;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(211, 47, 47, 0.2);
}

.profile-header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeIn 0.5s ease;
}

/* Add animation to profile sections */
.profile-section {
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Empty state styling */
.knowledge-list p, .documents-list p {
    text-align: center;
    color: #666;
    padding: 3rem;
    background: white;
    border-radius: 8px;
    border: 2px dashed #e0e0e0;
}

.profile-header h2 {
    color: #2E7D32;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.profile-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.profile-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border-radius: 12px;
    border: 2px solid #e8f5e9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.section-header h3 {
    margin: 0;
    color: #2E7D32;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.equipment-list, .fields-list, .documents-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Apply knowledge-list styling to documents list too */
.documents-list {
    display: grid;
    gap: 1.25rem;
    max-height: 600px;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.equipment-item, .field-item {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.2s;
}

.equipment-item:hover, .field-item:hover {
    background: #f0f4f8;
    border-color: #4CAF50;
}

.item-info h4 {
    margin: 0 0 0.5rem 0;
    color: #2E7D32;
}

.item-details {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.edit-btn, .delete-btn {
    padding: 0.3rem 0.8rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.edit-btn {
    background: #2196F3;
    color: white;
}

.edit-btn:hover {
    background: #1976D2;
}

.delete-btn {
    background: #f44336;
    color: white;
}

.delete-btn:hover {
    background: #d32f2f;
}

.profile-info {
    background: #fff8e1;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.profile-info p {
    margin: 0.5rem 0;
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
}

/* Farm Profile Button Styles */
.section-header .btn-primary.btn-sm {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 3px 6px rgba(76, 175, 80, 0.3);
    text-transform: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header .btn-primary.btn-sm:hover {
    background: linear-gradient(135deg, #45a049 0%, #388E3C 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(76, 175, 80, 0.4);
}

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

.empty-message {
    text-align: center;
    color: #666;
    padding: 2rem;
    font-style: italic;
}

/* Equipment/Field Modal Styles */
.equipment-modal, .field-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.equipment-modal-content, .field-modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-form h3 {
    margin: 0 0 1.5rem 0;
    color: #2E7D32;
    font-size: 1.5rem;
}

/* Recent Answers Modal Styles - Removed, now using page-based recent answers */
/* .recent-answers-modal {
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
} */

.recent-answers-info {
    background: #E8F5E9;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    color: #2E7D32;
    font-size: 0.9rem;
}

.recent-answers-list {
    max-height: 50vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recent-answer-item {
    background: #F8F9FA;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.recent-answer-item:hover {
    background: white;
    border-color: #2E7D32;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.recent-answer-question {
    font-weight: 600;
    color: #2E7D32;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recent-answer-text {
    color: #666;
    line-height: 1.5;
    max-height: 100px;
    overflow: hidden;
    position: relative;
}

.recent-answer-text.expanded {
    max-height: none;
}

.recent-answer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #999;
}

.expand-btn {
    background: none;
    border: none;
    color: #2E7D32;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #E0E0E0;
}

/* Photo Upload Styles */
.photo-upload-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.photo-select-btn {
    padding: 0.5rem 1rem;
    background: #f0f0f0;
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.photo-select-btn:hover {
    background: #e0e0e0;
    border-color: #999;
}

.photo-filename {
    font-size: 0.9rem;
    color: #666;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.help-text {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.25rem;
    display: block;
}

/* Photo in Chat Messages */
.message-photo {
    margin-top: 1rem;
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
}

.message-photo img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}
/* Clarification UI Styles */
.clarification-message .message-bubble {
    max-width: 600px;
}

.clarification-header {
    margin-bottom: 1rem;
}

.clarification-header p {
    margin: 0.5rem 0;
}

.initial-response {
    font-style: italic;
    color: #666;
    font-size: 0.9rem;
}

.clarification-form {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.clarification-question {
    margin-bottom: 1rem;
}

.clarification-question label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.clarification-input,
.clarification-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
}

.clarification-suggestions {
    margin: 1rem 0;
}

.clarification-suggestions p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.suggestion-btn {
    display: inline-block;
    margin: 0.25rem;
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.suggestion-btn:hover {
    background: #f0f0f0;
    border-color: #bbb;
}

.clarification-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.clarify-btn,
.cancel-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.clarify-btn {
    background: #4CAF50;
    color: white;
}

.clarify-btn:hover {
    background: #45a049;
}

.cancel-btn {
    background: #e0e0e0;
    color: #666;
}

.cancel-btn:hover {
    background: #d0d0d0;
}
