/* 基本設定 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 10px;
    background-color: #f4f4f4;
    color: #333;
    font-size: 16px;
}

.container {
    max-width: 100%;
    padding: 0 15px;
    margin: 0 auto;
}

h1, h2 {
    color: #333;
}

a {
    text-decoration: none;
}

/* ヘッダーコンテナ */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 15px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header-buttons {
    display: flex;
    gap: 10px;
}

/* ボタンスタイル */
.button {
    display: inline-block;
    background: #4CAF50;
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.3s ease;
    min-height: 44px;
    min-width: 44px;
}

.button:hover, .button:focus {
    background: #45a049;
}

#reloadButton {
    background-color: #2196F3;
}

#reloadButton:hover {
    background-color: #1976D2;
}

#logoutButton {
    background-color: #f44336;
}

#logoutButton:hover {
    background-color: #d32f2f;
}

/* カードスタイル */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

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

input[type='text'],
input[type='datetime-local'],
input[type='password'],
select,
textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 16px;
    min-height: 44px;
    box-sizing: border-box;
}

/* タスク一覧のスタイル */
.task-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
    margin-bottom: 20px;
}

.task-table th,
.task-table td {
    padding: 10px;
    text-align: left;
    background-color: #fff;
    border: none;
}

.task-table th {
    background-color: #f2f2f2;
    font-weight: bold;
    border-radius: 8px 8px 0 0;
}

.task-table tr {
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.task-title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 5px;
}

.task-title {
    font-weight: bold;
    margin-right: 10px;
}

.task-assigned-users {
    font-size: 0.9em;
    color: #666;
}

.edit-task-assigned-users {
    width: 100%;
    max-width: 200px;
}

/* 編集モードのスタイル */
.edit-mode .task-title,
.edit-mode .task-assigned-users,
.edit-mode .task-start-date,
.edit-mode .task-due-date,
.edit-mode .task-priority,
.edit-mode .task-status,
.edit-mode .button-edit {
    display: none;
}

.edit-mode .edit-task-title,
.edit-mode .edit-task-title-other,
.edit-mode .edit-task-assigned-users,
.edit-mode .edit-task-start-date,
.edit-mode .edit-task-due-date,
.edit-mode .edit-task-priority,
.edit-mode .edit-task-status,
.edit-mode .button-save {
    display: block;
    width: 100%;
    margin-bottom: 5px;
}

/* ボタングループ */
.button-group {
    display: flex;
    gap: 10px;
}

.button-edit {
    background-color: #ffa500;
}

.button-delete {
    background-color: #ff4500;
}

.button-edit:hover, .button-edit:focus {
    background-color: #ff8c00;
}

.button-delete:hover, .button-delete:focus {
    background-color: #ff6347;
}

/* オフライン状態 */
body.offline {
    filter: grayscale(100%);
}

body.offline::after {
    content: 'オフライン';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff0000;
    color: #ffffff;
    text-align: center;
    padding: 5px;
}

/* インストールボタン */
.install-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
}

/* エラーメッセージ */
.error-message {
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    color: #b71c1c;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 4px;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    body {
        padding: 5px;
        font-size: 14px;
    }

    .container {
        padding: 5px;
    }

    .header-container {
        flex-direction: column;
        align-items: stretch;
    }

    .header-buttons {
        margin-top: 10px;
    }

    .task-table, 
    .task-table thead, 
    .task-table tbody, 
    .task-table th, 
    .task-table td, 
    .task-table tr {
        display: block;
    }

    .task-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .task-table tr {
        margin-bottom: 15px;
        border-radius: 8px;
        overflow: hidden;
        background-color: #fff;
    }

    .task-table td {
        position: relative;
        padding-left: 50%;
        text-align: left;
        border-bottom: 1px solid #eee;
    }

    .task-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
    }

    .task-title-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .task-assigned-users {
        margin-left: 0;
        margin-top: 5px;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group .button {
        width: 100%;
        margin-bottom: 5px;
    }

    .edit-task-assigned-users {
        max-width: 100%;
    }
}

/* タッチデバイス最適化 */
@media (hover: none) {
    .button:active {
        background-color: #45a049;
    }

    .button-edit:active {
        background-color: #ff8c00;
    }

    .button-delete:active {
        background-color: #ff6347;
    }

    #reloadButton:active {
        background-color: #1565C0;
    }

    #logoutButton:active {
        background-color: #c62828;
    }
}