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

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
        "Noto Sans JP", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ─── ナビ ─── */
.navbar {
    background: var(--primary);
    color: white;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.nav-brand { font-size: 18px; font-weight: 700; }
.nav-links { display: flex; gap: 16px; }
.nav-link {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background 0.2s;
}
.nav-link:hover { background: rgba(255,255,255,0.15); color: white; }
.nav-logout { color: rgba(255,255,255,0.6); }

/* ─── コンテナ ─── */
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* ─── ログイン ─── */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #f8fafc;
}
.login-card {
    background: var(--card);
    padding: 48px 40px 36px;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 400px;
    text-align: center;
    margin: 16px;
}
.login-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    background: #eff6ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card h1 {
    text-align: center;
    margin-bottom: 4px;
    font-size: 22px;
    color: var(--text);
}
.login-subtitle {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 28px;
}
.input-with-icon {
    position: relative;
}
.input-with-icon svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}
.input-with-icon input {
    padding-left: 40px !important;
}
.btn-login {
    margin-top: 8px;
    padding: 13px;
    font-size: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}
.btn-login:hover {
    box-shadow: 0 6px 16px rgba(37,99,235,0.4);
    transform: translateY(-1px);
}
.login-footer {
    margin-top: 24px;
    font-size: 12px;
    color: #cbd5e1;
    letter-spacing: 1px;
}

/* ─── フォーム ─── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
.form-group input, .form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.hint { font-size: 12px; color: var(--text-light); margin-top: 4px; display: block; }

/* ─── ボタン ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #475569; color: white; }
.btn-secondary:hover { background: #334155; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; padding: 12px; }

/* ─── 日付ピッカー ─── */
.date-picker-row {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-bottom: 8px;
}
.date-picker-row input[type="date"] {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
}

/* ─── タブ ─── */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}
.tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover { color: var(--text); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── パネル ─── */
.panel {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}
.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-header h2 { font-size: 16px; }
.header-actions { display: flex; gap: 8px; }

/* ─── 割り振りレイアウト ─── */
.assign-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ─── イベントカード ─── */
.event-list { padding: 12px; display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow-y: auto; }
.event-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    transition: box-shadow 0.2s;
}
.event-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.event-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.event-meta { font-size: 13px; color: var(--text-light); margin-bottom: 4px; }
.event-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0;
}
.attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}
.attachment-link:hover { background: #fde68a; }
.event-desc {
    font-size: 13px;
    color: var(--text-light);
    margin: 8px 0;
    white-space: pre-wrap;
}
.event-assign-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.event-assign-row select {
    flex: 1;
    min-width: 120px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}
.assigned-workers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.worker-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #dbeafe;
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.worker-tag .remove {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.6;
}
.worker-tag .remove:hover { opacity: 1; }
.tag-none { background: #f1f5f9; color: #64748b; }

/* ─── 取り消し選択 ─── */
.recall-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.recall-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}
.recall-item:hover { background: #fef2f2; }
.recall-item input { width: 18px; height: 18px; cursor: pointer; }

/* ─── 割り振りサマリー ─── */
.assignment-summary { padding: 12px; max-height: 70vh; overflow-y: auto; }
.comment-section {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border);
}
.comment-section label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
}
.comment-section textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}
.comment-section textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.worker-group {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.worker-group-header {
    font-weight: 700;
    font-size: 15px;
    padding: 10px 14px;
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.worker-group-count {
    font-size: 12px;
    font-weight: 600;
    background: rgba(255,255,255,0.25);
    padding: 2px 8px;
    border-radius: 10px;
}
.summary-event-card {
    padding: 12px 14px;
    border-bottom: 2px solid #94a3b8;
}
.summary-event-card:last-of-type { border-bottom: none; }
.summary-event-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
.summary-event-info { flex: 1; min-width: 0; }
.summary-event-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 2px;
}
.summary-event-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}
.summary-event-desc {
    font-size: 12px;
    color: var(--text-light);
    white-space: pre-wrap;
    margin-top: 4px;
    line-height: 1.5;
}
.remove-summary {
    cursor: pointer;
    color: var(--danger);
    font-size: 20px;
    opacity: 0.3;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}
.remove-summary:hover { opacity: 1; }
.worker-comment {
    margin: 6px 8px 0;
}
.worker-comment textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}
.worker-comment textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

/* ─── 職人リスト ─── */
.worker-list { padding: 12px; }
.worker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.worker-row:last-child { border-bottom: none; }
.worker-info { flex: 1; }
.worker-name { font-weight: 600; font-size: 15px; }
.worker-discord { font-size: 12px; color: var(--text-light); }
.worker-actions { display: flex; gap: 6px; }

/* ─── カレンダーリスト ─── */
.calendar-list { padding: 12px; }
.calendar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.calendar-row:last-child { border-bottom: none; }
.calendar-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.calendar-name { flex: 1; font-size: 14px; }

/* ─── モーダル ─── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background: var(--card);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.15);
}
.modal-content h3 { margin-bottom: 20px; font-size: 18px; }
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ─── バッジ ─── */
.badge {
    background: var(--primary);
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ─── アラート ─── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

/* ─── プレースホルダー ─── */
.placeholder { text-align: center; color: var(--text-light); padding: 40px 20px; font-size: 14px; }
.done-message { color: var(--success); font-weight: 600; }

/* ─── 送信結果 ─── */
.send-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--border);
}
.send-result-item:last-child { border-bottom: none; }
.result-icon { font-size: 18px; }
.result-success .result-icon { color: var(--success); }
.result-fail .result-icon { color: var(--danger); }
.result-name { font-weight: 600; flex: 1; }
.result-error { font-size: 12px; color: var(--danger); }

/* ─── トグルスイッチ ─── */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ─── ガイド ─── */
.guide { max-width: 800px; margin: 0 auto; }
.guide h1 { font-size: 22px; margin-bottom: 24px; }
.guide-step {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.step-number {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}
.step-content { flex: 1; }
.step-content h2 { font-size: 16px; margin-bottom: 8px; }
.step-content p { font-size: 14px; color: var(--text); line-height: 1.7; margin-bottom: 8px; }
.step-content ul { font-size: 14px; color: var(--text); line-height: 1.8; padding-left: 20px; }
.guide-section {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.guide-section h2 { font-size: 16px; margin-bottom: 10px; color: var(--primary); }
.guide-section ul { font-size: 14px; line-height: 1.8; padding-left: 20px; }

/* ─── 職人ステータスバー ─── */
.worker-status-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: var(--card);
    border-radius: var(--radius);
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.status-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.status-off {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.status-available {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* ─── レスポンシブ ─── */
@media (max-width: 900px) {
    .assign-layout { grid-template-columns: 1fr; }
    .container { padding: 12px; }
    .date-picker-row { flex-wrap: wrap; }
}
