/* =====================================================
   まちボード - 住民向けCSS (高齢者フレンドリー)
   ===================================================== */

:root {
    --primary: #2196F3;
    --primary-dark: #1976D2;
    --primary-light: #BBDEFB;
    --danger: #f44336;
    --success: #4CAF50;
    --warning: #FF9800;
    --text-dark: #212121;
    --text-body: #333333;
    --text-light: #757575;
    --bg-main: #f5f5f5;
    --bg-card: #ffffff;
    --border: #e0e0e0;
    --font-base: 18px;
    --font-large: 22px;
    --font-small: 15px;
    --tap-target: 48px;
    --radius: 12px;
    --tab-height: 64px;
}

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

body {
    font-family: 'Hiragino Kaku Gothic ProN', 'ヒラギノ角ゴ ProN', Meiryo, sans-serif;
    font-size: var(--font-base);
    line-height: 1.7;
    color: var(--text-body);
    background: var(--bg-main);
    padding-bottom: calc(var(--tab-height) + 16px + env(safe-area-inset-bottom, 0px));
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }

/* =====================================================
   Top Header
   ===================================================== */
.app-header {
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 20px;
    font-weight: 600;
}

.app-header .header-actions { display: flex; gap: 12px; align-items: center; }
.app-header .header-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =====================================================
   Bottom Tab Bar (LINE-like)
   ===================================================== */
.bottom-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-light);
    font-size: 11px;
    gap: 2px;
    min-height: var(--tap-target);
    transition: color 0.2s;
    position: relative;
}

.tab-item:hover { text-decoration: none; }
.tab-item.active { color: var(--primary); }
.tab-item .tab-icon { font-size: 24px; line-height: 1; }
.tab-item .tab-label { font-size: 11px; font-weight: 500; }

.tab-item .tab-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 20px);
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* =====================================================
   Container
   ===================================================== */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}

/* =====================================================
   Cards & Posts
   ===================================================== */
.post-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
}

.post-card:active { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

.post-card .post-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.post-card .post-title {
    font-size: var(--font-large);
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.4;
}

.post-card .post-body {
    font-size: var(--font-base);
    color: var(--text-body);
    line-height: 1.8;
    white-space: pre-wrap;
}

.post-card .post-body.truncated {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card .post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: var(--font-small);
    color: var(--text-light);
}

/* Category badges */
.cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

/* Read/Unread indicator */
.read-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.read-indicator.read { color: var(--success); }
.read-indicator.unread { color: var(--danger); font-weight: 600; }

/* Pin badge */
.pin-badge {
    background: #FFF3E0;
    color: #E65100;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

/* NEW badge */
.new-badge {
    background: var(--danger);
    color: #fff;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
}

/* =====================================================
   Ad Card
   ===================================================== */
.ad-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 12px;
}

.ad-card .ad-label {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.ad-card .ad-title {
    font-size: var(--font-base);
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.ad-card .ad-body {
    font-size: var(--font-small);
    color: var(--text-body);
    margin-bottom: 8px;
}

.ad-card .ad-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    font-size: var(--font-small);
    font-weight: 500;
}

/* =====================================================
   Buttons (elderly-friendly: large)
   ===================================================== */
.btn-large {
    display: block;
    width: 100%;
    padding: 16px 24px;
    font-size: var(--font-large);
    font-weight: 700;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    min-height: 56px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.btn-large:hover { opacity: 0.9; text-decoration: none; }
.btn-large:active { transform: scale(0.98); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }

.btn-outline-large {
    display: block;
    width: 100%;
    padding: 16px 24px;
    font-size: var(--font-large);
    font-weight: 600;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    color: var(--text-body);
}

/* Safety confirmation: extra large buttons */
.safety-btn {
    display: block;
    width: 100%;
    padding: 24px;
    font-size: 24px;
    font-weight: 700;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    text-align: center;
    margin-bottom: 16px;
    min-height: 80px;
    color: #fff;
    transition: transform 0.1s;
}

.safety-btn:active { transform: scale(0.97); }
.safety-btn-safe { background: var(--success); }
.safety-btn-help { background: var(--danger); }
.safety-btn-evacuated { background: var(--warning); }

/* =====================================================
   Forms (elderly-friendly)
   ===================================================== */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: var(--font-base);
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--font-base);
    font-family: inherit;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.15);
}

textarea.form-control { min-height: 120px; resize: vertical; }

/* OTP入力 */
.otp-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 24px 0;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: 8px;
    -webkit-appearance: none;
}

.otp-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Checkbox / Radio (large) */
.check-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: var(--font-base);
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
}

.check-item:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.check-item input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

/* =====================================================
   Flash Messages
   ===================================================== */
.flash {
    padding: 14px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: var(--font-base);
}

.flash-error { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.flash-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.flash-info { background: #e1f5fe; color: #0277bd; border: 1px solid #81d4fa; }

/* =====================================================
   Login Page
   ===================================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f5f5f5 100%);
}

.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    text-align: center;
}

.login-card .app-logo {
    font-size: 48px;
    margin-bottom: 12px;
}

.login-card h1 {
    font-size: 28px;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.login-card .subtitle {
    font-size: var(--font-base);
    color: var(--text-light);
    margin-bottom: 32px;
}

.login-card .form-group { text-align: left; }

.login-links {
    margin-top: 24px;
    font-size: var(--font-small);
    color: var(--text-light);
}

.login-links a { font-size: var(--font-small); }

/* =====================================================
   Event Card
   ===================================================== */
.event-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 12px;
}

.event-card .event-date {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 700;
    margin-right: 12px;
    min-width: 60px;
}

.event-card .event-date .month { font-size: 12px; }
.event-card .event-date .day { font-size: 24px; line-height: 1; }

.event-card .event-info { flex: 1; }
.event-card .event-title { font-size: var(--font-large); font-weight: 600; }
.event-card .event-detail { font-size: var(--font-small); color: var(--text-light); margin-top: 4px; }

/* =====================================================
   Profile
   ===================================================== */
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    margin: 0 auto 16px;
}

/* =====================================================
   Pagination
   ===================================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.page-link {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-body);
    font-size: var(--font-small);
}

.page-link.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* =====================================================
   Filter Tabs
   ===================================================== */
.filter-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: var(--font-small);
    font-weight: 600;
    color: var(--text-light);
    background: var(--bg-card);
    border: 1px solid var(--border);
    text-decoration: none;
    white-space: nowrap;
}

.filter-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 480px) {
    :root {
        --font-base: 16px;
        --font-large: 20px;
    }

    .container { padding: 12px; }
    .post-card { padding: 14px; }
}

/* =====================================================
   More Overlay (bottom sheet)
   ===================================================== */
.more-overlay {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: none;
}

.more-overlay.open {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.more-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    animation: fadeIn 0.2s ease;
}

.more-sheet {
    position: relative;
    background: var(--bg-card);
    border-radius: 16px 16px 0 0;
    padding: 16px 0 calc(var(--tab-height) + env(safe-area-inset-bottom, 0px));
    max-height: 60vh;
    overflow-y: auto;
    animation: slideUp 0.25s ease;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}

.more-sheet::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 12px;
}

.more-sheet a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    font-size: 17px;
    color: var(--text-body);
    text-decoration: none;
    transition: background 0.15s;
}

.more-sheet a:hover,
.more-sheet a:active {
    background: #f5f5f5;
    text-decoration: none;
}

.more-sheet .more-icon {
    font-size: 22px;
    width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.more-sheet .more-badge {
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    font-weight: 700;
}

/* "More" tab icon (hamburger-like) */
.tab-icon-more {
    font-size: 28px !important;
    font-weight: 700;
    line-height: 1;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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