/**
 * WP Task Manager - タスク登録フォーム + AI相談 CSS
 * v3.0.0
 */

/* ===== AIパネル ===== */
.wptm-ai-panel {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #f5f5fa;
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.wptm-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.wptm-ai-header-left { display: flex; align-items: center; gap: 12px; }
.wptm-ai-header-title { font-size: 17px; font-weight: 700; }
.wptm-ai-header-sub { font-size: 12px; color: #999; }

.wptm-ai-close { background: none; border: 1px solid #ddd; border-radius: 8px; padding: 6px 14px; font-size: 13px; cursor: pointer; }

#wptm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

/* ===== フォーム全体 ===== */
.wptm-form-header {
    margin-bottom: 16px;
}

.wptm-form-header-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
}

.wptm-task-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 40px;
}

/* ===== フィールド ===== */
.wptm-field {
    margin-bottom: 14px;
}

.wptm-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.wptm-field-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    font-size: 16px !important;
    background: #fff;
    -webkit-appearance: none;
    box-sizing: border-box;
    touch-action: manipulation;
}

.wptm-field-input:focus {
    outline: none;
    border-color: #4361ee;
}

.wptm-field-textarea {
    resize: vertical;
    min-height: 60px;
}

select.wptm-field-input {
    appearance: auto;
}

/* フィールド横にボタン */
.wptm-field-with-btn {
    display: flex;
    gap: 8px;
    align-items: center;
}

.wptm-field-with-btn select {
    flex: 1;
}

.wptm-field-add-btn {
    width: 44px;
    height: 44px;
    border: 1.5px solid #4361ee;
    border-radius: 10px;
    background: #fff;
    color: #4361ee;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wptm-field-add-btn:active {
    background: #4361ee;
    color: #fff;
}

/* プロジェクト追加フォーム */
.wf-add-project-form {
    margin-top: 8px;
    padding: 12px;
    background: #fff;
    border: 1.5px solid #e8e8f0;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wf-add-project-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.wptm-btn-primary-sm {
    padding: 8px 16px;
    background: #4361ee;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.wptm-btn-secondary-sm {
    padding: 8px 16px;
    background: #f0f0f0;
    color: #666;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.wptm-field-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.wptm-field-half {
    flex: 1;
    margin-bottom: 0;
}

/* ===== 工程リスト ===== */
.wf-steps-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.wf-step-row {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1.5px solid #e8e8f0;
    border-radius: 10px;
    padding: 8px 10px;
    gap: 8px;
    transition: opacity 0.2s, max-height 0.2s;
}

.wf-step-title {
    flex: 1;
    border: none;
    font-size: 14px;
    padding: 4px 0;
    background: transparent;
    min-width: 0;
    -webkit-appearance: none;
}

.wf-step-title:focus {
    outline: none;
}

.wf-step-right {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.wf-step-hours {
    width: 48px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 14px;
    text-align: right;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.wf-step-hours:focus {
    outline: none;
    border-color: #4361ee;
}

.wf-step-hours::-webkit-inner-spin-button,
.wf-step-hours::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wf-step-h {
    font-size: 12px;
    color: #999;
}

.wf-step-status {
    padding: 3px 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    -webkit-appearance: none;
    appearance: auto;
}

.wf-step-del {
    background: none;
    border: none;
    color: #ccc;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
    transition: color 0.15s;
}

.wf-step-del:active {
    color: #e63946;
}

.wptm-step-add-btn {
    display: block;
    width: 100%;
    padding: 10px;
    border: 1.5px dashed #ccc;
    border-radius: 10px;
    background: transparent;
    color: #4361ee;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.wptm-step-add-btn:active {
    background: #f0f2ff;
    border-color: #4361ee;
}

/* ===== スコア ===== */
.wptm-score-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: #4361ee;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
}

/* ===== トグルボタン ===== */
.wptm-toggle-btns {
    display: flex;
    gap: 8px;
}

.wptm-toggle-btn {
    flex: 1;
    padding: 10px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.wptm-toggle-btn.active {
    background: #4361ee;
    color: #fff;
    border-color: #4361ee;
}

/* ===== サマリー ===== */
.wptm-form-summary {
    background: #f0f2ff;
    border-radius: 12px;
    padding: 12px 16px;
    margin: 8px 0 16px;
}

.wptm-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
    color: #555;
}

.wptm-summary-row span:last-child {
    font-weight: 700;
    color: #1a1a2e;
}

/* ===== 送信ボタン ===== */
.wptm-submit-btn {
    width: 100%;
    padding: 14px;
    background: #4361ee;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.wptm-submit-btn:active {
    opacity: 0.8;
}

.wptm-submit-btn:disabled {
    opacity: 0.5;
}

/* ===== 登録完了画面 ===== */
.wptm-result-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.wptm-result-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.wptm-result-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.wptm-result-info {
    font-size: 14px;
    color: #666;
}

.wptm-result-info div {
    margin-bottom: 4px;
}

.wptm-result-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wptm-btn-primary {
    width: 100%;
    padding: 14px;
    background: #4361ee;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.wptm-btn-secondary {
    width: 100%;
    padding: 14px;
    background: #f0f0f0;
    color: #666;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== スケジュール警告 ===== */
.wptm-schedule-alert {
    background: #fff3cd;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.wptm-schedule-alert-title {
    font-size: 15px;
    font-weight: 700;
    color: #856404;
    margin-bottom: 8px;
}

.wptm-schedule-alert-item {
    font-size: 13px;
    color: #856404;
    padding: 4px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.wptm-schedule-alert-item:last-of-type {
    border-bottom: none;
}

.wptm-ai-consult-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    background: #4361ee;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== AIチャット ===== */
.wptm-ai-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

.wptm-ai-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 200px;
}

.wptm-ai-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.wptm-ai-user {
    align-self: flex-end;
    background: #4361ee;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.wptm-ai-assistant {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.wptm-ai-input-row {
    display: flex;
    gap: 8px;
    position: sticky;
    bottom: 0;
    background: #f5f5fa;
    padding: 8px 0;
}

.wptm-ai-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 20px;
    font-size: 16px !important;
    -webkit-appearance: none;
}

.wptm-ai-input:focus {
    outline: none;
    border-color: #4361ee;
}

.wptm-ai-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #4361ee;
    color: #fff;
    border: none;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.wptm-ai-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
}

.wptm-ai-choice-btn {
    padding: 8px 14px;
    border: 1.5px solid #4361ee;
    border-radius: 20px;
    background: #fff;
    color: #4361ee;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.wptm-ai-choice-btn.selected {
    background: #4361ee;
    color: #fff;
}

.wptm-ai-choice-btn:disabled {
    opacity: 0.4;
}

.wptm-back-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: #4361ee;
    cursor: pointer;
    padding: 4px 8px;
}

/* iOS zoom prevention */
input, select, textarea, button {
    font-size: 16px !important;
    touch-action: manipulation;
}
