/* ============================================================
   タスク管理アプリ - スタイルシート
   ============================================================ */

/* リセット & 基本設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

/* コンテナ */
.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* ============================================================
   ヘッダー
   ============================================================ */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    font-weight: 300;
}

/* ============================================================
   メインコンテンツ
   ============================================================ */
.main-content {
    padding: 40px 30px;
}

section {
    margin-bottom: 40px;
}

h2 {
    color: #333;
    font-size: 1.5em;
    margin-bottom: 20px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

/* ============================================================
   フォーム（タスク入力）
   ============================================================ */
.task-form {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #e9ecef;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

input[type="text"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
}

/* ============================================================
   ボタン
   ============================================================ */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
    margin-top: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 2px solid #ddd;
}

.btn-secondary:hover {
    background: #e8e8e8;
    border-color: #bbb;
}

.btn-danger {
    background: #ff6b6b;
    color: white;
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn-danger:hover {
    background: #ff5252;
}

.btn-success {
    background: #51cf66;
    color: white;
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn-success:hover {
    background: #40c057;
}

/* ============================================================
   エラーメッセージ
   ============================================================ */
.error-message {
    color: #ff6b6b;
    font-size: 0.95em;
    margin-top: 10px;
    display: none;
}

.error-message.show {
    display: block;
}

/* ============================================================
   コントロール（フィルタ & エクスポート）
   ============================================================ */
.controls-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.filter-controls {
    display: flex;
    gap: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #555;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* ============================================================
   タスク一覧
   ============================================================ */
.tasks-list {
    display: grid;
    gap: 15px;
}

.task-item {
    background: #f8f9fa;
    border-left: 5px solid #667eea;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
}

/* 優先度別の色 */
.task-item.priority-1 {
    border-left-color: #ff6b6b;
    background: #ffe0e0;
}

.task-item.priority-2 {
    border-left-color: #ffd43b;
    background: #fffacd;
}

.task-item.priority-3 {
    border-left-color: #4dabf7;
    background: #e7f5ff;
}

/* 期限が近い */
.task-item.due-soon {
    border-left-width: 8px;
    box-shadow: 0 0 0 2px #ff6b6b;
}

/* 完了状態 */
.task-item.completed {
    opacity: 0.6;
}

.task-item.completed .task-title {
    text-decoration: line-through;
    color: #999;
}

.task-content {
    flex: 1;
}

.task-header {
    display: flex;
    align-items: start;
    gap: 10px;
    margin-bottom: 10px;
}

.task-checkbox {
    width: 24px;
    height: 24px;
    min-width: 24px;
    cursor: pointer;
    margin-top: 2px;
}

.task-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    word-break: break-word;
}

.task-description {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
    padding-left: 34px;
}

.task-meta {
    display: flex;
    gap: 15px;
    padding-left: 34px;
    font-size: 0.85em;
    flex-wrap: wrap;
}

.task-priority,
.task-due-date {
    background: white;
    padding: 4px 12px;
    border-radius: 6px;
    color: #555;
}

.task-due-date {
    border-left: 3px solid #667eea;
}

.task-actions {
    display: flex;
    gap: 8px;
    flex-direction: column;
    min-width: 100px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
    white-space: nowrap;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit {
    background: #4dabf7;
    color: white;
}

.btn-edit:hover {
    background: #339af0;
}

.btn-delete {
    background: #ff6b6b;
    color: white;
}

.btn-delete:hover {
    background: #ff5252;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 1.1em;
}

/* ============================================================
   フッター
   ============================================================ */
.footer {
    background: #f8f9fa;
    padding: 20px 30px;
    text-align: center;
    color: #666;
    border-top: 2px solid #e9ecef;
}

.footer p {
    font-size: 0.95em;
}

/* ============================================================
   レスポンシブ設計
   ============================================================ */
@media (max-width: 768px) {
    .container {
        border-radius: 0;
    }

    .header {
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 2em;
    }

    .main-content {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .controls-section {
        justify-content: center;
        flex-direction: column;
    }

    .task-item {
        grid-template-columns: 1fr;
    }

    .task-actions {
        flex-direction: row;
    }

    .btn-small {
        flex: 1;
    }

    .task-meta {
        padding-left: 0;
    }

    .task-description {
        padding-left: 0;
    }

    h2 {
        font-size: 1.3em;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 0.95em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 20px 15px;
    }

    .main-content {
        padding: 15px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .subtitle {
        font-size: 0.85em;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9em;
    }

    .task-form {
        padding: 15px;
    }

    h2 {
        font-size: 1.1em;
        margin-bottom: 15px;
    }
}
