/* ===== CSS Reset & Variables ===== */
:root {
    --primary: #2d6a4f;
    --primary-light: #40916c;
    --primary-dark: #1b4332;
    --secondary: #52b788;
    --accent: #95d5b2;
    --accent-light: #d8f3dc;
    
    --warning: #f4a261;
    --danger: #e76f51;
    --success: #2a9d8f;
    --info: #457b9d;
    
    --bg-dark: #0a1612;
    --bg-card: #111d17;
    --bg-input: #1a2820;
    --border-color: #2d4a3e;
    
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --text-muted: #6c757d;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(82, 183, 136, 0.2);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== App Container ===== */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== Header ===== */
.header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    border-radius: var(--radius-xl);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.logo-icon {
    font-size: 48px;
    animation: bounce 2s ease-in-out infinite;
}

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

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.tagline {
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    overflow: hidden;
    transition: var(--transition);
}

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

.card-header {
    background: linear-gradient(90deg, var(--primary-dark) 0%, transparent 100%);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 24px;
}

/* ===== Forms ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.2);
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--primary-light);
}

/* ===== Feed Selection ===== */
.feed-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.feed-category h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.feed-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

.feed-list::-webkit-scrollbar {
    width: 6px;
}

.feed-list::-webkit-scrollbar-track {
    background: var(--bg-input);
    border-radius: 3px;
}

.feed-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.feed-item:hover {
    background: var(--primary-dark);
    border-color: var(--primary);
    transform: translateX(4px);
}

.feed-item.selected {
    background: var(--primary);
    border-color: var(--secondary);
}

.feed-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--secondary);
    cursor: pointer;
}

.feed-item .feed-name {
    flex: 1;
    font-weight: 500;
}

.feed-item .feed-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== Selected Feeds Table ===== */
.selected-feeds-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.feeds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.feeds-table th,
.feeds-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.feeds-table th {
    background: var(--bg-input);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.feeds-table tbody tr:hover {
    background: rgba(82, 183, 136, 0.05);
}

.feeds-table tfoot {
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--bg-input) 100%);
}

.feeds-table tfoot td {
    font-weight: 600;
    color: var(--secondary);
}

.feeds-table .empty-row td {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 30px;
}

.feeds-table input[type="number"] {
    width: 80px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    text-align: center;
}

.feeds-table input[type="number"]:focus {
    outline: none;
    border-color: var(--secondary);
}

.btn-remove {
    background: var(--danger);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-remove:hover {
    background: #c94a35;
    transform: scale(1.1);
}

/* ===== Calculate Button ===== */
.btn-calculate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-calculate:active {
    transform: translateY(0);
}

/* ===== Results Section ===== */
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.comparison-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.comparison-card h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.progress-container {
    height: 12px;
    background: var(--bg-dark);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease-out, background 0.3s;
}

.comparison-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.comparison-values strong {
    color: var(--text-primary);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.success {
    background: rgba(42, 157, 143, 0.2);
    color: var(--success);
}

.status-badge.warning {
    background: rgba(244, 162, 97, 0.2);
    color: var(--warning);
}

.status-badge.danger {
    background: rgba(231, 111, 81, 0.2);
    color: var(--danger);
}

/* Ratio Display */
.ratio-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.ratio-value {
    color: var(--secondary);
}

.ratio-separator {
    color: var(--text-muted);
}

.ratio-bar {
    display: flex;
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-dark);
    margin-bottom: 12px;
}

.ratio-fill.roughage {
    background: linear-gradient(90deg, #40916c, #52b788);
}

.ratio-fill.concentrate {
    background: linear-gradient(90deg, #f4a261, #e9c46a);
}

/* ===== Recommendations ===== */
.recommendations {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.recommendations h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 16px;
}

.recommendations ul {
    list-style: none;
}

.recommendations li {
    padding: 10px 0;
    padding-left: 24px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.recommendations li:last-child {
    border-bottom: none;
}

.recommendations li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--secondary);
    font-weight: bold;
}

.recommendations li.good::before {
    content: '✓';
    color: var(--success);
}

.recommendations li.warning::before {
    content: '⚠';
    color: var(--warning);
}

.recommendations li.bad::before {
    content: '✗';
    color: var(--danger);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 20px;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-section {
    animation: fadeIn 0.4s ease-out;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .app-container {
        padding: 12px;
    }
    
    .header {
        padding: 30px 16px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .logo-icon {
        font-size: 36px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
    }
    
    .feeds-table th,
    .feeds-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
}
