/* ============================================
   ОБЩИЕ СТИЛИ
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2e7d32;
    --primary-light: #e8f5e9;
    --primary-dark: #1b5e20;
    --secondary: #1976d2;
    --success: #43a047;
    --warning: #fb8c00;
    --danger: #e53935;
    --text: #263238;
    --text-light: #546e7a;
    --background: #f5f7fa;
    --white: #ffffff;
    --border: #dfe6e9;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
    --radius: 14px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    padding-bottom: 40px;
}

/* ============================================
   ШАПКА
   ============================================ */
.header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    padding: 20px 0;
    box-shadow: 0 4px 20px rgba(46, 125, 50, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    width: 100px;           /* было 64px */
    height: 100px;          /* было 64px */
    background: var(--white);
    border-radius: 16px;
    padding: 12px;
    object-fit: contain;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
}

.header-title h1 {
    color: var(--white);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header-title .subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 300;
}

/* ============================================
   ОСНОВНОЙ КОНТЕНТ
   ============================================ */
.main-content {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 16px;
}

/* ============================================
   ФОРМА
   ============================================ */
.form-group {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.form-group:focus-within {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    background: var(--white);
    color: var(--text);
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.1);
}

.form-select {
    background-image: 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='%23546e7a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

/* ============================================
   БОЛЕЗНИ
   ============================================ */
.diseases-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.disease-chip {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    color: var(--text);
}

.disease-chip:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.disease-chip.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
    font-weight: 600;
}

.disease-chip.active::before {
    content: "✓ ";
}

/* ============================================
   КНОПКИ
   ============================================ */
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.btn {
    padding: 16px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 20px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-secondary:hover {
    background: #1565c0;
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-warning:hover {
    background: #f57c00;
}

.btn-success {
    background: var(--success);
    color: var(--white);
    grid-column: 1 / -1;
}

.btn-success:hover {
    background: #388e3c;
}

/* ============================================
   РЕЗУЛЬТАТ
   ============================================ */
.result-container {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 20px;
    box-shadow: var(--shadow);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.result-header h2 {
    font-size: 20px;
    color: var(--primary-dark);
}

.btn-copy {
    background: var(--primary-light);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.btn-copy:hover {
    background: var(--primary);
    color: var(--white);
}

.result-content {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: var(--background);
    padding: 16px;
    border-radius: 10px;
    max-height: 600px;
    overflow-y: auto;
}

/* ============================================
   ИСТОРИЯ
   ============================================ */
.history-container {
    margin-top: 24px;
}

.history-container h3 {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 12px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    background: var(--white);
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateX(4px);
}

.history-item .info {
    font-size: 14px;
}

.history-item .info strong {
    color: var(--primary-dark);
}

.history-item .date {
    font-size: 12px;
    color: var(--text-light);
}

.history-item .delete-btn {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.history-item .delete-btn:hover {
    background: #ffebee;
}

/* ============================================
   АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ
   ============================================ */
@media (max-width: 600px) {
    .header-title h1 {
        font-size: 18px;
    }
    
    .logo {
        width: 48px;
        height: 48px;
    }
    
    .button-group {
        grid-template-columns: 1fr;
    }
    
    .btn-success {
        grid-column: 1;
    }
    
    .form-group {
        padding: 12px 14px;
    }
    
    .result-content {
        font-size: 12px;
        padding: 12px;
    }
}

/* ============================================
   ТЁМНАЯ ТЕМА
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #1a1a2e;
        --white: #16213e;
        --text: #e0e0e0;
        --text-light: #a0a0a0;
        --border: #2a2a4a;
        --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
        --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.6);
        --primary-light: #1b3a1b;
    }
    
    .form-input,
    .form-select {
        background: #1a1a2e;
        color: #e0e0e0;
        border-color: #2a2a4a;
    }
    
    .result-content {
        background: #0a0a1a;
    }
    
    .history-item {
        background: #16213e;
    }
    
    .disease-chip {
        background: #16213e;
    }
    
    .disease-chip.active {
        background: #1b3a1b;
    }
}

/* ============================================
   УВЕДОМЛЕНИЯ (TOAST)
   ============================================ */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--white);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
/* ============================================
   СТОИМОСТЬ УДОБРЕНИЙ
   ============================================ */
.fertilizer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 4px;
}

.fertilizer-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fertilizer-item label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

.fertilizer-item .form-input {
    padding: 8px 12px;
    font-size: 14px;
}

@media (max-width: 600px) {
    .fertilizer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

/* Логотип эмодзи */
.logo-emoji {
    font-size: 72px;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .logo-emoji {
        font-size: 48px;
        width: 56px;
        height: 56px;
    }
/* ============================================
   ДИАЛОГ ШЕРИНГА
   ============================================ */
.share-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.share-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.share-modal {
    background: var(--white);
    border-radius: 24px;
    max-width: 520px;
    width: 100%;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
}

.share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.share-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0 8px;
    transition: var(--transition);
}

.share-close:hover {
    color: var(--text);
    transform: rotate(90deg);
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    border: none;
    border-radius: 14px;
    background: var(--background);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text);
}

.share-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.share-btn .share-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 8px;
    transition: var(--transition);
}

.share-btn span {
    font-size: 11px;
    font-weight: 500;
}

/* Telegram */
.share-btn.telegram .share-icon {
    background: #0088cc;
}
.share-btn.telegram:hover {
    background: #e8f4fd;
}
.share-btn.telegram:hover .share-icon {
    transform: scale(1.1);
}

/* ВКонтакте */
.share-btn.vk .share-icon {
    background: #4a76a8;
}
.share-btn.vk:hover {
    background: #eef2f7;
}
.share-btn.vk:hover .share-icon {
    transform: scale(1.1);
}

/* Почта */
.share-btn.email .share-icon {
    background: #ea4335;
}
.share-btn.email:hover {
    background: #fde8e6;
}
.share-btn.email:hover .share-icon {
    transform: scale(1.1);
}

/* WhatsApp */
.share-btn.whatsapp .share-icon {
    background: #25d366;
}
.share-btn.whatsapp:hover {
    background: #e8faf0;
}
.share-btn.whatsapp:hover .share-icon {
    transform: scale(1.1);
}

/* Копировать */
.share-btn.copy .share-icon {
    background: var(--primary);
}
.share-btn.copy:hover {
    background: var(--primary-light);
}
.share-btn.copy:hover .share-icon {
    transform: scale(1.1);
}

.share-text-preview {
    background: var(--background);
    border-radius: 10px;
    padding: 12px;
}

.share-text-preview textarea {
    width: 100%;
    height: 80px;
    border: none;
    background: transparent;
    resize: none;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    font-family: inherit;
    outline: none;
}

/* Тёмная тема */
@media (prefers-color-scheme: dark) {
    .share-modal {
        background: var(--white);
    }
    
    .share-btn {
        background: #1a1a2e;
        color: #e0e0e0;
    }
    
    .share-btn:hover {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }
    
    .share-btn.telegram:hover {
        background: #0a2a3a;
    }
    .share-btn.vk:hover {
        background: #1a2a3a;
    }
    .share-btn.email:hover {
        background: #3a1a1a;
    }
    .share-btn.whatsapp:hover {
        background: #0a2a1a;
    }
    .share-btn.copy:hover {
        background: #1a2a1a;
    }
    
    .share-text-preview textarea {
        color: #e0e0e0;
    }
}

/* Адаптация для мобильных */
@media (max-width: 520px) {
    .share-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .share-modal {
        padding: 20px;
    }
    
    .share-btn {
        padding: 12px 6px;
    }
    
    .share-btn .share-icon {
        width: 32px;
        height: 32px;
        padding: 6px;
    }
    
    .share-btn span {
        font-size: 10px;
    }
}

@media (max-width: 380px) {
    .share-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}
}