:root {
    --primary-color: #0088cc; /* メインブルー */
    --accent-color: #00A8E8;
    --background-color: #f7fbfe;
    --card-background: #ffffff;
    --text-color: #2d3436;
    --subtitle-color: #636e72;
    --danger-color: #ff4d4d;
    --warning-color: #ffa502;
    --success-color: #2ed573;
    --border-radius: 12px;
    --tab-inactive: #b2bec3;
    --transition: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans JP', sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: 60px; /* footer area */
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.app-header .subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Tabs */
.tab-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tab-btn {
    flex: 1;
    padding: 15px 10px;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--tab-inactive);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    width: 80%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

/* Main Container */
.app-container {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Search Box */
.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 15px 45px 15px 20px;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    background-color: white;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.15);
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tab-inactive);
}

.notice-box {
    background-color: #fff8e1;
    border-left: 4px solid #ffca28;
    padding: 10px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #6d4c41;
}

/* Result Cards */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.placeholder-text {
    text-align: center;
    color: var(--tab-inactive);
    padding: 40px 0;
}

.food-card {
    background-color: white;
    padding: 16px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid transparent;
}

.food-card.level-low { border-left-color: var(--success-color); }
.food-card.level-mid { border-left-color: var(--warning-color); }
.food-card.level-high { border-left-color: var(--danger-color); }

.food-info {
    flex: 1;
}

.food-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
}

.food-subinfo {
    font-size: 0.8rem;
    color: var(--subtitle-color);
}

.potassium-value {
    text-align: right;
    min-width: 100px;
}

.potassium-num {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
}

.potassium-unit {
    font-size: 0.7rem;
    color: var(--subtitle-color);
}

.caution-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    margin-top: 5px;
}

.caution-tag.low { background-color: var(--success-color); }
.caution-tag.mid { background-color: var(--warning-color); }
.caution-tag.high { background-color: var(--danger-color); }

/* Recipe Specifics */
.recipe-card {
    background-color: white;
    padding: 0;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.recipe-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background-color: #eee;
}

.recipe-body {
    padding: 15px;
}

.recipe-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.recipe-summary {
    font-size: 0.85rem;
    color: var(--subtitle-color);
    margin-bottom: 10px;
}

.btn-detail {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    bottom: 0;
    width: 100%;
    max-height: 90vh;
    background-color: white;
    border-radius: 20px 20px 0 0;
    padding: 25px;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.close-btn {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--subtitle-color);
}

.recipe-detail-header h2 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.ingredient-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

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

.ingredient-table th { font-weight: 700; }

.estimate-box {
    background-color: #e3f2fd;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 20px;
    text-align: center;
    border: 1px solid rgba(0, 136, 204, 0.2);
}

.estimate-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.reference-text {
    font-size: 0.75rem;
    color: #636e72;
    margin-top: 10px;
    line-height: 1.4;
}

.ai-loading {
    text-align: center;
    padding: 30px 10px;
    color: var(--primary-color);
}

.ai-loading p {
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 10px;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 136, 204, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Settings Button */
.settings-btn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
}

.settings-panel {
    position: fixed;
    right: 20px;
    bottom: 80px;
    width: 250px;
    background-color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 101;
}

.settings-panel.hidden { display: none; }

.settings-panel input {
    width: 100%;
    padding: 8px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.settings-panel button {
    width: 100%;
    padding: 8px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
}

.recipe-card-full {
    background-color: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    animation: fadeIn 0.5s ease;
}

.recipe-header h2 {
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-bottom: 5px;
}

.advice-box {
    background-color: #f1f8e9;
    border-left: 4px solid var(--success-color);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

.advice-box h4 {
    color: #388e3c;
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.advice-box p {
    font-size: 0.85rem;
    color: #2e7d32;
    line-height: 1.5;
}

.disclaimer {
    font-size: 0.7rem;
    color: var(--subtitle-color);
    margin-top: 20px;
    text-align: center;
    line-height: 1.4;
}

.app-footer {
    text-align: center;
    padding: 20px;
    font-size: 0.7rem;
    color: var(--subtitle-color);
}
