/* Task Detail Page - Complete Redesign */

.task-page { width: 100%; max-width: none; margin: 0; padding: 2px 2px; }
@media (max-width: 900px) { .task-page { padding: 18px; } }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 700; text-decoration: none; transition: color 0.15s; }
.back-link:hover { color: var(--ink); }
.back-link svg { flex-shrink: 0; }

.task-hero { border-radius: 18px; border: 1px solid var(--stroke); background: var(--c-white); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.task-hero.has-photo { background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.98) 60%, rgba(255,255,255,1) 100%), var(--hero-photo); background-size: cover; background-position: center; }
.task-hero-top { display:flex; justify-content: space-between; align-items:center; gap: 12px; }
.task-hero-main { margin-top: 12px; }

.task-hero-chips { display:flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.chip { display:inline-flex; align-items:center; gap: 8px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--stroke); background: rgba(255,255,255,0.75); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font-size: 13px; font-weight: 700; color: var(--ink); }
.chip-icon { width: 16px; height: 16px; stroke: var(--c-caramel); flex-shrink: 0; }

.task-status-pill { padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.task-status-pill.open { background: #e8f5e9; color: #2e7d32; }
.task-status-pill.in_progress { background: #fff3e0; color: #ef6c00; }
.task-status-pill.completed { background: #e3f2fd; color: #1565c0; }
.task-status-pill.closed { background: var(--glass-50); color: var(--muted); }

.task-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 2px; align-items: start; }
@media (max-width: 1000px) { .task-layout { grid-template-columns: 1fr; } }

/* Main Content */
.task-main { display: flex; flex-direction: column; gap: 20px; }

.task-card { background: var(--c-white); border: 1px solid var(--stroke); border-radius: 18px; padding: 22px; box-shadow: var(--shadow-sm); }
.task-card.task-card-chat { padding: 0; overflow: hidden; }

.task-title { font-family: var(--font-display); font-size: 30px; font-weight: 800; color: var(--ink); margin: 0; line-height: 1.15; letter-spacing: -0.5px; }

.task-section-title { font-size: 12px; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; margin: 0 0 12px; }

.task-meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 600px) { .task-meta-grid { grid-template-columns: 1fr; } }

.meta-item { padding: 14px 14px; background: var(--glass-50); border-radius: 12px; font-size: 14px; color: var(--ink); border: 1px solid transparent; }
.meta-item:hover { border-color: var(--stroke); }
.meta-k { font-size: 11px; font-weight: 900; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.meta-v { font-size: 15px; font-weight: 800; color: var(--ink); }

.task-description { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--stroke); }
.task-description p { font-size: 15px; line-height: 1.7; color: var(--ink); margin: 0; white-space: pre-wrap; }

.task-photos { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--stroke); }
.photo-thumb { width: 100px; height: 100px; border-radius: 10px; overflow: hidden; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
.photo-thumb:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Sidebar */
.task-sidebar { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 20px; }
@media (max-width: 900px) { .task-sidebar { position: static; } }

.sidebar-card { background: var(--c-white); border: 1px solid var(--stroke); border-radius: 18px; padding: 18px; box-shadow: var(--shadow-sm); }
.sidebar-card:empty { display: none; }

.card-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }
.card-text { font-size: 14px; color: var(--ink); line-height: 1.5; margin: 0 0 16px; }
.card-text.muted { color: var(--muted); }

.sidebar-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Buttons */
.btn-primary, .btn-secondary, .btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.15s; border: none; text-decoration: none; }
/* Caramel + white was 3.6:1 — fail. Espresso + white is 8.5:1. */
.btn-primary { background: var(--c-espresso); color: var(--c-white); }
.btn-primary:hover { background: var(--c-accent-dark); }
.btn-secondary { background: var(--glass-50); color: var(--ink); border: 1px solid var(--stroke); }
.btn-secondary:hover { background: var(--card2); border-color: var(--c-espresso); }
/* Ghost buttons used --muted (low-contrast intentional). Use --ink so they
   are readable; hover slightly tints background. */
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { color: var(--ink); background: var(--glass-50); }
.btn-ghost.danger { color: #c62828; }
.btn-ghost.danger:hover { background: #ffebee; }
.btn-primary.full, .btn-secondary.full, .btn-ghost.full { width: 100%; }
.btn-primary.small, .btn-secondary.small, .btn-ghost.small { padding: 8px 14px; font-size: 13px; }

/* Person Card */
.person-card { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.person-avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--c-caramel), var(--c-espresso)); color: var(--c-white); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; overflow: hidden; flex-shrink: 0; }
.person-avatar.large { width: 56px; height: 56px; font-size: 20px; }
.person-avatar.small { width: 32px; height: 32px; font-size: 13px; }
.person-avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-info { display: flex; flex-direction: column; gap: 4px; }
.person-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.person-vouches { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--c-caramel); font-weight: 600; }
.person-vouches svg { fill: var(--c-caramel); }

/* Applicants List */
.applicants-list { display: flex; flex-direction: column; gap: 14px; }
.applicant-card { padding: 16px; background: var(--glass-50); border-radius: 12px; border: 1px solid transparent; transition: border-color 0.15s; }
.applicant-card:hover { border-color: var(--c-caramel); }
.applicant-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.applicant-info { display: flex; flex-direction: column; gap: 2px; }
.applicant-message { font-size: 13px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; background: var(--c-white); padding: 10px 12px; border-radius: 8px; }
.applicant-actions { display: flex; gap: 8px; }

/* Empty State */
.empty-state { text-align: center; padding: 24px 16px; }
.empty-state svg { stroke: var(--muted); margin-bottom: 12px; }
.empty-state p { font-size: 15px; font-weight: 600; color: var(--ink); margin: 0 0 4px; }
.empty-state span { font-size: 13px; color: var(--muted); }

/* Request Status */
.request-status { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 10px; margin-bottom: 14px; }
.request-status.success { background: #e8f5e9; color: #2e7d32; }
.request-status svg { flex-shrink: 0; }
.request-status span { font-weight: 700; }

.request-textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--stroke); border-radius: 10px; font-size: 14px; font-family: inherit; resize: vertical; margin-bottom: 12px; transition: border-color 0.15s; }
.request-textarea:focus { outline: none; border-color: var(--c-caramel); }

/* Assignment Banner */
.assignment-banner { display: flex; align-items: center; gap: 14px; padding: 16px; background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); border-radius: 12px; margin-bottom: 16px; }
.assignment-banner svg { stroke: #2e7d32; flex-shrink: 0; }
.assignment-banner strong { display: block; font-size: 15px; color: #1b5e20; }
.assignment-banner span { font-size: 13px; color: #2e7d32; }

.notes-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--stroke); }

/* Status Notice */
.status-notice { display: flex; align-items: center; gap: 10px; padding: 14px; background: var(--glass-50); border-radius: 10px; font-size: 14px; color: var(--muted); }
.status-notice.completed { background: #e3f2fd; color: #1565c0; }
.status-notice svg { flex-shrink: 0; }

/* Chat Container */
.chat-container { border: 1px solid var(--stroke); border-radius: 12px; overflow: hidden; background: var(--c-white); }
.task-card.task-card-chat .chat-container { border: none; border-radius: 18px; }

.chat-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: var(--card2); border-bottom: 1px solid var(--stroke); }
.chat-header-info { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; color: var(--ink); }
.chat-status { font-size: 12px; color: var(--muted); }

.chat-messages { height: 320px; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: #fafafa; }
.chat-loading, .chat-empty, .chat-error { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 100%; color: var(--muted); font-size: 14px; }
.chat-loading svg { stroke: var(--c-caramel); }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

.chat-message { display: flex; flex-direction: column; max-width: 80%; }
.chat-message.me { align-self: flex-end; align-items: flex-end; }
.chat-message.them { align-self: flex-start; align-items: flex-start; }
.message-bubble { padding: 12px 16px; border-radius: 18px; font-size: 14px; line-height: 1.5; word-wrap: break-word; }
/* Caramel + white was 3.6:1 — fail. Espresso + white is 8.5:1. */
.chat-message.me .message-bubble { background: var(--c-espresso); color: var(--c-white); border-bottom-right-radius: 6px; }
.chat-message.them .message-bubble { background: var(--c-white); color: var(--ink); border: 1px solid var(--stroke); border-bottom-left-radius: 6px; }
.message-time { font-size: 11px; color: var(--muted); margin-top: 4px; padding: 0 4px; }

.chat-input { display: flex; align-items: flex-end; gap: 10px; padding: 14px 18px; background: var(--c-white); border-top: 1px solid var(--stroke); }
#chat-input-field { flex: 1; padding: 12px 16px; border: 1px solid var(--stroke); border-radius: 24px; font-size: 14px; font-family: inherit; resize: none; max-height: 120px; transition: border-color 0.15s; }
#chat-input-field:focus { outline: none; border-color: var(--c-caramel); }
/* Caramel + white = 3.6:1 (fail). Espresso + white = 8.5:1. */
.chat-send-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--c-espresso); color: var(--c-white); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s, transform 0.1s; }
.chat-send-btn:hover { background: var(--c-accent-dark); transform: scale(1.04); }
.chat-send-btn:active { transform: scale(0.96); }

/* Agreement Info */
.agreement-info { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--stroke); }

.action-card { padding: 16px; background: var(--glass-50); border-radius: 12px; }
.action-card.payment { background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%); }
.action-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.action-header svg { stroke: var(--c-caramel); flex-shrink: 0; }
.action-header strong { font-size: 15px; color: var(--ink); }
.action-card p { font-size: 13px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.price-display { font-size: 24px; font-weight: 800; color: var(--c-espresso); margin-bottom: 16px; }

.info-row { display: flex; flex-direction: column; gap: 4px; padding: 12px; background: var(--glass-50); border-radius: 10px; margin-bottom: 12px; }
.info-row.highlight { background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); }
.info-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.info-value { font-size: 14px; color: var(--ink); font-weight: 600; }

.form-input { width: 100%; padding: 12px 14px; border: 1px solid var(--stroke); border-radius: 10px; font-size: 14px; margin-bottom: 12px; transition: border-color 0.15s; }
.form-input:focus { outline: none; border-color: var(--c-caramel); }

.status-badge { display: inline-block; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 700; }
.status-badge.completed { background: #e8f5e9; color: #2e7d32; }

.success-text { font-size: 13px; color: #2e7d32; font-weight: 600; margin: 0; }

/* Not Found */
.task-not-found { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 80px 20px; }
.task-not-found svg { stroke: var(--muted); margin-bottom: 20px; }
.task-not-found h2 { font-size: 22px; font-weight: 800; color: var(--ink); margin: 0 0 8px; }
.task-not-found p { font-size: 15px; color: var(--muted); margin: 0 0 24px; }
