/* Protein Analyzer Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Search Section */
.search-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.search-section h2 {
    margin-bottom: 20px;
    color: #667eea;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.radio-group label,
.checkbox-group label {
    display: inline-block;
    margin-right: 20px;
    font-weight: normal;
    cursor: pointer;
}

.radio-group input,
.checkbox-group input {
    margin-right: 5px;
    cursor: pointer;
}

input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.btn {
    padding: 12px 30px;
    font-size: 1em;
    font-weight: 600;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #555;
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error */
.error {
    background-color: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid #c33;
}

/* Results */
.results-section {
    min-height: 200px;
}

#results {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.results-header {
    margin-bottom: 20px;
}

.results-header h2 {
    color: #667eea;
    margin-bottom: 10px;
}

.result-count {
    color: #666;
    font-size: 1.1em;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

thead {
    background-color: #667eea;
    color: white;
}

th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

td {
    padding: 12px 8px;
    border-bottom: 1px solid #eee;
}

tr:hover {
    background-color: #f9f9f9;
}

.top-result {
    background-color: #fffbea;
}

.top-result:hover {
    background-color: #fff5d6;
}

.item-name {
    font-weight: 500;
    color: #333;
    max-width: 300px;
}

.item-name a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s ease;
}

.item-name a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.number {
    text-align: right;
}

.highlight {
    font-weight: 600;
    color: #667eea;
}

.serving {
    font-size: 0.85em;
    color: #666;
}

/* v7: NEW badge and date column */
.new-badge {
    display: inline-block;
    background-color: #ff6b6b;
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 3px;
    margin-right: 8px;
    vertical-align: middle;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.date {
    font-size: 0.85em;
    color: #666;
    text-align: center;
    white-space: nowrap;
}

input[type="text"],
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: #999;
    font-size: 0.9em;
}

/* Utility */
.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 1.8em;
    }

    .search-section,
    #results {
        padding: 20px;
    }

    table {
        font-size: 0.8em;
    }

    th, td {
        padding: 8px 4px;
    }

    .item-name {
        max-width: 150px;
    }
}

/* Meal Planner Section */
.meal-planner-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.meal-planner-section h2 {
    color: #667eea;
    margin-bottom: 10px;
}

.meal-planner-section .subtitle {
    color: #666;
    margin-bottom: 20px;
}

.help-text {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* Meal Solution Cards */
.meal-solution-card {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.meal-solution-header {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #667eea;
}

.meal-solution-header h4 {
    color: #667eea;
    font-size: 1.3em;
    margin-bottom: 10px;
}

.meal-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.95em;
}

.meal-total-item {
    padding: 8px 12px;
    background: white;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.meal-total-item.price {
    background: #fff3cd;
    border-color: #ffc107;
    font-weight: bold;
}

/* Meal Items Table */
.meal-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.meal-items-table th,
.meal-items-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.meal-items-table th {
    background: #f0f0f0;
    font-weight: 600;
    font-size: 0.9em;
}

.meal-items-table td.quantity {
    text-align: center;
    font-weight: bold;
    color: #667eea;
}

.meal-items-table td.number {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.meal-items-table tr:hover {
    background: #f5f5f5;
}
