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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: #333;
}

.container {
    max-width: 500px;
    margin: 20px auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 25px 20px;
    text-align: center;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.header p {
    opacity: 0.9;
    font-size: 0.9rem;

    a {
        color: #f8f9fa;
        font-weight: 500;
        text-decoration: none;
    }
}

.nav-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.nav-tab {
    flex: 1;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    color: #666;
}

.nav-tab.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

.nav-tab:hover:not(.active) {
    background: #e9ecef;
}

.tab-content {
    display: none;
    padding: 25px 20px;
}

.tab-content.active {
    display: block;
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
    font-size: 0.95rem;
}

input,
select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

input:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group {
    position: relative;
}

.input-unit {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 0.9rem;
    pointer-events: none;
}

input[type="number"] {
    padding-right: 40px;
}

.btn-calculate,
.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #495057);
    font-size: 0.9rem;
    padding: 10px;
    margin: 5px 0;
}

.btn-calculate:hover,
.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

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

.result {
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #a8edea, #fed6e3);
    border-radius: 15px;
    border-left: 5px solid #667eea;
    animation: fadeIn 0.5s ease-out;
}

.result-corrected {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border-radius: 12px;
    border-left: 4px solid #28a745;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #667eea;
    margin-bottom: 15px;
}

.ingredients-section {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
}

.ingredients-title {
    font-weight: 700;
    color: #444;
    margin-bottom: 10px;
    font-size: 1rem;
}

.ingredient-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.ingredient-item:last-child {
    border-bottom: none;
}

.ingredient-name {
    font-weight: 500;
    color: #555;
}

.ingredient-amount {
    font-weight: 700;
    color: #667eea;
}

.tips {
    margin-top: 20px;
    padding: 15px;
    background: #fff3cd;
    border-radius: 10px;
    border-left: 4px solid #ffc107;
}

.tips-title {
    font-weight: 700;
    color: #856404;
    margin-bottom: 8px;
}

.tips-text {
    color: #856404;
    font-size: 0.9rem;
    line-height: 1.4;
}

.toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.toggle-option {
    padding: 12px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    background: #f8f9fa;
}

.toggle-option.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
}

.history-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.history-date {
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.history-details {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

.stats-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.stats-number {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.stats-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

.file-input-label {
    padding: 12px 15px;
    background: #6c757d;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    display: block;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
}

.file-input-label:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .container {
        margin: 10px;
        border-radius: 15px;
    }

    .header {
        padding: 20px 15px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .tab-content {
        padding: 20px 15px;
    }

    .nav-tab {
        padding: 12px 8px;
        font-size: 0.8rem;
    }
}

.error {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 5px;
}

.success {
    color: #28a745;
    font-size: 0.85rem;
    margin-top: 5px;
}

.hidden {
    display: none;
}

.correction-info {
    background: #e8f5e8;
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #155724;
}