/* ╔════════════════════════════════════════════════════════════╗
   ║  Tử Vi Chart Grid — Traditional 12-Palace Layout           ║
   ║  Uses shared_theme CSS variables for theme support          ║
   ╚════════════════════════════════════════════════════════════╝ */

/* ── Chart Container ── */
.chart-container {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, minmax(120px, auto));
}

/* ── Palace Cell ── */
.palace {
    border: 1px solid var(--border-color);
    padding: 5px;
    font-size: 13px;
    position: relative;
    background: var(--bg-card);
    min-height: 120px;
    font-family: var(--font-body);
    font-weight: 500;
    color: var(--text-primary);
}

/* warm cream tint for light mode, subtle warm tint for dark */
[data-theme="light"] .palace {
    background: #FFFEFA;
}

[data-theme="dark"] .palace {
    background: #1a1d24;
}

.palace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 3px;
    margin-bottom: 5px;
}

.palace-code {
    font-size: 10px;
    color: var(--text-muted);
}

.palace-name {
    font-weight: bold;
    color: var(--text-primary);
    font-size: 12px;
    text-align: center;
    flex: 1;
}

.palace-number {
    font-size: 10px;
    color: var(--text-muted);
}

/* ── Main Stars ── */
.main-stars {
    margin-bottom: 5px;
    text-align: center;
}

.main-star {
    font-weight: 700;
    color: #C62828;
    font-size: 16px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
}

.main-star.secondary {
    color: #1565C0;
}

/* ── Auxiliary Stars ── */
.aux-stars {
    font-size: 10px;
    line-height: 1.4;
}

.aux-star {
    display: inline;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
}

.aux-star.good {
    color: #2E7D32;
}

.aux-star.bad {
    color: #C62828;
}

/* ── Two-Column Good/Bad Stars ── */
.stars-columns {
    display: flex;
    gap: 5px;
    margin-top: 3px;
}

.stars-good {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
    color: #2E7D32;
    border-right: 1px dashed var(--border-color);
    padding-right: 5px;
}

.stars-bad {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
    color: #C62828;
}

.main-star.bad {
    color: #1565C0;
}

/* ── Hóa Badge ── */
.hoa-badge {
    font-size: 9px;
    color: #fff;
    background: #c00;
    padding: 0 3px;
    border-radius: 2px;
    margin-left: 2px;
}

.star-indicator {
    font-size: 9px;
    color: #c00;
}

/* ── Brightness Indicators ── */
.bright-mieu  { color: #2E7D32; }
.bright-vuong { color: #1565C0; }
.bright-dac   { color: #E65100; }
.bright-ham   { color: #757575; }

/* ── Palace Footer ── */
.palace-footer {
    position: absolute;
    bottom: 3px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 5px;
    font-size: 10px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 3px;
}

/* ── Center Info Panel (2×2) ── */
.center-info {
    grid-column: 2 / 4;
    grid-row: 2 / 4;
    border: 2px solid var(--accent-red);
    padding: 15px;
    background: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

[data-theme="light"] .center-info {
    background: linear-gradient(135deg, #FFFEF0, #FFFFFF);
}

.center-title {
    text-align: center;
    font-size: 20px;
    color: var(--accent-red);
    font-weight: bold;
    margin-bottom: 10px;
}

.info-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 5px 10px;
    font-size: 13px;
}

.info-label {
    color: var(--text-muted);
}

.info-value {
    color: var(--text-primary);
    font-weight: bold;
}

/* ── Tứ Hóa Box ── */
.tu-hoa-box {
    margin-top: 15px;
    border: 1px solid var(--accent-red);
    padding: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    font-size: 12px;
    border-radius: var(--radius);
}

.tu-hoa-item {
    display: flex;
    justify-content: space-between;
}

.hoa-name {
    color: var(--accent-red);
    font-weight: 600;
}

.hoa-star {
    color: var(--text-primary);
}

/* ── Special Markers ── */
.menh-marker {
    background: #FDD835;
    color: #333;
    padding: 2px 5px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 3px;
}

.than-marker {
    background: #81C784;
    color: #333;
    padding: 2px 5px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 3px;
}

.palace.hidden {
    display: none;
}

/* ── Interpretation Section ── */
.interpretation {
    background: var(--bg-secondary);
    padding: 20px;
    margin-top: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.interp-title {
    font-size: 18px;
    color: var(--accent-gold);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--accent-gold);
    padding-bottom: 5px;
}

.interp-section {
    margin-bottom: 15px;
}

.interp-section h4 {
    color: var(--text-primary);
    margin-bottom: 5px;
}

.interp-section p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Tiểu Hạn Badge ── */
.tieu-han-badge {
    background-color: var(--text-primary);
    color: var(--bg-primary);
    padding: 1px 4px;
    font-size: 10px;
    border-radius: 2px;
    font-weight: bold;
    margin-left: 5px;
}
