/* نظام الري الذكي - الأنماط الرئيسية */
:root {
    --primary-color: #2d8a3e;
    --primary-dark: #1a5f2a;
    --secondary-color: #3498db;
    --accent-color: #f39c12;
    --success-color: #27ae60;
    --warning-color: #e67e22;
    --danger-color: #e74c3c;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --bg-color: #f8f9fa;
    --white: #ffffff;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    direction: rtl;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    padding: 15px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--white);
    text-decoration: none;
}

.logo img {
    height: 45px;
    width: auto;
}

.logo span {
    font-size: 1.4rem;
    font-weight: 700;
}

.nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 8px;
    transition: var(--transition);
}

.nav a:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Weather Bar */
.weather-bar {
    background: linear-gradient(135deg, var(--secondary-color), #2980b9);
    padding: 10px 0;
    margin-top: 75px;
    color: var(--white);
}

.weather-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.weather-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.weather-item i {
    font-size: 1.2rem;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 120px 0 80px;
    margin-top: 75px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/static/images/pattern.svg') repeat;
    opacity: 0.1;
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-content {
    color: var(--white);
}

.hero-content h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.3;
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.hero-description {
    font-size: 1.1rem;
    margin-bottom: 30px;
    opacity: 0.8;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

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

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: transparent;
    color: var(--white);
    border: 2px solid var(--white);
}

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

.hero-image img {
    max-width: 100%;
    height: auto;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Services Section */
.services {
    padding: 80px 0;
    background: var(--white);
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 15px;
}

.section-header p {
    font-size: 1.1rem;
    color: var(--text-light);
}

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

.service-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 35px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid #eee;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.service-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.service-icon i {
    font-size: 2rem;
    color: var(--white);
}

.service-card h3 {
    font-size: 1.3rem;
    margin-bottom: 12px;
    color: var(--primary-dark);
}

.service-card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Plants Section */
.plants-section {
    padding: 80px 0;
    background: var(--bg-color);
}

.plants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.plant-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.plant-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.plant-image {
    height: 180px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
}

.plant-image i {
    font-size: 4rem;
    color: var(--white);
}

.plant-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.plant-info {
    padding: 20px;
}

.plant-info h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--primary-dark);
}

.plant-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.plant-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.plant-meta i {
    color: var(--primary-color);
}

/* Farms Section */
.farms-section {
    padding: 80px 0;
    background: var(--white);
}

.farm-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid #eee;
    transition: var(--transition);
}

.farm-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-hover);
}

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

.farm-header h3 {
    font-size: 1.3rem;
    color: var(--primary-dark);
}

.farm-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.farm-status.active {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success-color);
}

.farm-status.inactive {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
}

.farm-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.farm-detail {
    display: flex;
    align-items: center;
    gap: 10px;
}

.farm-detail i {
    color: var(--primary-color);
    width: 20px;
}

/* Stats Cards */
.stats-section {
    padding: 60px 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

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

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-card i {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.stat-card .number {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.stat-card .label {
    font-size: 1rem;
    opacity: 0.9;
}

/* Reports Section */
.reports-section {
    padding: 80px 0;
}

.report-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

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

.report-type {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.report-type.daily { background: rgba(52, 152, 219, 0.1); color: var(--secondary-color); }
.report-type.weekly { background: rgba(155, 89, 182, 0.1); color: #9b59b6; }
.report-type.monthly { background: rgba(46, 204, 113, 0.1); color: var(--success-color); }

/* AI Widget */
.ai-widget {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 999;
}

.ai-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-hover);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-toggle:hover {
    transform: scale(1.1);
}

.ai-modal {
    position: fixed;
    bottom: 100px;
    left: 30px;
    width: 380px;
    max-height: 500px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.ai-modal.active {
    display: flex;
}

.ai-header {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: var(--white);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
}

.ai-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.ai-message {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.ai-actions {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.ai-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.ai-actions .analyze-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: var(--white);
}

/* Unified AI Chat Panel */
.ai-chat-panel {
    position: fixed;
    bottom: 100px;
    left: 30px;
    width: 400px;
    height: 520px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
    animation: chatSlideUp 0.3s ease;
}
.ai-chat-panel.active { display: flex; }
@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.ai-chat-header {
    background: linear-gradient(135deg, #2d8a3e, #1a5f2a);
    color: #fff;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ai-chat-title { display: flex; align-items: center; gap: 12px; }
.ai-chat-avatar {
    width: 42px; height: 42px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
}
.ai-chat-title h3 { font-size: 1rem; margin: 0; }
.ai-chat-title p { font-size: 0.78rem; opacity: 0.85; margin: 2px 0 0; }
.ai-chat-close {
    background: none; border: none; color: #fff;
    font-size: 1.2rem; cursor: pointer; opacity: 0.8;
    transition: opacity 0.3s;
}
.ai-chat-close:hover { opacity: 1; }
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9fafb;
}
.ai-chat-welcome {
    text-align: center;
    padding: 20px 10px;
    color: #666;
}
.ai-chat-welcome > i { font-size: 3rem; color: #2d8a3e; margin-bottom: 15px; display: block; }
.ai-chat-welcome > p { margin-bottom: 15px; font-size: 0.95rem; }
.ai-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.ai-chat-suggestions button {
    padding: 8px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    background: #fff;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex; align-items: center; gap: 6px;
}
.ai-chat-suggestions button:hover { background: #2d8a3e; color: #fff; border-color: #2d8a3e; }
.ai-chat-suggestions button i { font-size: 0.8rem; }
.ai-msg { display: flex; gap: 10px; max-width: 90%; }
.ai-msg-user { align-self: flex-start; flex-direction: row-reverse; }
.ai-msg-bot { align-self: flex-end; }
.ai-msg-avatar {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #2d8a3e, #1a5f2a);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.85rem; flex-shrink: 0;
}
.ai-msg-content {
    padding: 12px 16px;
    border-radius: 15px;
    line-height: 1.6;
    font-size: 0.92rem;
}
.ai-msg-user .ai-msg-content {
    background: #4f46e5; color: #fff;
    border-bottom-right-radius: 5px;
}
.ai-msg-bot .ai-msg-content {
    background: #fff; color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.06);
}
.ai-msg-error { color: #dc2626 !important; }
.ai-chat-typing {
    padding: 10px 20px;
    display: flex;
    gap: 5px;
    align-items: center;
    background: #f9fafb;
}
.ai-chat-typing span {
    width: 8px; height: 8px;
    background: #999; border-radius: 50%;
    animation: typing 1.4s infinite;
}
.ai-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}
.ai-chat-input-area {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.ai-chat-input-area textarea {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.95rem;
    resize: none;
    min-height: 45px;
    max-height: 100px;
    transition: border-color 0.3s;
}
.ai-chat-input-area textarea:focus { outline: none; border-color: #2d8a3e; }
.ai-chat-send {
    width: 45px; height: 45px;
    background: linear-gradient(135deg, #2d8a3e, #1a5f2a);
    border: none; border-radius: 12px;
    color: #fff; font-size: 1rem;
    cursor: pointer; transition: transform 0.3s;
    flex-shrink: 0;
}
.ai-chat-send:hover { transform: scale(1.05); }

@media (max-width: 768px) {
    .ai-chat-panel {
        left: 10px; right: 10px;
        width: auto; bottom: 80px;
        height: 70vh;
    }
}

/* Footer */
.footer {
    background: var(--primary-dark);
    color: var(--white);
    padding: 60px 0 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--white);
    padding-right: 5px;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--white);
    z-index: 2000;
    transition: var(--transition);
    box-shadow: var(--shadow-hover);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    padding: 20px;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-menu nav ul {
    list-style: none;
    padding: 20px;
}

.mobile-menu nav li {
    margin-bottom: 10px;
}

.mobile-menu nav a {
    display: block;
    padding: 12px 15px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
}

.mobile-menu nav a:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

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

select.form-control {
    appearance: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat left 15px center;
    background-color: var(--white);
    padding-left: 40px;
}

/* Notifications */
.notification-toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--white);
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 3000;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translate(-50%, -20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.notification-toast.success { border-right: 4px solid var(--success-color); }
.notification-toast.error { border-right: 4px solid var(--danger-color); }
.notification-toast.warning { border-right: 4px solid var(--warning-color); }

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #eee;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 992px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-image {
        display: none;
    }
    
    .hero-content h1 {
        font-size: 2.2rem;
    }
    
    .hero-buttons {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .hero {
        padding: 80px 0 60px;
    }
    
    .hero-content h1 {
        font-size: 1.8rem;
    }
    
    .section-header h2 {
        font-size: 1.8rem;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .ai-modal {
        left: 10px;
        right: 10px;
        width: auto;
    }
    
    .ai-widget {
        left: 15px;
        bottom: 15px;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none !important; }
