/* Сброс и базовые настройки */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background: #f4f7f9;
    height: 100vh;
    overflow: hidden;
}

/* ===== APP CONTAINER ===== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background: #ffffff;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* ===== HEADER ===== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #2c3e50;
    color: #ecf0f1;
    border-bottom: 3px solid #27ae60;
    flex-shrink: 0;
    z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 15px; }
.btn-menu { display: none; background: none; border: none; color: white; font-size: 22px; cursor: pointer; }
.app-title { font-size: 18px; font-weight: 600; letter-spacing: 0.5px; }
.user-name { font-size: 14px; opacity: 0.9; }

/* ===== MAIN GRID ===== */
.app-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* --- ЛЕВАЯ КОЛОНКА (Чаты) --- */
.chat-list {
    width: 30%;
    min-width: 250px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}
.search-box {
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 10px;
    border-bottom: 1px solid #eee;
}
.search-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
}
.btn-add-chat { background: #27ae60; color: white; border: none; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; }

.chat-folders { display: flex; gap: 5px; padding: 10px 15px; flex-wrap: wrap; }
.chat-folders a { text-decoration: none; color: #495057; font-size: 13px; padding: 4px 10px; border-radius: 15px; background: #e9ecef; }
.chat-folders a.active { background: #27ae60; color: white; }

.chat-items { flex: 1; padding: 10px; overflow-y: auto; }
.chat-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; cursor: pointer; transition: background 0.2s; }
.chat-item:hover, .chat-item.active { background: #e9ecef; }
.chat-item .avatar { width: 40px; height: 40px; border-radius: 50%; background: #27ae60; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; }
.chat-item .info { flex: 1; }
.chat-item .info .name { font-weight: 600; }
.chat-item .info .last-msg { font-size: 12px; color: #6c757d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- ЦЕНТР (Чат) --- */
.chat-active {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}
.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    background: #f8f9fa;
}
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fafafa;
}
.chat-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid #dee2e6;
    background: white;
    gap: 10px;
}
.chat-input input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #ced4da;
    border-radius: 30px;
    outline: none;
    font-size: 14px;
}
.btn-send { background: #27ae60; border: none; border-radius: 50%; width: 46px; height: 46px; color: white; font-size: 18px; cursor: pointer; transition: 0.2s; }
.btn-send:hover { background: #1e8449; }

/* --- ПРАВАЯ КОЛОНКА (Агро-сервис) --- */
.agro-services {
    width: 30%;
    min-width: 250px;
    background: #f8f9fa;
    border-left: 1px solid #dee2e6;
    padding: 15px;
    overflow-y: auto;
}
.agro-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; font-weight: 600; }
.btn-close-agro { display: none; background: none; border: none; font-size: 20px; cursor: pointer; }

.agro-widget { background: white; border-radius: 12px; padding: 15px; margin-bottom: 15px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); border: 1px solid #e9ecef; }
.agro-widget h4 { margin-bottom: 10px; color: #2c3e50; font-size: 14px; }
.agro-widget .price { font-size: 18px; font-weight: bold; color: #27ae60; }
.agro-widget .task { padding: 5px 0; border-bottom: 1px dashed #eee; }
.agro-widget .task:last-child { border: none; }

/* ===== АДАПТИВНОСТЬ (Мобильная версия) ===== */
@media (max-width: 992px) {
    .agro-services { display: none; }
    .chat-list { width: 35%; }
}

@media (max-width: 768px) {
    .btn-menu { display: block; }
    
    .chat-list {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        z-index: 1000;
        background: white;
        transform: translateX(-100%);
        box-shadow: 2px 0 20px rgba(0,0,0,0.2);
        border-right: none;
    }
    .chat-list.open { transform: translateX(0); }

    .agro-services {
        position: fixed;
        bottom: 0;
        right: 0;
        width: 100%;
        max-height: 70vh;
        z-index: 999;
        background: white;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
        padding: 20px;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    .agro-services.open { transform: translateY(0); }
    .btn-close-agro { display: block; }
}