/**
 * AI Copilot Styles - Natural Language Farm Search Interface
 * Inspired by modern AI chat interfaces with agricultural theme
 */

.ai-copilot-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #f8fffe 0%, #e8f5e8 100%);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(46, 125, 50, 0.1);
    position: relative;
    overflow: hidden;
}

.ai-copilot-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #2e7d32, #4caf50, #8bc34a);
    border-radius: 20px 20px 0 0;
}

/* Header Section */
.ai-copilot-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.ai-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.ai-avatar-circle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.3);
    animation: aiPulse 2s ease-in-out infinite;
}

@keyframes aiPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.ai-status {
    background: rgba(76, 175, 80, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    color: #2e7d32;
    font-weight: 600;
    font-size: 14px;
    border: 2px solid rgba(76, 175, 80, 0.2);
    transition: all 0.3s ease;
}

.ai-copilot-header h2 {
    margin: 0;
    color: #2e7d32;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
}

.ai-copilot-header p {
    margin: 0;
    color: #5d7e5f;
    font-size: 18px;
    font-weight: 500;
}

/* Search Section */
.ai-search-section {
    background: white;
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(76, 175, 80, 0.1);
}

.search-input-container {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: stretch;
}

.ai-search-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid #e8f5e8;
    border-radius: 12px;
    font-size: 16px;
    color: #333;
    background: #fafffe;
    transition: all 0.3s ease;
    outline: none;
    font-family: inherit;
}

.ai-search-input:focus {
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
    background: white;
}

.ai-search-input::placeholder {
    color: #9e9e9e;
    font-style: italic;
}

.voice-search-btn {
    width: 52px;
    height: 52px;
    border: none;
    background: linear-gradient(135deg, #ff7043, #ff5722);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3);
}

.voice-search-btn:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 87, 34, 0.4);
}

.voice-search-btn.disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.search-btn {
    padding: 16px 24px;
    border: none;
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: 600;
    min-width: 120px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.search-btn.loading {
    background: #666;
    cursor: not-allowed;
}

.search-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Sample Queries */
.sample-queries h4 {
    margin: 0 0 15px 0;
    color: #2e7d32;
    font-size: 16px;
    font-weight: 600;
}

.sample-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sample-query-btn {
    padding: 10px 16px;
    border: 2px solid #e8f5e8;
    background: white;
    color: #4caf50;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.sample-query-btn:hover {
    border-color: #4caf50;
    background: #f1f8e9;
    transform: translateY(-1px);
}

/* Chat Container */
.ai-chat-container {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(76, 175, 80, 0.1);
}

.user-message, .ai-message {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-start;
    gap: 12px;
}

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
}

.ai-message .message-avatar {
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: white;
}

.message-content {
    background: #f8fffe;
    padding: 15px 18px;
    border-radius: 16px;
    flex: 1;
    position: relative;
    border: 1px solid rgba(76, 175, 80, 0.1);
}

.user-message .message-content {
    background: #e3f2fd;
    border-color: rgba(33, 150, 243, 0.1);
}

.message-content p {
    margin: 0 0 10px 0;
    color: #333;
    line-height: 1.6;
}

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

.message-time {
    font-size: 12px;
    color: #999;
    display: block;
    margin-top: 8px;
}

.message-summary {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(76, 175, 80, 0.2);
}

.summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.stat-value {
    font-size: 16px;
    color: #2e7d32;
    font-weight: 700;
}

/* Results Section */
.ai-results-section {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(76, 175, 80, 0.1);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e8f5e8;
}

.results-header h3 {
    margin: 0;
    color: #2e7d32;
    font-size: 24px;
    font-weight: 700;
}

.view-globe-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 3px 12px rgba(25, 118, 210, 0.3);
}

.view-globe-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(25, 118, 210, 0.4);
}

/* Result Cards */
.result-card {
    background: #fafffe;
    border: 2px solid #e8f5e8;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.result-card:hover {
    border-color: #4caf50;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.1);
    transform: translateY(-2px);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.result-header h4 {
    margin: 0;
    color: #2e7d32;
    font-size: 20px;
    font-weight: 700;
}

.result-price {
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.result-details {
    margin-bottom: 15px;
}

.result-location {
    color: #666;
    font-size: 16px;
    margin-bottom: 12px;
    font-weight: 500;
}

.result-specs {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.spec {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.result-features {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.feature {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: #2e7d32;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.result-btn {
    padding: 10px 16px;
    border: 2px solid #4caf50;
    background: white;
    color: #4caf50;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
}

.result-btn:hover {
    background: #4caf50;
    color: white;
    transform: translateY(-1px);
}

.results-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e8f5e8;
}

.export-btn, .compare-btn, .roi-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
}

.export-btn {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    box-shadow: 0 3px 12px rgba(255, 152, 0, 0.3);
}

.compare-btn {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
    color: white;
    box-shadow: 0 3px 12px rgba(156, 39, 176, 0.3);
}

.roi-btn {
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: white;
    box-shadow: 0 3px 12px rgba(76, 175, 80, 0.3);
}

.export-btn:hover, .compare-btn:hover, .roi-btn:hover {
    transform: translateY(-1px);
}

/* Voice Listening Indicator */
.voice-listening-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 2px solid #ff5722;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.voice-animation {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.voice-circle {
    width: 12px;
    height: 12px;
    background: #ff5722;
    border-radius: 50%;
    animation: voiceWave 1.4s ease-in-out infinite both;
}

.voice-circle:nth-child(2) {
    animation-delay: 0.2s;
}

.voice-circle:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes voiceWave {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.voice-listening-indicator p {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

#stopListeningBtn {
    padding: 12px 24px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

#stopListeningBtn:hover {
    background: #d32f2f;
    transform: translateY(-1px);
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 20px;
}

.welcome-message .ai-message {
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-copilot-container {
        padding: 15px;
        margin: 10px;
    }

    .search-input-container {
        flex-direction: column;
    }

    .voice-search-btn {
        align-self: flex-end;
        width: 100%;
    }

    .results-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .result-specs, .result-features, .result-actions, .results-actions {
        flex-direction: column;
        gap: 8px;
    }

    .sample-buttons {
        flex-direction: column;
    }

    .message-summary {
        flex-direction: column;
        gap: 10px;
    }
}

/* Smooth scrolling */
.ai-chat-container {
    scroll-behavior: smooth;
}

/* Loading animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card {
    animation: fadeInUp 0.5s ease-out forwards;
}

.result-card:nth-child(2) { animation-delay: 0.1s; }
.result-card:nth-child(3) { animation-delay: 0.2s; }
.result-card:nth-child(4) { animation-delay: 0.3s; }