/* =============================================
   タイガーケア リンク — TigerCare LINK
   ============================================= */

:root {
    --primary:       #F97316;
    --primary-dark:  #EA580C;
    --primary-light: #FDBA74;
    --secondary:     #FFF7ED;
    --white:         #FFFFFF;
    --text:          #1E293B;
    --text-sub:      #64748B;
    --border:        #E2E8F0;
    --bg:            #F8FAFC;
    --red:           #EF4444;
    --yellow:        #EAB308;
    --green:         #10B981;
    --blue:          #3B82F6;
    --deep-red:      #DC2626;
    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg:     0 4px 12px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans",
                 "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    font-size: 16px; line-height: 1.6; color: var(--text);
    background: var(--bg); min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

.hidden { display: none !important; }

/* --- ヘッダー --- */
.app-header { background: var(--primary); color: var(--white); position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; }
.header-brand { display: flex; align-items: center; gap: 8px; font-weight: bold; font-size: 18px; }
.header-logo { font-size: 24px; }
.header-user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.header-site { opacity: 0.9; }
.btn-logout { color: var(--white); background: rgba(255,255,255,0.2); padding: 6px 12px; border-radius: var(--radius-sm); font-size: 13px; transition: background 0.2s; }
.btn-logout:hover { background: rgba(255,255,255,0.3); }

/* --- メイン --- */
.app-main { max-width: 600px; margin: 0 auto; padding: 16px; padding-bottom: 100px; }
.app-main.admin-main { max-width: 1200px; }

/* --- カード --- */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card-title { font-size: 14px; font-weight: bold; color: var(--text-sub); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }

/* --- ボタン --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 24px; border: none; border-radius: var(--radius); font-size: 16px; font-weight: bold; cursor: pointer; transition: all 0.2s; min-height: 48px; min-width: 48px; text-align: center; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-full { width: 100%; }
.btn-secondary { background: var(--secondary); color: var(--primary); border: 1px solid var(--primary-light); }
.btn-danger { background: var(--deep-red); color: var(--white); }
.btn-success { background: var(--green); color: var(--white); }

/* --- フォーム --- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: bold; font-size: 14px; margin-bottom: 6px; color: var(--text); }
.form-input { width: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 16px; background: var(--white); transition: border-color 0.2s; -webkit-appearance: none; }
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15); }

/* --- アラート --- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #FEF2F2; color: var(--red); border-left: 4px solid var(--red); }
.alert-success { background: #F0FDF4; color: var(--green); border-left: 4px solid var(--green); }
.alert-info { background: var(--secondary); color: var(--primary-dark); border-left: 4px solid var(--primary); }

/* --- ログイン画面 --- */
.login-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--secondary) 0%, var(--white) 100%); padding: 20px; }
.login-hero { text-align: center; margin-bottom: 32px; }
.login-mascot { font-size: 80px; margin-bottom: 8px; }
.login-greeting { font-size: 14px; color: var(--text-sub); }
.login-app-name { font-size: 28px; font-weight: bold; color: var(--text); margin: 4px 0; }
.login-app-name span { color: var(--primary); }
.login-subtitle { font-size: 13px; color: var(--text-sub); }
.login-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 32px 24px; width: 100%; max-width: 400px; }
.login-footer { text-align: center; margin-top: 24px; font-size: 12px; color: var(--text-sub); }

/* --- ボトムナビ --- */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--white); border-top: 1px solid var(--border); display: flex; justify-content: space-around; padding: 8px 0; padding-bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 100; }
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 16px; color: var(--text-sub); font-size: 11px; min-width: 48px; min-height: 48px; justify-content: center; transition: color 0.2s; }
.bottom-nav-item.active, .bottom-nav-item:hover { color: var(--primary); }
.nav-icon { font-size: 22px; }

/* --- フッター --- */
.app-footer { text-align: center; padding: 24px 16px; font-size: 12px; color: var(--text-sub); }

/* --- ダッシュボード --- */
.greeting-section { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--secondary); border-radius: var(--radius); margin-bottom: 16px; }
.greeting-icon { font-size: 48px; }
.greeting-text h2 { font-size: 18px; }
.greeting-text p { font-size: 13px; color: var(--text-sub); }
.role-badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: bold; color: var(--white); background: var(--primary); }

/* --- バッジ --- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: bold; }
.badge-open        { background: #FEF2F2; color: var(--red); }
.badge-new         { background: #e3f2fd; color: #1565c0; }
.badge-confirmed   { background: #e8f5e9; color: #2e7d32; }
.badge-in_progress { background: #FFFBEB; color: var(--yellow); }
.badge-resolved    { background: #f3e5f5; color: #6a1b9a; }
.badge-closed      { background: #F0FDF4; color: var(--green); }
.badge-issue       { background: #FEF2F2; color: var(--red); }
.badge-notice      { background: #EFF6FF; color: var(--blue); }
.badge-request     { background: #FFFBEB; color: var(--yellow); }

/* --- ステータスカード --- */
.status-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.status-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; text-align: center; }
.status-card .count { font-size: 32px; font-weight: bold; }
.status-card .label { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.status-card.red .count { color: var(--red); }
.status-card.yellow .count { color: var(--yellow); }
.status-card.green .count { color: var(--green); }

/* --- リスト --- */
.report-list { list-style: none; }
.report-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.report-item:last-child { border-bottom: none; }
.report-info { flex: 1; min-width: 0; }
.report-body { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-meta { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.report-card-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.report-card-link:hover .report-body { color: var(--primary); }

/* --- 本部PC用レイアウト --- */
@media (min-width: 769px) {
    .admin-layout { display: grid; grid-template-columns: 240px 1fr; gap: 0; min-height: calc(100vh - 60px); }
    .admin-sidebar { background: var(--white); border-right: 1px solid var(--border); padding: 24px 16px; }
    .admin-sidebar .nav-item { display: block; padding: 12px 16px; border-radius: var(--radius-sm); color: var(--text); margin-bottom: 4px; transition: background 0.2s; }
    .admin-sidebar .nav-item:hover, .admin-sidebar .nav-item.active { background: var(--secondary); color: var(--primary); }
    .admin-content { padding: 24px 32px; }
}
@media (max-width: 768px) {
    .admin-sidebar { display: none; }
    .admin-content { padding: 16px; }
}

/* --- ユーティリティ --- */
.text-center { text-align: center; }
.text-sub { color: var(--text-sub); }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* =============================================
   Phase 2 追加
   ============================================= */

.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; padding: 10px 12px; background: var(--bg); border-bottom: 2px solid var(--border); font-weight: bold; color: var(--text-sub); font-size: 12px; white-space: nowrap; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tbody tr:hover { background: var(--secondary); }
select.form-input { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; background: var(--white); cursor: pointer; }

/* =============================================
   Phase 3 追加（投稿フォーム）
   ============================================= */

.type-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-option input[type="radio"] { display: none; }
.type-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 8px; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: all 0.2s; text-align: center; }
.type-card:hover { border-color: var(--primary-light); background: var(--secondary); }
.type-option input[type="radio"]:checked + .type-card { border-color: var(--primary); background: var(--secondary); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15); }
.type-icon { font-size: 24px; }
.type-name { font-size: 14px; font-weight: bold; }
.type-desc { font-size: 11px; color: var(--text-sub); }
.form-textarea { resize: vertical; min-height: 120px; font-family: inherit; line-height: 1.6; }
.char-count { text-align: right; font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.char-count.over { color: var(--red); font-weight: bold; }
.image-upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 16px; text-align: center; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.image-upload-area:hover, .image-upload-area.dragover { border-color: var(--primary); background: var(--secondary); }
.upload-placeholder p { margin-top: 8px; font-size: 14px; color: var(--text-sub); }
.image-preview-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; max-width: 400px; }
.image-preview-item { position: relative; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 1; max-width: 130px; max-height: 130px; }
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-remove { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; background: rgba(0,0,0,0.6); color: var(--white); border: none; border-radius: 50%; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; }
.btn.submitting { opacity: 0.7; pointer-events: none; }

/* =============================================
   Phase 4 追加（投稿詳細・ステータス管理）
   ============================================= */

.detail-header { margin-bottom: 16px; }
.back-link { display: inline-block; color: var(--primary); text-decoration: none; font-size: 14px; font-weight: bold; margin-bottom: 12px; }
.back-link:hover { text-decoration: underline; }
.detail-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: bold; white-space: nowrap; }
.status-new        { background: #e3f2fd; color: #1565c0; }
.status-confirmed  { background: #e8f5e9; color: #2e7d32; }
.status-progress   { background: #fff3e0; color: #e65100; }
.status-resolved   { background: #f3e5f5; color: #6a1b9a; }
.badge-type        { background: var(--bg); color: var(--text-sub); border: 1px solid var(--border); }
.badge-limited     { background: #fce4ec; color: #c62828; }
.detail-author { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg); border-radius: var(--radius); margin-bottom: 12px; }
.author-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: bold; flex-shrink: 0; }
.author-info { flex: 1; }
.author-name { font-weight: bold; font-size: 15px; }
.author-role { font-size: 11px; margin-left: 4px; }
.badge-role-admin   { color: #c62828; }
.badge-role-manager { color: #1565c0; }
.badge-role-staff   { color: #2e7d32; }
.badge-role-client  { color: #e65100; }
.author-time { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.detail-id { font-size: 12px; color: var(--text-sub); margin-bottom: 12px; }
.detail-body { padding: 16px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); line-height: 1.8; font-size: 15px; margin-bottom: 16px; white-space: pre-wrap; word-wrap: break-word; }
.section-title { font-size: 14px; font-weight: bold; margin-bottom: 8px; color: var(--text); }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; max-width: 400px; }
.photo-item { aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; border: 1px solid var(--border); max-width: 130px; max-height: 130px; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.photo-item:hover img { transform: scale(1.05); }
.lightbox { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.lightbox.hidden { display: none !important; }
.lightbox-content { position: relative; max-width: 95vw; max-height: 95vh; }
.lightbox-content img { max-width: 95vw; max-height: 90vh; object-fit: contain; border-radius: 8px; }
.lightbox-close { position: absolute; top: -40px; right: 0; background: none; border: none; color: white; font-size: 28px; cursor: pointer; padding: 8px; }
.status-change-section { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.status-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.btn-status { flex: 1; min-width: 120px; padding: 10px 12px; font-size: 13px; border-radius: var(--radius); border: 2px solid transparent; cursor: pointer; font-weight: bold; transition: all 0.2s; }
.btn-confirmed { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
.btn-confirmed:hover { background: #c8e6c9; }
.btn-progress { background: #fff3e0; color: #e65100; border-color: #ffcc80; }
.btn-progress:hover { background: #ffe0b2; }
.btn-resolved { background: #f3e5f5; color: #6a1b9a; border-color: #ce93d8; }
.btn-resolved:hover { background: #e1bee7; }
.response-history { margin-bottom: 16px; }
.response-item { padding: 12px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.response-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.response-user { font-weight: bold; font-size: 13px; }
.response-time { font-size: 12px; color: var(--text-sub); margin-left: auto; }
.response-comment { font-size: 14px; color: var(--text); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); line-height: 1.6; }