/* ============================================================
   style.css — 個人専用TODOアプリ
   ============================================================ */

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

:root {
    --bg:       #f0f2f5;
    --surface:  #ffffff;
    --primary:  #2d6be4;
    --primary-h:#1a54c8;
    --danger:   #e53e3e;
    --text:     #1a202c;
    --muted:    #718096;
    --border:   #e2e8f0;
    --done-bg:  #f7fafc;
    --done-txt: #a0aec0;
    --radius:   10px;
    --shadow:   0 2px 8px rgba(0,0,0,.08);
}

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}

/* ---- レイアウト ---- */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 16px 80px;
}

/* ---- ヘッダー ---- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.app-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}
.app-header .nav-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
    margin-left: 16px;
    transition: color .15s;
}
.app-header .nav-links a:hover { color: var(--primary); }

/* ---- カード ---- */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}

/* ---- 日付バッジ ---- */
.date-label {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* ---- タスク入力 ---- */
.task-input-wrap {
    display: flex;
    gap: 8px;
}
.task-input-wrap input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    transition: border-color .15s;
}
.task-input-wrap input[type="text"]:focus { border-color: var(--primary); }
.task-input-wrap button,
.btn {
    padding: 10px 18px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}
.task-input-wrap button:hover,
.btn:hover { background: var(--primary-h); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c53030; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ---- タスクリスト ---- */
.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 20px 0 8px;
}
.task-list { list-style: none; }
.task-item {
    display: flex;
    align-items: center;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
    gap: 10px;
    transition: background .1s;
    border-radius: 6px;
}
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: var(--bg); }

/* チェックボックス */
.task-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.task-title { flex: 1; font-size: 0.95rem; }

/* 完了済みタスク */
.task-item.done { background: var(--done-bg); }
.task-item.done .task-title {
    text-decoration: line-through;
    color: var(--done-txt);
}

/* 削除ボタン */
.btn-delete {
    background: none;
    border: none;
    color: var(--border);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color .15s, background .15s;
    line-height: 1;
}
.btn-delete:hover { color: var(--danger); background: #fff5f5; }

/* 空メッセージ */
.empty-msg {
    text-align: center;
    color: var(--muted);
    padding: 24px 0;
    font-size: 0.9rem;
}

/* ---- ログイン画面 ---- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.login-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px 36px;
    width: 100%;
    max-width: 360px;
}
.login-card h1 {
    font-size: 1.4rem;
    color: var(--primary);
    margin-bottom: 28px;
    text-align: center;
}
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}
.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    transition: border-color .15s;
}
.form-group input:focus { border-color: var(--primary); }
.btn-block { width: 100%; margin-top: 8px; }

/* エラーメッセージ */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 16px;
}
.alert-error { background: #fff5f5; color: var(--danger); border: 1px solid #fed7d7; }
.alert-success { background: #f0fff4; color: #276749; border: 1px solid #c6f6d5; }

/* ---- 設定画面 ---- */
.routine-list { list-style: none; }
.routine-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}
.routine-item:last-child { border-bottom: none; }
.routine-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}
.badge-on  { background: #ebf8ff; color: #2b6cb0; }
.badge-off { background: var(--done-bg); color: var(--done-txt); }

/* ---- ローディングスピナー ---- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- トースト通知 ---- */
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #2d3748;
    color: #fff;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 0.875rem;
    opacity: 0;
    transition: opacity .25s, transform .25s;
    pointer-events: none;
    z-index: 999;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- レスポンシブ ---- */
@media (max-width: 480px) {
    .app-header h1 { font-size: 1.1rem; }
    .card { padding: 14px; }
}
