/* DTD Consult — Portal CSS */
:root {
    --g:    #1a6b3a;
    --g2:   #e8f5e9;
    --g3:   #4caf50;
    --bd:   #e0e0e0;
    --rad:  10px;
    --shd:  0 2px 10px rgba(0,0,0,.07);
}

/* ===== WRAP ===== */
.dtdc-wrap {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 0 60px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: #333;
}

/* ===== HEADER ===== */
.dtdc-header {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--g);
    color: #fff;
    padding: 18px 24px;
    border-radius: var(--rad) var(--rad) 0 0;
}
.dtdc-header h1 { margin: 0 0 4px; font-size: 19px; }
.dtdc-header p  { margin: 0; opacity: .8; font-size: 13px; }
.dtdc-header-avatar img { border-radius: 50%; border: 3px solid rgba(255,255,255,.35); }
.dtdc-header-info { flex: 1; }
.dtdc-logout {
    color: #fff;
    opacity: .8;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.4);
    padding: 5px 12px;
    border-radius: 20px;
    white-space: nowrap;
}
.dtdc-logout:hover { opacity: 1; }

/* ===== TABS ===== */
.dtdc-tabs {
    display: flex;
    border-bottom: 2px solid var(--bd);
    background: #fff;
    border-left: 1px solid var(--bd);
    border-right: 1px solid var(--bd);
}
.dtdc-tab {
    flex: 1; padding: 13px 16px;
    background: none; border: none; cursor: pointer;
    font-size: 14px; color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all .2s;
}
.dtdc-tab.active { color: var(--g); border-bottom-color: var(--g); font-weight: 600; }
.dtdc-tab:hover  { background: var(--g2); }

/* ===== PANES ===== */
.dtdc-pane { display: none; }
.dtdc-pane.active { display: block; }

/* ===== CARDS ===== */
.dtdc-card {
    background: #fff;
    border: 1px solid var(--bd);
    border-top: none;
    padding: 22px 24px;
}
.dtdc-card:last-child { border-radius: 0 0 var(--rad) var(--rad); }

.dtdc-card-title {
    margin: 0 0 16px;
    font-size: 15px;
    color: var(--g);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--g2);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.dtdc-required-note { font-size: 12px; font-weight: normal; color: #999; }
.dtdc-optional { font-size: 12px; font-weight: normal; color: #aaa; }

/* ===== FIELDS ===== */
.dtdc-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.dtdc-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width:640px) {
    .dtdc-grid-3, .dtdc-grid-2 { grid-template-columns: 1fr; }
}

.dtdc-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.dtdc-field label { font-size: 13px; font-weight: 600; color: #555; }
.dtdc-field input, .dtdc-field select, .dtdc-field textarea {
    border: 1.5px solid var(--bd);
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color .2s;
}
.dtdc-field input:focus, .dtdc-field select:focus, .dtdc-field textarea:focus {
    outline: none;
    border-color: var(--g);
    box-shadow: 0 0 0 3px rgba(26,107,58,.1);
}
.req  { color: #e53e3e; }
.hint { font-size: 11px; color: #aaa; }
.unit { font-size: 11px; background: #f0f0f0; padding: 1px 5px; border-radius: 3px; color: #777; }

/* ===== BMI ===== */
.dtdc-bmi-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px; align-items: end; }
@media (max-width:520px) { .dtdc-bmi-row { grid-template-columns: 1fr 1fr; } }
.dtdc-bmi-box {
    background: var(--g2);
    border: 2px solid var(--g);
    border-radius: 8px;
    padding: 10px 16px;
    text-align: center;
    min-width: 110px;
}
.dtdc-bmi-label { font-size: 10px; font-weight: 700; color: var(--g); text-transform: uppercase; letter-spacing: 1px; }
.dtdc-bmi-val   { font-size: 26px; font-weight: 800; color: var(--g); line-height: 1.2; }
.dtdc-bmi-cat   { font-size: 11px; font-weight: 600; margin-top: 2px; }
.bmi-t { color: #f57c00; } .bmi-n { color: #388e3c; } .bmi-o { color: #f57c00; } .bmi-ob { color: #d32f2f; }

/* ===== DROPZONE ===== */
.dtdc-dropzone {
    border: 2px dashed var(--bd);
    border-radius: 8px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    background: #fafafa;
    transition: all .2s;
}
.dtdc-dropzone:hover, .dtdc-dropzone.over { border-color: var(--g); background: var(--g2); }
.dtdc-drop-icon { font-size: 32px; margin-bottom: 6px; }
.dtdc-drop-hint { font-size: 12px; color: #aaa; margin: 4px 0 0; }
.dtdc-pick { color: var(--g); font-weight: 600; cursor: pointer; text-decoration: underline; }
#dtdc-file-list { margin-top: 10px; }
.dtdc-fi {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 12px; background: #fff;
    border: 1px solid var(--bd); border-radius: 5px; margin-bottom: 5px; font-size: 13px;
}
.dtdc-fi-rm { margin-left: auto; background: none; border: none; color: #e53e3e; cursor: pointer; font-size: 16px; }

/* ===== SUBMIT ===== */
.dtdc-submit-bar {
    background: #fff;
    border: 1px solid var(--bd);
    border-top: none;
    padding: 18px 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    border-radius: 0 0 var(--rad) var(--rad);
}
.dtdc-btn-primary {
    background: var(--g); color: #fff;
    padding: 12px 26px; border: none;
    border-radius: 6px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: background .2s;
}
.dtdc-btn-primary:hover { background: #155730; }
.dtdc-btn-primary:disabled { background: #aaa; cursor: not-allowed; }
.dtdc-msg {
    width: 100%; margin-bottom: 12px;
    padding: 11px 14px; border-radius: 6px; font-size: 14px;
}
.dtdc-msg.ok  { background: var(--g2); color: #2e7d32; border: 1px solid #a5d6a7; }
.dtdc-msg.err { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }

/* ===== HISTORY ===== */
.dtdc-empty { text-align: center; padding: 48px 20px; background: #fff; border: 1px solid var(--bd); border-top: none; border-radius: 0 0 var(--rad) var(--rad); color: #999; }

.dtdc-history-card {
    background: #fff;
    border: 1px solid var(--bd);
    border-top: none;
    overflow: hidden;
}
.dtdc-history-card:first-child { border-top: 1px solid var(--bd); }
.dtdc-history-card:last-child  { border-radius: 0 0 var(--rad) var(--rad); }

.dtdc-hcard-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px; cursor: pointer;
    background: #fafafa; transition: background .2s;
}
.dtdc-hcard-header:hover { background: var(--g2); }
.dtdc-hcard-meta  { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.dtdc-hdate  { font-size: 13px; font-weight: 600; }
.dtdc-hbmi   { font-size: 12px; color: #555; }
.dtdc-hvitals{ font-size: 12px; color: #e53935; font-weight: 600; }
.dtdc-chevron { font-size: 11px; color: #aaa; transition: transform .2s; margin-left: 8px; }
.dtdc-history-card.open .dtdc-chevron { transform: rotate(180deg); }

.dtdc-badge {
    padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.dtdc-badge.answered { background: var(--g2); color: #2e7d32; }
.dtdc-badge.pending  { background: #fff8e1; color: #f57f17; }

.dtdc-hcard-body { display: none; padding: 18px 20px; border-top: 1px solid var(--bd); }
.dtdc-history-card.open .dtdc-hcard-body { display: block; }

.dtdc-info-row { margin-bottom: 12px; font-size: 14px; line-height: 1.6; }
.dtdc-info-row b { color: #555; }
.dtdc-highlight { background: var(--g2); border-left: 4px solid var(--g); padding: 10px 14px; border-radius: 4px; }
.dtdc-dim { color: #888; font-size: 13px; }

.dtdc-filelist { margin: 6px 0 0; padding: 0; list-style: none; }
.dtdc-filelist a { color: var(--g); font-size: 13px; text-decoration: none; }
.dtdc-filelist a:hover { text-decoration: underline; }

/* ===== TRAO ĐỔI ===== */
.dtdc-discuss { margin-top: 18px; border: 1px solid var(--bd); border-radius: 8px; overflow: hidden; }
.dtdc-discuss-title { background: #f5f5f5; padding: 10px 16px; font-size: 13px; font-weight: 700; color: #555; border-bottom: 1px solid var(--bd); }
.dtdc-comments { padding: 14px; display: flex; flex-direction: column; gap: 10px; max-height: 400px; overflow-y: auto; }
.dtdc-comment { padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.6; max-width: 85%; }
.dtdc-comment.from-doctor  { background: var(--g2); border: 1px solid #c8e6c9; align-self: flex-start; border-bottom-left-radius: 3px; }
.dtdc-comment.from-patient { background: #e3f2fd; border: 1px solid #bbdefb; align-self: flex-end; border-bottom-right-radius: 3px; }
.dtdc-comment-meta { display: flex; justify-content: space-between; font-size: 11px; color: #888; margin-bottom: 6px; }
.dtdc-comment-meta span:first-child { font-weight: 700; color: #444; }
.dtdc-no-reply { padding: 14px 16px; color: #999; font-style: italic; font-size: 13px; }
.dtdc-reply-link { padding: 14px 16px; }
.dtdc-btn-reply {
    display: inline-block; background: var(--g); color: #fff;
    padding: 9px 18px; border-radius: 6px; font-size: 14px;
    font-weight: 600; text-decoration: none;
}
.dtdc-btn-reply:hover { background: #155730; color: #fff; }

/* ===== ADDITIONS ===== */
.dtdc-count { background:#e53e3e;color:#fff;font-size:11px;padding:1px 6px;border-radius:10px;margin-left:4px; }
.dtdc-req-note { font-size:12px;font-weight:normal;color:#999;margin-left:6px; }
.dtdc-opt { font-size:12px;font-weight:normal;color:#bbb;margin-left:6px; }

/* Grid span */
.dtdc-field.span2 { grid-column: span 2; }
@media(max-width:640px){ .dtdc-field.span2 { grid-column: span 1; } }

/* History cards */
.dtdc-hcard { background:#fff;border:1px solid var(--bd);border-top:none; }
.dtdc-hcard:first-child { border-top:1px solid var(--bd); }
.dtdc-hcard:last-child  { border-radius:0 0 var(--rad) var(--rad); }

.dtdc-hcard-hdr {
    display:flex;justify-content:space-between;align-items:center;
    padding:14px 18px;cursor:pointer;background:#fafafa;
    transition:background .2s;user-select:none;
}
.dtdc-hcard-hdr:hover { background:var(--g2); }
.dtdc-hcard.open .dtdc-chevron { transform:rotate(180deg); }

.dtdc-hcard-meta { display:flex;gap:12px;align-items:center;flex-wrap:wrap; }
.dtdc-hdate  { font-size:13px;font-weight:600; }
.dtdc-hname  { font-size:13px;font-weight:700;color:#333; }
.dtdc-hdim   { font-size:12px;color:#888; }
.dtdc-hbmi   { font-size:12px;background:#e8f5e9;padding:2px 8px;border-radius:10px;color:#2e7d32; }
.dtdc-chevron { font-size:11px;color:#aaa;transition:transform .2s; }
.dtdc-badge  { padding:3px 10px;border-radius:20px;font-size:12px;font-weight:600; }
.dtdc-badge.ok   { background:#e8f5e9;color:#2e7d32; }
.dtdc-badge.wait { background:#fff8e1;color:#f57f17; }

.dtdc-hcard-body { display:none;padding:16px 18px;border-top:1px solid var(--bd); }
.dtdc-hcard.open .dtdc-hcard-body { display:block; }

.dtdc-info { margin-bottom:10px;font-size:14px;line-height:1.6; }
.dtdc-info b { color:#555; }
.dtdc-info-hl { background:var(--g2);border-left:4px solid var(--g);padding:10px 14px;border-radius:4px;margin-bottom:12px; }

/* Thread */
.dtdc-thread { margin-top:14px;border:1px solid var(--bd);border-radius:8px;overflow:hidden; }
.dtdc-thread-title { background:#f5f5f5;padding:9px 14px;font-size:13px;font-weight:700;color:#555;border-bottom:1px solid var(--bd); }
.dtdc-messages { padding:12px;display:flex;flex-direction:column;gap:8px;max-height:380px;overflow-y:auto; }
.dtdc-msg-bubble { max-width:82%;padding:10px 13px;border-radius:10px;font-size:13px;line-height:1.6; }
.dtdc-msg-bubble.doc { background:var(--g2);border:1px solid #c8e6c9;align-self:flex-start;border-bottom-left-radius:3px; }
.dtdc-msg-bubble.pat { background:#e3f2fd;border:1px solid #bbdefb;align-self:flex-end;border-bottom-right-radius:3px; }
.dtdc-msg-meta { display:flex;justify-content:space-between;font-size:11px;color:#999;margin-bottom:5px;gap:10px; }
.dtdc-msg-meta span:first-child { font-weight:700;color:#444; }
.dtdc-no-reply { padding:12px 14px;color:#aaa;font-style:italic;font-size:13px; }

/* Reply form bệnh nhân */
.dtdc-reply-form { border-top:1px solid var(--bd);padding:12px 14px;background:#fafafa; }
.dtdc-reply-form textarea {
    width:100%;box-sizing:border-box;border:1.5px solid var(--bd);border-radius:6px;
    padding:9px 12px;font-size:13px;font-family:inherit;resize:vertical;
    transition:border-color .2s;
}
.dtdc-reply-form textarea:focus { outline:none;border-color:#2196f3;box-shadow:0 0 0 3px rgba(33,150,243,.1); }
.dtdc-reply-actions { display:flex;justify-content:space-between;align-items:center;margin-top:8px; }
.dtdc-reply-status { font-size:12px; }
.dtdc-btn-reply {
    background:#2196f3;color:#fff;padding:7px 16px;border:none;
    border-radius:5px;font-size:13px;font-weight:600;cursor:pointer;
}
.dtdc-btn-reply:hover { background:#1976d2; }
.dtdc-btn-reply:disabled { background:#aaa;cursor:not-allowed; }

/* Notice (chưa đăng nhập) */
.dtdc-notice { padding:14px 18px;background:#fff8e1;border-left:4px solid #ffc107;border-radius:4px;font-size:14px; }
.dtdc-notice a { color:var(--g);font-weight:600; }

/* Nút xóa trong lịch sử bệnh nhân */
.dtdc-del-btn {
    background: none;
    border: 1px solid #e53e3e;
    color: #e53e3e;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 13px;
    cursor: pointer;
    line-height: 1.4;
    transition: all .2s;
    flex-shrink: 0;
}
.dtdc-del-btn:hover {
    background: #e53e3e;
    color: #fff;
}
