/* ===========================================
 * Xem Tuổi Hợp Nhau (UNIFIED v0.45.1)
 * 1 shortcode [xem_tuoi_hop_nhau], 2 mode:
 *   - LOOKUP: bảng 12 con giáp khi B trống
 *   - COUPLE: phân tích chi tiết khi có cả A + B
 * Prefix duy nhất: .xthn-*
 * Style: kế thừa convention xem-tuoi.css (Be Vietnam Pro, brand #7b1414 / #b8860b)
 * =========================================== */

.xthn-wrap {
    max-width: 1080px;
    margin: 32px auto;
    font-family: var(--tvq-font-body, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    color: #2c1810;
    line-height: 1.6;
}

/* ===== FORM ===== */
.xthn-form {
    background: #fff;
    border: 1px solid #d4a865;
    border-radius: 10px;
    padding: 28px 32px;
    box-shadow: 0 4px 20px rgba(184, 134, 11, 0.12);
}
.xthn-title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    color: #7b1414;
    border-bottom: 2px solid #d4a865;
    padding-bottom: 8px;
}
.xthn-intro {
    margin: 0 0 20px;
    font-size: 14px;
    color: #5a4a3a;
}
.xthn-required { color: #c33; font-weight: 700; }

.xthn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 16px 0 20px;
}
@media (max-width: 600px) {
    .xthn-grid { grid-template-columns: 1fr; }
}
.xthn-person {
    background: linear-gradient(180deg, #fdf8eb 0%, #faf0d6 100%);
    border: 1px solid #c8a865;
    border-radius: 8px;
    padding: 16px 18px;
    margin: 0;
}
.xthn-person-optional {
    background: linear-gradient(180deg, #f8f5ed 0%, #f0ebda 100%);
    border-style: dashed;
}
.xthn-person legend {
    padding: 0 8px;
    font-size: 15px;
    font-weight: 700;
    color: #7b1414;
}
.xthn-required-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    font-size: 10px;
    background: #c33;
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
}
.xthn-optional-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    font-size: 10px;
    background: #6b7280;
    color: #fff;
    border-radius: 10px;
    font-weight: 500;
}

.xthn-field { margin-bottom: 12px; }
.xthn-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #2c1810;
    margin-bottom: 4px;
}
.xthn-label small { color: #888; font-weight: 400; }

.xthn-input, .xthn-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #c8a865;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
}
.xthn-select:focus, .xthn-input:focus {
    outline: none;
    border-color: #7b1414;
    box-shadow: 0 0 0 2px rgba(123, 20, 20, 0.15);
}

.xthn-type-field { margin: 12px 0 20px; }
.xthn-type-select { font-size: 15px; font-weight: 600; }
.xthn-type-hint { display: block; margin-top: 4px; color: #888; font-size: 12px; font-style: italic; }

.xthn-radio-inline { display: flex; gap: 16px; }
.xthn-radio {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    cursor: pointer;
}

.xthn-submit {
    display: block;
    margin: 16px 0 0;
    padding: 12px 28px;
    background: #7b1414;
    color: #fff;
    border: 0;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
}
.xthn-submit:hover { background: #5a0e0e; }

.xthn-error {
    margin: 16px 0;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    color: #991b1b;
}

/* ===== RESULT (chung) ===== */
.xthn-result {
    margin-top: 28px;
    background: #fff;
    border: 1px solid #d4a865;
    border-radius: 10px;
    padding: 24px 28px;
    box-shadow: 0 4px 20px rgba(184, 134, 11, 0.12);
}

/* ===== COUPLE MODE — header + verdict ===== */
.xthn-result-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 2px solid #d4a865;
}
.xthn-rel-type {
    background: #b8860b;
    color: #fff;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
}
.xthn-names { font-size: 18px; color: #2c1810; }
.xthn-vs { margin: 0 8px; color: #b8860b; font-weight: 700; }
.xthn-score { color: #7b1414; font-weight: 700; }
.xthn-score-num { font-size: 36px; }
.xthn-score-max { font-size: 16px; color: #999; }

.xthn-verdict-bar {
    background: linear-gradient(180deg, #fff7e6 0%, #fdf2e1 100%);
    border-left: 4px solid #b8860b;
    padding: 14px 18px;
    margin-bottom: 18px;
    border-radius: 0 8px 8px 0;
}
.xthn-headline { margin: 4px 0 6px; font-size: 16px; color: #7b1414; }
.xthn-verdict-text { margin: 0; color: #5a4a3a; }

.xthn-level-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}
.xthn-level-dai-cat    { background: #047857; }
.xthn-level-trung-cat  { background: #15803d; }
.xthn-level-binh       { background: #6b7280; }
.xthn-level-trung-hung { background: #d97706; }
.xthn-level-dai-hung   { background: #b91c1c; }

/* ===== Persons summary ===== */
.xthn-persons-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
@media (max-width: 600px) {
    .xthn-persons-summary { grid-template-columns: 1fr; }
}
.xthn-person-card {
    background: #fafafa;
    border: 1px solid #e5dccc;
    border-radius: 8px;
    padding: 12px 16px;
}
.xthn-person-card h4 { margin: 0 0 8px; color: #7b1414; font-size: 15px; }
.xthn-person-card ul {
    margin: 0;
    padding-left: 16px;
    font-size: 13px;
    color: #4a4a4a;
}
.xthn-person-card li { margin-bottom: 2px; }

/* ===== Sections ===== */
.xthn-section { margin-bottom: 22px; }
.xthn-section h3 {
    color: #7b1414;
    border-left: 4px solid #b8860b;
    padding-left: 10px;
    margin: 0 0 12px;
    font-size: 17px;
}
.xthn-section h3 small { color: #888; font-size: 13px; font-weight: 400; }
.xthn-section-intro { color: #666; font-size: 13px; margin: -4px 0 12px; }

/* ===== Insights ===== */
.xthn-insight {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
    align-items: flex-start;
}
.xthn-insight-positive { background: #ecfdf5; border-left: 3px solid #10b981; }
.xthn-insight-info     { background: #eff6ff; border-left: 3px solid #3b82f6; }
.xthn-insight-warning  { background: #fffbeb; border-left: 3px solid #f59e0b; }
.xthn-insight-critical { background: #fef2f2; border-left: 3px solid #ef4444; }
.xthn-insight-icon { font-size: 20px; flex-shrink: 0; }
.xthn-insight-body h4 { margin: 0 0 4px; font-size: 14px; color: #2c1810; }
.xthn-insight-body p  { margin: 0; font-size: 13px; color: #4a4a4a; }

/* ===== Factors ===== */
.xthn-factors-section { margin: 22px 0; }
.xthn-factors-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 600px) {
    .xthn-factors-grid { grid-template-columns: 1fr; }
}
.xthn-factor {
    background: #fff;
    border: 1px solid #e5dccc;
    border-left-width: 4px;
    border-radius: 6px;
    padding: 10px 14px;
}
.xthn-factor-dai-cat    { border-left-color: #047857; }
.xthn-factor-trung-cat  { border-left-color: #15803d; }
.xthn-factor-binh       { border-left-color: #6b7280; }
.xthn-factor-trung-hung { border-left-color: #d97706; }
.xthn-factor-dai-hung   { border-left-color: #b91c1c; }
.xthn-factor-summary { cursor: pointer; list-style: none; }
.xthn-factor-summary::-webkit-details-marker { display: none; }
.xthn-factor-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.xthn-factor-title { font-size: 14px; font-weight: 700; color: #2c1810; }
.xthn-factor-score { font-size: 14px; font-weight: 700; color: #7b1414; }
.xthn-factor-short { margin: 0 0 6px; font-size: 13px; color: #5a4a3a; }
.xthn-factor-bar {
    background: #f0f0f0;
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 6px;
}
.xthn-factor-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #b8860b, #d4a865);
}
.xthn-factor-level-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: #fff;
    font-weight: 600;
}
.xthn-factor-body {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e5dccc;
    font-size: 14.5px;
    color: #4a4a4a;
    line-height: 1.7;
}

/* ===== Remedies ===== */
.xthn-remedies-groups { display: grid; gap: 10px; }
.xthn-remedy-group {
    background: #fafafa;
    border: 1px solid #e5dccc;
    border-radius: 6px;
    padding: 10px 14px;
}
.xthn-remedy-group summary { cursor: pointer; font-weight: 700; color: #7b1414; }
.xthn-remedy-group ul {
    margin: 10px 0 0;
    padding-left: 20px;
    font-size: 13px;
    color: #4a4a4a;
}
.xthn-remedy-group li { margin-bottom: 4px; }

/* ===== CROSS-SELL PANEL (mode COUPLE) ===== */
.xthn-cross-panel {
    background: #fef9e7;
    border: 1px dashed #b8860b;
    padding: 16px 18px;
    border-radius: 10px;
}
.xthn-cross-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}
@media (max-width: 900px) { .xthn-cross-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .xthn-cross-grid { grid-template-columns: 1fr 1fr; } }
.xthn-cross-card {
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: 10px 8px;
    background: #fff;
    border: 1px solid #d4a865;
    border-radius: 8px;
    text-decoration: none;
    color: #2c1810;
    transition: transform .15s, box-shadow .15s;
}
.xthn-cross-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(184, 134, 11, 0.2);
    text-decoration: none;
}
.xthn-cross-rank {
    display: inline-block;
    background: #b8860b;
    color: #fff;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    align-self: center;
    margin-bottom: 4px;
}
.xthn-cross-rank-1 { border-color: #b8860b; background: linear-gradient(180deg, #fff7e6 0%, #fff 100%); }
.xthn-cross-card strong { font-size: 14px; color: #2c1810; margin: 2px 0; }
.xthn-cross-score { font-size: 18px; font-weight: 700; color: #7b1414; }
.xthn-cross-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    background: #15803d;
    color: #fff;
    font-size: 10px;
    margin: 2px auto;
}
.xthn-cross-reason { font-size: 11px; color: #666; margin: 2px 0; }
.xthn-cross-years  { font-size: 10px; color: #888; }

/* ===== LOOKUP MODE — header + top cards + table ===== */
.xthn-lookup-header { display: block; }
.xthn-lookup-title { color: #7b1414; margin: 8px 0 4px; font-size: 18px; }
.xthn-person-meta { margin: 0; color: #666; font-size: 13px; }

.xthn-top-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
@media (max-width: 600px) {
    .xthn-top-grid { grid-template-columns: 1fr; }
}
.xthn-top-card {
    display: block;
    background: #fff;
    border: 1px solid #e5dccc;
    border-left: 4px solid #15803d;
    border-radius: 8px;
    padding: 14px 16px;
    text-align: center;
    position: relative;
    text-decoration: none;
    color: #2c1810;
    transition: transform .15s, box-shadow .15s;
}
.xthn-top-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(184, 134, 11, 0.22);
    text-decoration: none;
}
.xthn-top-rank-1 { border-left-color: #b8860b; background: linear-gradient(180deg, #fff7e6 0%, #fff 100%); }
.xthn-top-rank-2 { border-left-color: #94a3b8; }
.xthn-top-rank-3 { border-left-color: #c08552; }
.xthn-top-rank-bad { border-left-color: #b91c1c; background: #fef2f2; }
.xthn-top-rank {
    position: absolute;
    top: -10px; left: 12px;
    background: #b8860b;
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}
.xthn-top-branch { font-size: 18px; font-weight: 700; color: #2c1810; margin: 4px 0; }
.xthn-top-score { font-size: 24px; font-weight: 700; color: #7b1414; }
.xthn-top-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    color: #fff;
    margin: 4px 0;
    font-weight: 600;
}
.xthn-tag-good { background: #15803d; }
.xthn-tag-bad  { background: #b91c1c; }
.xthn-top-reason { font-size: 12px; color: #666; margin: 4px 0; }
.xthn-top-years  { display: block; font-size: 11px; color: #888; }
.xthn-top-cta    { display: block; margin-top: 6px; color: #7b1414; font-weight: 600; font-size: 11px; }
.xthn-bottom-note { color: #666; font-style: italic; }

.xthn-table-wrap { overflow-x: auto; }
.xthn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
}
.xthn-table th {
    background: #7b1414;
    color: #fff;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
}
.xthn-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0e8d8;
    vertical-align: middle;
}
.xthn-row-best { background: #ecfdf5; }
.xthn-row-good { background: #f0fdf4; }
.xthn-row-mid  { background: #fff; }
.xthn-row-warn { background: #fff7ed; }
.xthn-row-bad  { background: #fef2f2; }
.xthn-row-self { font-weight: 600; }
.xthn-cell-score { font-weight: 700; color: #7b1414; }
.xthn-link-detail {
    display: inline-block;
    padding: 2px 8px;
    margin-right: 4px;
    font-size: 11px;
    color: #7b1414;
    background: #fef9e7;
    border: 1px solid #d4a865;
    border-radius: 10px;
    text-decoration: none;
}
.xthn-link-detail:hover { background: #fff7e6; }
.xthn-link-primary {
    background: #7b1414;
    color: #fff;
    border-color: #7b1414;
    font-weight: 600;
}
.xthn-link-primary:hover { background: #5a0e0e; color: #fff; }
.xthn-disclaimer { margin-top: 14px; color: #888; font-size: 12px; }
