/* Global Styles */
:root {
    --primary-color: #4CAF50;
    --primary-gradient: linear-gradient(135deg, #4CAF50, #2E7D32);
    --secondary-color: #388E3C;
    --accent-color: #8BC34A;
    --accent-light: #c8e6c9;
    --error-color: #f44336;
    --text-color: #333;
    --text-secondary: #666;
    --light-bg: #f9f9f9;
    --white: #ffffff;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 15px 35px rgba(0, 0, 0, 0.12);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --chat-bg: #f0f8ff;
    --bot-message-bg: #e8f5e9;
    --user-message-bg: #e3f2fd;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-bg);
    background-image: linear-gradient(135deg, #f9f9f9 0%, #f0f4f0 100%);
    min-height: 100vh;
}

.container {
    max-width: 800px !important; /* Limit maximum width for better readability */
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Watermark */
.container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../logo.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 60% auto;
    transform: rotate(-25deg);
    opacity: 0.04;
    z-index: -1;
    pointer-events: none;
}

/* Top Section Layout */
.top-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
    min-height: 90px; /* Ensure enough space for logo */
    flex-direction: row !important; /* Force horizontal layout in all languages */
}

/* Logo positioning - better responsive design */
.logo-container {
    display: flex;
    align-items: center;
    position: relative; /* Changed from absolute to relative */
    left: auto; /* Remove absolute positioning */
    transform: none; /* Remove transform */
    z-index: 2;
}

.logo-container a {
    display: block;
    text-decoration: none;
    cursor: pointer;
}

.app-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: var(--white);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    padding: 3px;
    overflow: hidden;
    transition: var(--transition);
}

.app-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: var(--transition);
}

.app-logo:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Adjust language selector for logo centering */
.language-selector {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    width: auto; /* Changed from 100% to auto */
}

.lang-btn {
    padding: 10px 15px;
    background-color: var(--white);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.lang-btn:hover {
    background-color: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.lang-btn.active {
    background: var(--primary-gradient);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.25);
}

/* RTL Support for Persian */
[lang="fa"] {
    direction: rtl;
    text-align: right;
    font-family: 'Tahoma', 'Segoe UI', Geneva, Verdana, sans-serif;
}

/* RTL Support for Persian */
[lang="fa"] .language-selector {
    justify-content: flex-start;
}

[lang="fa"] .top-section {
    flex-direction: row-reverse !important;
}

/* Header adjusted for centered logo */
header {
    text-align: center;
    margin-bottom: 60px;
    margin-top: 20px;
    padding: 30px 20px;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--primary-gradient);
}

header h1 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

header p {
    font-size: 1.3rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
}

header h1 i {
    margin-right: 10px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.header-decoration {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
}

.header-decoration span {
    display: block;
    width: 50px;
    height: 5px;
    border-radius: 3px;
}

.header-decoration span:nth-child(1) {
    background-color: #c8e6c9;
}

.header-decoration span:nth-child(2) {
    background-color: var(--accent-color);
    width: 80px;
}

.header-decoration span:nth-child(3) {
    background-color: var(--primary-color);
}

/* Upload Area Styles - Better responsive behavior */
.upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 50px;
}

.upload-area {
    width: 100%;
    max-width: 600px;
    min-height: 280px; /* Min height instead of fixed height */
    height: auto; /* Allow content to determine height */
    border: 2px dashed var(--accent-color);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--white);
    cursor: pointer;
    transition: var(--transition);
    padding: 25px 20px;
    text-align: center;
    box-shadow: var(--shadow);
    box-sizing: border-box;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(76, 175, 80, 0.05);
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.upload-area i {
    font-size: 4.5rem;
    color: var(--accent-color);
    margin-bottom: 20px;
    transition: var(--transition);
}

.upload-area:hover i {
    color: var(--primary-color);
    transform: scale(1.05);
}

.upload-area p {
    margin: 8px 0;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.upload-btn {
    background: var(--primary-gradient);
    color: white;
    padding: 12px 25px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: bold;
    margin-top: 18px;
    margin-bottom: 5px; /* Add bottom margin */
    transition: var(--transition);
    border: none;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    font-size: 1rem;
}

.upload-btn:hover {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(76, 175, 80, 0.4);
}

/* Preview Container */
.preview-container {
    width: 100%;
    max-width: 600px;
    margin-top: 25px;
    display: none;
    flex-direction: column;
    align-items: center;
    background-color: var(--white);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

.preview-header span {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.close-preview {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 1.2rem;
    transition: var(--transition);
}

.close-preview:hover {
    color: var(--error-color);
    transform: scale(1.1);
}

.preview-image-wrapper {
    width: 100%;
    max-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: calc(var(--border-radius) - 4px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
}

#preview-image {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    transition: var(--transition);
}

#analyze-btn {
    margin-top: 5px;
    padding: 14px 28px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

#analyze-btn:hover {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(76, 175, 80, 0.4);
}

#analyze-btn i {
    font-size: 1.1rem;
}

/* Results Area */
.results-container {
    display: none;
    margin-top: 30px;
}

.results {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    padding: 30px;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-top: 30px;
    transition: var(--transition);
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(76, 175, 80, 0.2);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 25px;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.15);
}

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

.result-section {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.result-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.health-status {
    text-align: center;
    width: 100%;
    max-width: 100%;
    padding: 15px 0;
}

.health-status h2, 
.diseases h2, 
.similar-images h2,
.chat-container h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.6rem;
    text-align: center;
    width: 100%;
    position: relative;
    padding-bottom: 10px;
}

.health-status h2:after, 
.diseases h2:after, 
.similar-images h2:after,
.chat-container h2:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 3px;
}

.health-indicator {
    display: inline-block;
    font-size: 1.3rem;
    font-weight: bold;
    padding: 12px 25px;
    border-radius: 30px;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.healthy {
    background-color: #c8e6c9;
    color: #2e7d32;
}

.unhealthy {
    background-color: #ffcdd2;
    color: #c62828;
}

.diseases, 
.similar-images {
    width: 100%;
    max-width: 100%;
    padding: 15px 0;
}

.diseases h2, .similar-images h2 {
    margin-bottom: 25px;
    color: var(--primary-color);
    font-size: 1.8rem;
}

.disease-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--light-bg);
    border-radius: var(--border-radius-sm);
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.disease-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[lang="fa"] .disease-item {
    flex-direction: row-reverse;
}

.disease-name {
    font-weight: bold;
    color: var(--text-color);
}

.disease-probability {
    background-color: var(--accent-light);
    color: var(--secondary-color);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.similar-images {
    width: 100%;
}

/* Ensure similar-images grid works well in vertical layout */
.similar-images-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
    gap: 15px !important;
    width: 100% !important;
}

@media screen and (max-width: 768px) {
    .similar-images-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    }
}

@media screen and (max-width: 480px) {
    .similar-images-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    }
}

.similar-image-item {
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.similar-image-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.similar-image-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: var(--transition);
}

.similar-image-item:hover img {
    transform: scale(1.05);
}

.chat-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 25px;
    background-color: var(--chat-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    position: relative;
}

.chat-container h2 {
    color: var(--primary-color);
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.8rem;
    position: relative;
}

.chat-container h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 3px;
}

.chat-messages {
    height: 300px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 15px;
    width: 100%;
    background-color: var(--white);
    border-radius: var(--border-radius-sm);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--light-bg);
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 10px;
}

.chat-message {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-start;
}

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

[lang="fa"] .chat-message.user {
    flex-direction: row-reverse;
}

[lang="fa"] .chat-message.bot {
    flex-direction: row;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--accent-light);
    color: var(--secondary-color);
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.chat-avatar i {
    font-size: 1.2rem;
}

.chat-message.user .chat-avatar {
    margin-right: 0;
    margin-left: 12px;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #1976D2;
}

.message-content {
    background-color: var(--bot-message-bg);
    padding: 12px 18px;
    border-radius: 18px;
    border-top-left-radius: 4px;
    max-width: 80%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chat-message.user .message-content {
    background-color: var(--user-message-bg);
    border-top-left-radius: 18px;
    border-top-right-radius: 4px;
}

.chat-input-container {
    display: flex;
    margin-top: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius-sm);
}

.chat-input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
    font-size: 1rem;
    background-color: var(--white);
    transition: var(--transition);
    outline: none;
}

.chat-input:focus {
    box-shadow: inset 0 0 0 2px var(--accent-color);
}

.send-btn {
    padding: 0 20px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn i {
    font-size: 1.2rem;
}

.send-btn:hover {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
}

footer {
    text-align: center;
    margin-top: 60px;
    padding: 25px 0;
    color: var(--text-secondary);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 3px;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

#reset-btn {
    display: block;
    margin: 30px auto 10px;
    padding: 12px 25px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2);
}

#reset-btn:hover {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(76, 175, 80, 0.3);
}

/* Completely revised responsive design */
@media screen and (max-width: 768px) {
    /* Top section corrections for better mobile alignment */
    .top-section {
        flex-direction: row !important; /* Keep horizontal layout on mobile */
        min-height: 80px;
        margin-bottom: 40px;
        gap: 20px;
        flex-wrap: wrap; /* Allow wrapping on very small screens */
        justify-content: space-between;
    }
    
    .logo-container {
        position: relative;
        left: auto;
        transform: none;
        display: flex;
        justify-content: flex-start; /* Changed from center to flex-start */
        width: auto; /* Changed from 100% to auto */
    }
    
    .app-logo {
        width: 60px;
        height: 60px;
    }
    
    .language-selector {
        width: auto;
        justify-content: flex-end;
    }
    
    /* RTL specific mobile adjustments */
    [lang="fa"] .top-section {
        flex-direction: row-reverse !important;
    }
    
    /* Header adjustments */
    header {
        margin-bottom: 30px;
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .header-decoration span {
        width: 30px;
    }
    
    .header-decoration span:nth-child(2) {
        width: 50px;
    }
    
    /* Upload area */
    .upload-area {
        min-height: 200px;
        padding: 15px;
    }
    
    .upload-area i {
        font-size: 2.8rem;
    }
    
    /* Results area - vertical layout */
    .results {
        padding: 20px !important;
    }
    
    /* Make all sections full width and stack them */
    .health-status, .diseases, .similar-images, .chat-container {
        width: 100%;
        margin-bottom: 25px;
    }
    
    /* Diseases list corrections */
    .diseases-list li {
        padding: 10px;
    }
    
    /* Similar images grid adjustment */
    .similar-images-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Chat container adjustments */
    .chat-container {
        padding: 15px;
        margin-top: 20px;
    }
    
    .chat-messages {
        max-height: 300px;
        padding: 15px;
    }
    
    .chat-input-container {
        margin-top: 15px;
    }
    
    .message-content {
        max-width: 85%;
        padding: 10px 15px;
    }
    
    .chat-container h2 {
        font-size: 1.5rem;
    }
    
    /* Feedback form */
    .chat-feedback {
        padding: 10px;
    }
    
    .chat-feedback-options {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
}

/* Even smaller screens */
@media screen and (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .top-section {
        flex-direction: row !important;
        justify-content: space-between;
        min-height: 70px;
        gap: 10px;
        margin-bottom: 30px;
    }
    
    .logo-container {
        position: relative;
        width: auto;
        justify-content: flex-start;
    }
    
    /* Further reduced elements */
    .app-logo {
        width: 50px;
        height: 50px;
    }
    
    .language-selector {
        gap: 5px;
        width: auto;
        justify-content: flex-end;
    }
    
    .lang-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    /* RTL specific small screen adjustments */
    [lang="fa"] .top-section {
        flex-direction: row-reverse !important;
    }
    
    header {
        padding: 15px 10px;
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    header p {
        font-size: 0.9rem;
    }
    
    /* RTL specific small screen adjustments */
    [lang="fa"] .top-section {
        flex-direction: row-reverse !important;
    }
    
    /* Upload area further simplified */
    .upload-area {
        min-height: 180px;
        padding: 12px;
    }
    
    .upload-area i {
        font-size: 2.5rem;
    }
    
    .upload-area p {
        font-size: 0.8rem;
    }
    
    .upload-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    /* Results area even more compact */
    .results {
        padding: 15px !important;
    }
    
    /* Health indicator */
    .health-indicator {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .health-indicator i {
        font-size: 1rem;
    }
    
    /* Similar images grid for tiny screens */
    .similar-images-grid {
        grid-template-columns: repeat(1, 1fr);
    }
    
    /* Diseases list even more compact */
    .diseases-list li {
        padding: 8px;
        margin-bottom: 10px;
    }
    
    .disease-name {
        font-size: 0.9rem;
    }
    
    .disease-probability span {
        font-size: 0.8rem;
    }
    
    .progress {
        height: 6px;
    }
    
    /* Chat elements further reduced */
    .chat-container {
        padding: 12px 8px;
    }
    
    .chat-container h2 {
        font-size: 1.3rem;
    }
    
    .chat-messages {
        max-height: 250px;
        padding: 10px;
    }
    
    .chat-avatar {
        width: 28px;
        height: 28px;
    }
    
    .chat-avatar i {
        font-size: 0.8rem;
    }
    
    .message-content {
        padding: 8px 10px;
        max-width: 90%;
    }
    
    .message-content p {
        font-size: 0.8rem;
    }
    
    .chat-input {
        padding: 8px;
        font-size: 0.8rem;
    }
    
    .send-btn {
        padding: 0 12px;
    }
    
    .send-btn i {
        font-size: 0.9rem;
    }
    
    /* Feedback elements for tiny screens */
    .chat-feedback-btn {
        padding: 3px 8px;
        font-size: 0.7rem;
    }
    
    .chat-feedback-question {
        font-size: 0.8rem;
    }
    
    .chat-feedback-submit {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
}

/* Loading dots animation for chatbot */
.loading-dots {
    display: flex;
    justify-content: flex-start;
    padding: 8px 0;
}

.loading-dots span {
    height: 8px;
    width: 8px;
    border-radius: 50%;
    background-color: #4CAF50;
    margin-right: 6px;
    animation: bounce 1.2s infinite ease-in-out;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Chatbot feedback buttons */
.chat-feedback {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    padding: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.chat-feedback-question {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #555;
}

.chat-feedback-options {
    display: flex;
    gap: 10px;
}

.chat-feedback-btn {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-feedback-btn:hover {
    background-color: #e0e0e0;
}

.chat-feedback-btn.selected {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.chat-feedback-submit {
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    margin-top: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s ease;
}

.chat-feedback-submit:hover {
    background-color: #1976D2;
}

.chat-feedback-comment {
    margin-top: 8px;
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.8rem;
    resize: none;
}

/* Disease display improvements */
.diseases-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.diseases-list li {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 8px;
    background-color: #f9f9f9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.disease-name {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.disease-probability {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.progress {
    flex-grow: 1;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    margin-right: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #4CAF50;
    border-radius: 4px;
}

.disease-image {
    margin-top: 8px;
    border-radius: 6px;
    overflow: hidden;
}

.disease-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Similar plant images improvements */
.similar-plant {
    margin-top: 15px;
}

.similar-plant h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.similar-images-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.similar-image {
    border-radius: 6px;
    overflow: hidden;
}

.similar-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Health indicator improvements */
.health-indicator {
    display: flex;
    align-items: center;
        padding: 10px 15px;
    border-radius: 8px;
    font-weight: 500;
    }
    
.health-indicator.healthy {
    background-color: rgba(76, 175, 80, 0.15);
    color: #2e7d32;
}

.health-indicator.unhealthy {
    background-color: rgba(244, 67, 54, 0.15);
    color: #c62828;
}

.health-indicator.error {
    background-color: rgba(33, 33, 33, 0.15);
    color: #333;
}

.health-indicator i {
    margin-right: 8px;
    font-size: 1.2rem;
}

/* Chat message system style - for feedback thank you message */
.chat-message.system .message-content {
    background-color: #f0f0f0;
    border: 1px solid #e0e0e0;
    color: #555;
    text-align: center;
    margin: 0 auto;
    max-width: 80%;
}

/* Responsive adjustments */
@media screen and (max-width: 1024px) {
    .similar-images-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .similar-images-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .results {
        padding: 20px !important;
    }
    
    .result-section {
        margin-bottom: 25px !important;
        padding-bottom: 25px !important;
    }
}

@media screen and (max-width: 480px) {
    .similar-images-grid {
        grid-template-columns: repeat(1, 1fr);
    }
    
    .results {
        padding: 15px !important;
    }
    
    .result-section {
        margin-bottom: 20px !important;
        padding-bottom: 20px !important;
    }
}

/* Ensure proper padding across all sections */
.health-status h2, 
.diseases h2, 
.similar-images h2,
.chat-container h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.6rem;
    }
    
/* Make RTL layout work properly with vertical design */
[lang="fa"] .results {
    flex-direction: column;
}

[lang="fa"] .result-section {
    width: 100%;
}

/* Vertical layout classes */
.vertical-layout {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    align-items: center;
}

.full-width {
    width: 100% !important;
    max-width: 100% !important;
}

/* Make sure results container is full width */
.results-container {
    width: 100% !important;
    max-width: 100% !important;
}

/* Improve readability and spacing */
.result-section {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 30px !important;
    padding-bottom: 30px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    }
    
.result-section:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
}

/* Make sure all sections have proper padding */
.results {
    padding: 30px !important;
}

@media screen and (max-width: 768px) {
    .results {
        padding: 20px !important;
    }
    
    .result-section {
        margin-bottom: 25px !important;
        padding-bottom: 25px !important;
    }
}

@media screen and (max-width: 480px) {
    .results {
        padding: 15px !important;
    }
    
    .result-section {
        margin-bottom: 20px !important;
        padding-bottom: 20px !important;
    }
}

/* Final critical overrides */

/* Force vertical layout - super important! */
body .results {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
}

/* Force full width for all result sections */
body .result-section {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
}

/* Force proper container dimensions */
body .container {
    max-width: 800px !important;
    margin: 0 auto !important;
}

/* Force full width for all content containers */
body .diseases-list,
body #diseases-list,
body .similar-images-grid,
body #similar-images-container,
body .chat-container,
body #chat-container {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
}

/* Clean fixed image grid */
body .similar-images-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    }

@media screen and (max-width: 480px) {
    body .similar-images-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
    }
}

/* Make sure all sections have proper width and spacing */
.health-status, 
.diseases, 
.similar-images, 
.chat-container {
    width: 100%;
    max-width: 100%;
}

/* Add styles for the disease images section */
.disease-images-section {
    margin-top: 20px;
    width: 100%;
}

.disease-images-section h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.disease-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.disease-image-card {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    background-color: var(--card-bg);
    transition: transform 0.2s ease-in-out;
}

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

.disease-image-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.disease-image-caption {
    padding: 10px;
    font-size: 0.9rem;
    color: var(--text-color);
    text-align: center;
    word-break: break-word;
}

/* Make RTL language adjustments */
[lang="fa"] .disease-image-caption {
    direction: rtl;
} 