@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&display=swap');

:root {
    --bg-color: #f8f6fb;
    --primary-purple: #9b89b3;
    --accent-purple: #b2a4d4;
    --light-purple: #e8e1f5;
    --text-main: #4a4453;
    --text-muted: #8e879a;
    --white: #ffffff;
    --shadow: 0 10px 30px rgba(178, 164, 212, 0.15);
    --glass: rgba(255, 255, 255, 0.7);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 画面遷移アニメーション */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

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

/* ヒーローバナー */
.hero-banner {
    width: calc(100% + 32px);
    margin: -20px -16px 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 20px rgba(155, 137, 179, 0.15);
    border-bottom: 1px solid rgba(178, 164, 212, 0.1);
}

.hero-banner img {
    width: 100%;
    height: auto;
    display: block;
}

header {
    background: var(--white);
    padding: env(safe-area-inset-top) 20px 15px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.03);
}

body.hide-header header {
    display: none;
}

h1 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-purple);
    letter-spacing: 0.05em;
}

.container {
    padding: calc(20px + env(safe-area-inset-top)) 16px 100px;
    max-width: 500px;
    margin: 0 auto;
}

/* カードスタイル */
.card {
    background: var(--white);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--primary-purple);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* フォーム要素 */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
}

input, select, textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--light-purple);
    border-radius: 16px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-main);
    background: #fdfcff;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-purple);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(178, 164, 212, 0.1);
}

button {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 18px;
    background: var(--primary-purple);
    color: var(--white);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 20px rgba(155, 137, 179, 0.3);
}

button:active {
    transform: scale(0.96);
}

button.secondary {
    background: var(--light-purple);
    color: var(--primary-purple);
    box-shadow: none;
}

/* トップメニュー */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
}

.menu-item {
    background: var(--white);
    border-radius: 24px;
    padding: 30px 20px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.menu-item:active {
    background: var(--light-purple);
    border-color: var(--accent-purple);
}

.menu-item.small {
    padding: 15px 10px;
}

.menu-item.small .menu-icon {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.menu-item.small .menu-label {
    font-size: 0.75rem;
}

.menu-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
}

.menu-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

/* バックアップ・復元ボタン（トップページ用） */
.backup-restore-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.backup-restore-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--white);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-purple);
    box-shadow: var(--shadow);
    border: 1px solid rgba(178, 164, 212, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.backup-restore-btn:active {
    transform: scale(0.95);
    background: var(--light-purple);
}

.backup-restore-btn span {
    font-size: 1.1rem;
}

/* リストアイテム */
.list-item {
    background: var(--white);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(232, 225, 245, 0.5);
}

.list-info h4 {
    margin: 0;
    font-size: 0.95rem;
}

.list-info p {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ナビゲーション */
nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(178, 164, 212, 0.2);
    z-index: 1000;
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    gap: 4px;
}

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

.nav-icon {
    font-size: 1.4rem;
}

/* 計算エリア */
.calc-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: flex-end;
}

.total-display {
    text-align: right;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px dashed var(--light-purple);
}

.total-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.total-amount {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-purple);
}

/* ユーティリティ */
.hidden { display: none !important; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* モーダル */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(74, 68, 83, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: var(--white);
    border-radius: 28px;
    width: 100%;
    max-width: 400px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-purple);
    margin-bottom: 20px;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions button {
    padding: 12px;
}

/* レポートテーブル (Excel風) */
.report-container {
    overflow-x: auto;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-top: 20px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 450px;
}

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

.report-table th {
    background-color: #f4f4f9;
    color: var(--primary-purple);
    font-weight: 600;
}

.report-table tr:nth-child(even) {
    background-color: #fafafa;
}

.report-table .num {
    text-align: right;
}

.report-total-row {
    background-color: #f0f0f0 !important;
    font-weight: 600;
}

/* タブ切り替え */
.report-tabs {
    display: flex;
    background: var(--bg-color);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.report-tab {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    color: var(--text-muted);
}

.report-tab.active {
    background: var(--white);
    color: var(--primary-purple);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* 印刷用ボタン */
.print-btn-area {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.print-btn-area button {
    width: auto;
    padding: 10px 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 印刷用スタイル */
@media print {
    body {
        background: white;
    }
    header, nav, .print-btn-area, .report-tabs, .secondary, button {
        display: none !important;
    }
    .container {
        padding: 0;
        max-width: 100%;
        margin: 0;
    }
    .card {
        box-shadow: none;
        border: none;
        padding: 0;
    }
    .report-container {
        box-shadow: none;
        margin-top: 0;
    }
    .report-table {
        font-size: 10pt;
    }
    h1, .section-title {
        color: black;
    }
    .view.hidden {
        display: none !important;
    }
    .view:not(.hidden) {
        display: block !important;
    }
}

/* タグスタイル */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag-label {
    background: var(--light-purple);
    color: var(--primary-purple);
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 600;
}

/* 検索ボックス */
.search-box {
    margin-bottom: 20px;
    position: sticky;
    top: -10px;
    z-index: 10;
    background: var(--bg-color);
    padding: 10px 0;
}

.search-box input {
    background: var(--white);
    border: 1px solid var(--light-purple);
    box-shadow: 0 4px 12px rgba(155, 137, 179, 0.1);
}

.search-box input:focus {
    box-shadow: 0 4px 15px rgba(155, 137, 179, 0.2);
}
