/* ═══════════════════════════════════════════════════
   WP LiùYáo Claude — Styles
   ═══════════════════════════════════════════════════ */

:root {
    --ly-accent:       #8b1a1a;
    --ly-max-width:    900px;
    --ly-yang-color:   #c41e3a;
    --ly-yin-color:    #1a3a8b;
    --ly-moving-color: #d4a017;
    --ly-shi-bg:       #fff8e1;
    --ly-ying-bg:      #e8f5e9;
    --ly-bg:           #faf8f5;
    --ly-border:       #d4c5a9;
    --ly-text:         #2c2418;
    --ly-text-light:   #6b5f4e;
    --ly-font-zh:      'Noto Serif SC', 'SimSun', serif;
    --ly-radius:       4px;
}

/* ── Conteneur principal ── */
.liuyao-widget {
    max-width: var(--ly-max-width);
    margin: 0 auto;
    font-family: var(--ly-font-zh), Georgia, serif;
    color: var(--ly-text);
    background: var(--ly-bg);
    border: 1px solid var(--ly-border);
    border-radius: var(--ly-radius);
    overflow: hidden;
}

/* ── Formulaire de consultation ── */
.ly-form {
    padding: 20px 24px;
}

.ly-form h2 {
    font-size: 1.3em;
    color: var(--ly-accent);
    margin: 0 0 16px;
    border-bottom: 2px solid var(--ly-accent);
    padding-bottom: 8px;
    font-weight: normal;
    letter-spacing: 0.04em;
}

.ly-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
    margin-bottom: 16px;
}

@media (max-width: 600px) {
    .ly-form-grid { grid-template-columns: 1fr; }
}

.ly-field label {
    display: block;
    font-size: 0.78em;
    color: var(--ly-text-light);
    margin-bottom: 4px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.ly-field input,
.ly-field select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--ly-border);
    border-radius: var(--ly-radius);
    background: #fff;
    font-size: 0.92em;
    color: var(--ly-text);
    box-sizing: border-box;
}

.ly-field input:focus,
.ly-field select:focus {
    outline: none;
    border-color: var(--ly-accent);
}

/* ── Méthode de tirage ── */
.ly-method-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--ly-border);
    padding-bottom: 0;
}

.ly-tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 6px 14px 8px;
    cursor: pointer;
    font-size: 0.9em;
    color: var(--ly-text-light);
    transition: color .2s, border-color .2s;
    font-family: inherit;
}

.ly-tab-btn.active,
.ly-tab-btn:hover {
    color: var(--ly-accent);
    border-bottom-color: var(--ly-accent);
}

/* ── Saisie manuelle ── */
.ly-manual-input {
    margin-bottom: 14px;
}

.ly-manual-input p {
    font-size: 0.85em;
    color: var(--ly-text-light);
    margin: 0 0 10px;
}

.ly-lines-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.ly-line-input {
    text-align: center;
}

.ly-line-input label {
    display: block;
    font-size: 0.75em;
    color: var(--ly-text-light);
    margin-bottom: 4px;
}

.ly-line-input select {
    width: 100%;
    padding: 6px 2px;
    text-align: center;
    border: 1px solid var(--ly-border);
    border-radius: var(--ly-radius);
    font-size: 0.9em;
    background: #fff;
    cursor: pointer;
}

/* ── Tirage aléatoire ── */
.ly-random-zone {
    text-align: center;
    padding: 12px 0;
}

.ly-dice-btn {
    background: var(--ly-accent);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: var(--ly-radius);
    font-size: 1em;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.03em;
    transition: opacity .2s;
}

.ly-dice-btn:hover { opacity: .85; }

.ly-coins-display {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin: 10px 0;
    flex-wrap: wrap;
}

.ly-coin {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #c8a84b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    box-shadow: 1px 1px 3px rgba(0,0,0,.2);
    animation: ly-flip .4s ease;
}

@keyframes ly-flip {
    0%  { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100%{ transform: rotateY(0deg); }
}

.ly-lines-preview {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
    font-size: 0.82em;
    color: var(--ly-text-light);
}

.ly-lines-preview span {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

/* ── Bouton consulter ── */
.ly-submit-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 16px;
}

.ly-submit-btn {
    background: var(--ly-accent);
    color: #fff;
    border: none;
    padding: 10px 28px;
    border-radius: var(--ly-radius);
    font-size: 1em;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.05em;
    transition: opacity .2s;
}

.ly-submit-btn:hover { opacity: .85; }
.ly-submit-btn:disabled { opacity: .5; cursor: not-allowed; }

.ly-reset-btn {
    background: none;
    color: var(--ly-text-light);
    border: 1px solid var(--ly-border);
    padding: 10px 18px;
    border-radius: var(--ly-radius);
    font-size: 0.9em;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .2s;
}

.ly-reset-btn:hover { border-color: var(--ly-accent); color: var(--ly-accent); }

/* ── Loading ── */
.ly-loading {
    text-align: center;
    padding: 30px;
    color: var(--ly-text-light);
}

.ly-spinner {
    display: inline-block;
    animation: ly-spin 1s linear infinite;
}

@keyframes ly-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Résultat ── */
.ly-result {
    padding: 20px 24px;
}

/* En-tête résultat */
.ly-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.ly-result-title h3 {
    margin: 0 0 4px;
    font-size: 1.1em;
    color: var(--ly-text-light);
    font-weight: normal;
}

.ly-result-title .ly-datetime {
    font-size: 0.85em;
    color: var(--ly-text-light);
}

.ly-nouvelle-btn {
    background: none;
    border: 1px solid var(--ly-accent);
    color: var(--ly-accent);
    padding: 7px 14px;
    border-radius: var(--ly-radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.88em;
    transition: background .2s, color .2s;
}

.ly-nouvelle-btn:hover {
    background: var(--ly-accent);
    color: #fff;
}

/* ── Contexte BaZi ── */
.ly-bazi-strip {
    display: flex;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--ly-border);
    border-radius: var(--ly-radius);
    padding: 10px 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.ly-bazi-strip .ly-pillar {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
}

.ly-bazi-strip .ly-pillar-label {
    font-size: 0.7em;
    color: var(--ly-text-light);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.ly-bazi-strip .ly-pillar-gz {
    font-size: 1.3em;
    letter-spacing: .05em;
    color: var(--ly-accent);
}

.ly-bazi-strip .ly-pillar-py {
    font-size: 0.72em;
    color: var(--ly-text-light);
    font-style: italic;
}

.ly-bazi-sep {
    color: var(--ly-border);
    font-size: 1.2em;
    align-self: center;
}

.ly-kongwang-badge {
    margin-left: auto;
    font-size: 0.78em;
    color: var(--ly-text-light);
    border: 1px dashed var(--ly-border);
    border-radius: 3px;
    padding: 3px 8px;
}

/* ── Hexagrammes ── */
.ly-hexagrams-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .ly-hexagrams-row { grid-template-columns: 1fr; }
    .ly-arrow { display: none; }
}

.ly-gua-block {
    background: #fff;
    border: 1px solid var(--ly-border);
    border-radius: var(--ly-radius);
    overflow: hidden;
}

.ly-gua-header {
    background: var(--ly-accent);
    color: #fff;
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ly-gua-type {
    font-size: 0.75em;
    opacity: .85;
    letter-spacing: .05em;
}

.ly-gua-name {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.ly-gua-name .ly-zh {
    font-size: 1.5em;
    letter-spacing: .08em;
    line-height: 1.1;
}

.ly-gua-name .ly-py {
    font-size: 0.78em;
    opacity: .85;
    font-style: italic;
}

.ly-palace-tag {
    font-size: 0.75em;
    background: rgba(255,255,255,.2);
    border-radius: 3px;
    padding: 2px 6px;
    margin-top: 4px;
}

.ly-gua-body {
    padding: 0;
}

/* ── Tableau des Yao ── */
.ly-yao-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}

.ly-yao-table th {
    font-size: 0.72em;
    color: var(--ly-text-light);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 5px 8px;
    border-bottom: 1px solid var(--ly-border);
    background: #faf8f5;
    text-align: left;
}

.ly-yao-row {
    border-bottom: 1px solid #ede8df;
}

.ly-yao-row:last-child { border-bottom: none; }

.ly-yao-row.ly-shi { background: var(--ly-shi-bg); }
.ly-yao-row.ly-ying { background: var(--ly-ying-bg); }

.ly-yao-row td {
    padding: 6px 8px;
    vertical-align: middle;
}

/* Colonne ligne hexagramme */
.ly-yao-line-cell {
    width: 52px;
    text-align: center;
    padding: 4px !important;
}

.ly-line-svg {
    display: block;
    margin: 0 auto;
}

/* Position */
.ly-yao-pos {
    width: 24px;
    font-weight: bold;
    color: var(--ly-text-light);
    font-size: 0.8em;
    text-align: center;
}

/* LiuQin */
.ly-liuqin-zh {
    font-size: 1.05em;
    color: var(--ly-accent);
    letter-spacing: .04em;
}

.ly-liuqin-fr {
    font-size: 0.72em;
    color: var(--ly-text-light);
}

/* Branche */
.ly-zhi-zh {
    font-size: 1.1em;
    letter-spacing: .04em;
}

.ly-zhi-detail {
    font-size: 0.72em;
    color: var(--ly-text-light);
}

.ly-zhi-elem {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.7em;
    margin-left: 3px;
}

/* LiuShou */
.ly-liushou-zh {
    font-size: 1em;
    letter-spacing: .03em;
}

.ly-liushou-fr {
    font-size: 0.72em;
    color: var(--ly-text-light);
}

/* Badges Shi/Ying */
.ly-badge {
    display: inline-block;
    font-size: 0.72em;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 3px;
    vertical-align: middle;
}

.ly-badge-shi  { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }
.ly-badge-ying { background: #d1e7dd; color: #0f5132; border: 1px solid #198754; }

/* Ligne mouvante */
.ly-moving-marker {
    color: var(--ly-moving-color);
    font-weight: bold;
    font-size: 0.85em;
}

.ly-yao-row.ly-moving-row {
    border-left: 3px solid var(--ly-moving-color);
}

/* KongWang */
.ly-kongwang-row td {
    opacity: .55;
}

.ly-kw-badge {
    display: inline-block;
    font-size: 0.7em;
    color: #6c757d;
    border: 1px dashed #adb5bd;
    border-radius: 3px;
    padding: 0 4px;
    margin-left: 4px;
}

/* ── Flèche transformation ── */
.ly-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 60px;
    font-size: 1.8em;
    color: var(--ly-moving-color);
}

/* ── Relations ── */
.ly-relations {
    margin-top: 16px;
    background: #fff;
    border: 1px solid var(--ly-border);
    border-radius: var(--ly-radius);
    padding: 12px 16px;
}

.ly-relations h4 {
    margin: 0 0 10px;
    font-size: 0.85em;
    color: var(--ly-text-light);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: normal;
}

.ly-relation-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ly-relation-tag {
    font-size: 0.82em;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid;
}

.ly-relation-tag.ly-he    { background: #e8f4fd; color: #0c63a4; border-color: #bee3f8; }
.ly-relation-tag.ly-chong { background: #fce8e8; color: #9b1c1c; border-color: #f8b4b4; }

/* ── Couleurs éléments ── */
.ly-elem-bois  { background: #e8f5e9; color: #2e7d32; }
.ly-elem-feu   { background: #ffebee; color: #c62828; }
.ly-elem-terre { background: #fff8e1; color: #795548; }
.ly-elem-metal { background: #f5f5f5; color: #424242; }
.ly-elem-eau   { background: #e3f2fd; color: #1565c0; }

/* ── Erreur ── */
.ly-error {
    background: #fce8e8;
    border: 1px solid #f8b4b4;
    color: #9b1c1c;
    padding: 12px 16px;
    border-radius: var(--ly-radius);
    font-size: 0.9em;
    margin: 16px 24px;
}

/* ── Géolocalisation ──────────────────────────────────────────────────────── */
.ly-geo-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    margin-bottom: 10px;
    align-items: end;
}
@media (max-width: 600px) { .ly-geo-row { grid-template-columns: 1fr; } }

.ly-geocode-wrap { position: relative; }

.ly-city-search {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--ly-border);
    border-radius: var(--ly-radius);
    font-size: .92em;
    box-sizing: border-box;
}
.ly-city-search:focus { outline: none; border-color: var(--ly-accent); }

.ly-geocode-spinner { position: absolute; right: 8px; top: 8px; font-size: .85em; }

.ly-selected-city {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f0f7f0;
    border: 1px solid #b2dfdb;
    border-radius: var(--ly-radius);
    font-size: .88em;
}
.ly-selected-name { flex: 1; color: var(--ly-text); }
.ly-clear-city { background: none; border: none; cursor: pointer; color: var(--ly-text-light); font-size: 1em; padding: 0 2px; }
.ly-clear-city:hover { color: var(--ly-accent); }

.ly-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 999;
    background: #fff;
    border: 1px solid var(--ly-border);
    border-radius: var(--ly-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    list-style: none;
    margin: 2px 0 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}
.ly-suggestions li {
    padding: .5rem .75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0ece4;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: baseline;
}
.ly-suggestions li:last-child { border-bottom: none; }
.ly-suggestions li:hover, .ly-suggestions li.active { background: #faf0e6; }
.ly-sugg-name   { font-weight: 500; font-size: .9em; }
.ly-sugg-detail { font-size: .78em; color: var(--ly-text-light); }
.ly-sugg-coords { font-size: .72em; color: #aaa; margin-left: auto; }

.ly-field-tz { min-width: 140px; }
.ly-tz-display { display: inline-block; font-size: .88em; color: var(--ly-accent); padding: 7px 0; }

.ly-coords-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}
@media (max-width: 500px) { .ly-coords-row { grid-template-columns: 1fr 1fr; } }

/* ── Nouvelles colonnes tableau Yao ─────────────────────────────────────── */
.ly-col-liushou { min-width: 70px; }
.ly-col-canggan { min-width: 54px; text-align: center; }
.ly-col-liuqin  { min-width: 68px; }
.ly-col-zhi     { min-width: 58px; }
.ly-col-shiying { min-width: 36px; text-align: center; }

.ly-small-text { font-size: .7em; color: var(--ly-text-light); font-style: normal; line-height: 1.2; }

/* CangGan */
.ly-cg-item {
    display: inline-block;
    font-size: .95em;
    letter-spacing: .04em;
    color: #5c3d1e;
    background: #fef9f0;
    border: 1px solid #e8d5b0;
    border-radius: 3px;
    padding: 0 3px;
    margin: 1px;
}
.ly-cg-empty { color: #ccc; font-size: .85em; }

/* Ligne hexagramme plus visible */
.ly-yao-line-cell { width: 56px; text-align: center; padding: 4px 2px !important; }
.ly-line-svg { display: block; margin: 0 auto; }
.ly-moving-val { font-size: .72em; color: var(--ly-moving-color); font-weight: bold; line-height: 1; margin-top: 1px; }

/* Tableau plus compact pour Zhi Gua */
.ly-gua-block .ly-yao-table th { font-size: .68em; padding: 4px 6px; }
.ly-gua-block .ly-yao-table td { padding: 5px 6px; }

/* ── FuShén / FēiShén ────────────────────────────────────────────────────── */
.ly-fushen-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 3px;
    padding: 2px 5px;
    background: #fef3cd;
    border: 1px solid #f0c040;
    border-radius: 3px;
    font-size: .75em;
}
.ly-fushen-lbl {
    color: #a06000;
    font-weight: bold;
    font-size: .9em;
}
.ly-fushen-zhi {
    font-size: 1.05em;
    color: #5c3a00;
    letter-spacing: .03em;
}
.ly-fushen-lq {
    color: #7a4f00;
    font-size: .85em;
}

.ly-fushen-section {
    margin-top: 14px;
    background: #fffbf0;
    border: 1px solid #f0c040;
    border-radius: var(--ly-radius);
    padding: 10px 16px;
}
.ly-fushen-section h4 {
    margin: 0 0 8px;
    font-size: .82em;
    color: #a06000;
    font-weight: normal;
    letter-spacing: .04em;
}
.ly-fushen-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.ly-fushen-recap {
    font-size: .85em;
    color: var(--ly-text);
    padding: 3px 10px;
    background: #fff8e0;
    border: 1px solid #e8c84a;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.ly-fushen-recap .ly-fushen-zhi {
    font-size: 1.1em;
    color: #5c3a00;
}

/* Relations ke et sheng */
.ly-relation-tag.ly-sheng { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
.ly-relation-tag.ly-ke    { background: #fce4ec; color: #880e4f; border-color: #f48fb1; }

/* ── GuàShēn 卦身 ─────────────────────────────────────────────────────── */
.ly-guashen-badge {
    margin-left: 8px;
    font-size: .78em;
    color: #6b21a8;
    border: 1px solid #c084fc;
    border-radius: 3px;
    padding: 2px 8px;
    background: #faf5ff;
}
.ly-guashen-section {
    margin-top: 10px;
    background: #faf5ff;
    border: 1px solid #c084fc;
    border-radius: var(--ly-radius);
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.ly-guashen-section h4 {
    margin: 0;
    font-size: .82em;
    color: #6b21a8;
    font-weight: normal;
    letter-spacing: .04em;
}
.ly-guashen-tag {
    font-size: 1.1em;
    color: #6b21a8;
    letter-spacing: .04em;
}
.ly-guashen-tag em { font-size: .78em; color: #9333ea; margin-left: 4px; }

/* FuShen pinyin */
.ly-fushen-py { font-size: .72em; color: #92400e; font-style: italic; margin-left: 3px; }
.ly-fushen-lqzh { font-size: .85em; color: #7a4f00; }

/* ── ShénShà 神煞 — Étoiles auxiliaires ─────────────────────────────────── */
.ly-ss-badge {
    display: inline-block;
    font-size: .7em;
    font-family: var(--ly-font-zh, serif);
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 2px;
    vertical-align: middle;
    cursor: default;
    line-height: 1.4;
}
/* 天乙貴人 — Or : protection, noblesse */
.ly-ss-guiren {
    background: #fef9c3;
    color: #854d0e;
    border: 1px solid #fcd34d;
}
/* 驛馬 — Bleu : mouvement, voyage */
.ly-ss-yima {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}
/* 桃花 — Rose : romance, attraction */
.ly-ss-taohua {
    background: #fce7f3;
    color: #9d174d;
    border: 1px solid #f9a8d4;
}
