/* =============================================================================
   STYLE-NGUYENCUC.CSS - Nguyên Cục Section Styles
   =============================================================================
   Contains: Structured Logs, Calculation Tables, Day Master Section, 
             Dụng Thần Card, Step Logs, Mini Bars
   
   LOAD ORDER: After core.css
   ============================================================================= */

/* =============================================================================
   STRUCTURED LOGS DISPLAY
   ============================================================================= */

.structured-logs {
    padding: 10px 0;
}

.structured-logs h4 {
    color: var(--accent-gold);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.calc-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.calc-section h5 {
    color: var(--accent-gold);
    margin-bottom: 12px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.calc-section.highlight-section {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.3);
}

.calc-section.final-section {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.08) 0%, rgba(33, 150, 243, 0.08) 100%);
    border-color: rgba(76, 175, 80, 0.3);
}

/* =============================================================================
   HÓA KHÍ CÁCH / TRANH HỢP ALERT BANNERS
   ============================================================================= */

.alert-banner {
    display: flex;
    gap: 15px;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    align-items: flex-start;
}

.alert-banner .banner-icon {
    font-size: 2rem;
    line-height: 1;
}

.alert-banner .banner-content {
    flex: 1;
}

.alert-banner .banner-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.alert-banner .banner-desc {
    font-size: 0.95rem;
    margin-bottom: 5px;
    line-height: 1.5;
}

.alert-banner .banner-note {
    font-size: 0.85rem;
    font-style: italic;
    opacity: 0.8;
}

/* Hóa Khí Cách Success Banner (Purple-Green Gradient) */
.alert-banner.hoa-khi-success {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.15) 0%, rgba(76, 175, 80, 0.15) 100%);
    border: 2px solid rgba(156, 39, 176, 0.4);
    border-left: 5px solid #9C27B0;
}

.alert-banner.hoa-khi-success .banner-title {
    color: #CE93D8;
    text-shadow: 0 0 10px rgba(156, 39, 176, 0.5);
}

.alert-banner.hoa-khi-success .banner-desc {
    color: var(--text-primary);
}

.alert-banner.hoa-khi-success .banner-note {
    color: #81C784;
}

/* Tranh Hợp Warning Banner (Orange-Red Gradient) */
.alert-banner.tranh-hop-warning {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.15) 0%, rgba(244, 67, 54, 0.15) 100%);
    border: 2px solid rgba(255, 152, 0, 0.4);
    border-left: 5px solid #FF9800;
}

.alert-banner.tranh-hop-warning .banner-title {
    color: #FFB74D;
}

.alert-banner.tranh-hop-warning .banner-desc {
    color: var(--text-primary);
}

.alert-banner.tranh-hop-warning .banner-note {
    color: #EF9A9A;
}

/* Log types for Hóa Khí and Tranh Hợp */
.log-hoa_khi_cach {
    border-left: 4px solid #9C27B0;
    background: rgba(156, 39, 176, 0.1) !important;
    color: #CE93D8;
    font-weight: 600;
}

.log-tranh_hop_nhat_chu {
    border-left: 4px solid #FF9800;
    background: rgba(255, 152, 0, 0.1) !important;
    color: #FFB74D;
    font-weight: 600;
}

.log-hop_ban_nhat_chu {
    border-left: 3px solid #42A5F5;
    color: #90CAF9;
}

/* =============================================================================
   CALCULATION TABLES
   ============================================================================= */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
    margin-bottom: 15px;
    border-radius: 4px;
    /* Optional rounded corners */
}

/* Scrollbar styling for Webkit */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--accent-gold);
    border-radius: 3px;
}

.calc-table,
.totals-table,
.final-totals-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.calc-table th,
.calc-table td,
.totals-table th,
.totals-table td,
.final-totals-table th,
.final-totals-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.calc-table th,
.totals-table th,
.final-totals-table th {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
}

.calc-table td:first-child,
.final-totals-table td:first-child {
    text-align: left;
}

.relation-mini {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Month Command Box */
.month-command-box {
    padding: 12px;
    background: rgba(212, 175, 55, 0.15);
    border-radius: 6px;
    border-left: 4px solid var(--accent-gold);
}

.highlight-text {
    color: var(--accent-gold);
    font-weight: 500;
}

/* =============================================================================
   MINI BAR CHARTS
   ============================================================================= */

.mini-bar {
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    min-width: 100px;
}

.mini-bar-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 0.5s ease;
}

.mini-bar-fill.element-Kim {
    background: linear-gradient(90deg, #9E9E9E, #E0E0E0);
}

.mini-bar-fill.element-Mộc {
    background: linear-gradient(90deg, #388E3C, #66BB6A);
}

.mini-bar-fill.element-Thủy {
    background: linear-gradient(90deg, #1565C0, #42A5F5);
}

.mini-bar-fill.element-Hỏa {
    background: linear-gradient(90deg, #C62828, #EF5350);
}

.mini-bar-fill.element-Thổ {
    background: linear-gradient(90deg, #F57F17, #FFCA28);
}

/* Score Summary Chips */
.score-summary-mini {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.score-chip {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.08);
}

/* =============================================================================
   DỤNG THẦN CARD STYLING
   ============================================================================= */

.dungthan-card {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(156, 39, 176, 0.08) 100%);
    border: 2px solid rgba(212, 175, 55, 0.4);
}

.dungthan-summary {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.strength-indicator {
    text-align: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.strength-badge {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1.3rem;
    margin: 10px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Strength level colors */
.level-vuong_cuc {
    background: linear-gradient(135deg, #E91E63, #9C27B0);
    color: #fff;
}

.level-qua_vuong {
    background: linear-gradient(135deg, #FF5722, #F44336);
    color: #fff;
}

.level-thien_vuong {
    background: linear-gradient(135deg, #FF9800, #FF5722);
    color: #fff;
}

.level-trung_hoa {
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
    color: #fff;
}

.level-thien_nhuoc {
    background: linear-gradient(135deg, #03A9F4, #00BCD4);
    color: #fff;
}

.level-qua_nhuoc {
    background: linear-gradient(135deg, #3F51B5, #2196F3);
    color: #fff;
}

.level-nhuoc_cuc {
    background: linear-gradient(135deg, #607D8B, #9E9E9E);
    color: #fff;
}

.strength-details {
    margin-top: 15px;
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.8;
}

.strength-details p {
    margin-bottom: 8px;
}

.dungthan-elements {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.element-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

/* =============================================================================
   NGŨ THẦN MATRIX (5-LEVEL ENERGY TOWER)
   ============================================================================= */
.ngu-than-matrix-container {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    margin-top: 15px;
}

.ngu-than-matrix-container h6 {
    margin-bottom: 12px;
    font-size: 1rem;
    color: var(--accent-gold);
}

.ngu-than-matrix {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.matrix-row {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 12px 16px;
    border-left: 4px solid transparent;
    transition: transform 0.2s ease, background 0.2s ease;
}

.matrix-row:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.08);
}

.matrix-row.level-1 {
    border-left-color: #4CAF50;
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.15), transparent);
}

.matrix-row.level-2 {
    border-left-color: #2196F3;
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.1), transparent);
}

.matrix-row.level-3 {
    border-left-color: #9E9E9E;
}

.matrix-row.level-4 {
    border-left-color: #FF9800;
    background: linear-gradient(90deg, rgba(255, 152, 0, 0.1), transparent);
}

.matrix-row.level-5 {
    border-left-color: #F44336;
    background: linear-gradient(90deg, rgba(244, 67, 54, 0.15), transparent);
}

.matrix-label {
    flex: 0 0 160px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.matrix-elements {
    flex: 1;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.matrix-desc {
    flex: 0 0 280px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    text-align: right;
}

.god-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Base God Tag Colors - Matching Element Badges */
.god-tag.element-Kim {
    background: linear-gradient(135deg, #E0E0E0, #BDBDBD);
    color: #000;
}

.god-tag.element-Mộc {
    background: linear-gradient(135deg, #66BB6A, #43A047);
    color: #fff;
}

.god-tag.element-Thủy {
    background: linear-gradient(135deg, #42A5F5, #1E88E5);
    color: #fff;
}

.god-tag.element-Hỏa {
    background: linear-gradient(135deg, #EF5350, #E53935);
    color: #fff;
}

.god-tag.element-Thổ {
    background: linear-gradient(135deg, #FFCA28, #FFB300);
    color: #000;
}

.empty-god {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Mobile responsive for Ngu Than Matrix */
@media (max-width: 768px) {
    .matrix-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .matrix-label,
    .matrix-desc {
        flex: auto;
        text-align: left;
    }

    .matrix-desc {
        font-size: 0.8rem;
        margin-top: 4px;
        opacity: 0.8;
    }
}

.element-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.element-badge.element-Kim {
    background: linear-gradient(135deg, #E0E0E0, #BDBDBD);
    color: #000;
}

.element-badge.element-Mộc {
    background: linear-gradient(135deg, #66BB6A, #43A047);
    color: #fff;
}

.element-badge.element-Thủy {
    background: linear-gradient(135deg, #42A5F5, #1E88E5);
    color: #fff;
}

.element-badge.element-Hỏa {
    background: linear-gradient(135deg, #EF5350, #E53935);
    color: #fff;
}

.element-badge.element-Thổ {
    background: linear-gradient(135deg, #FFCA28, #FFB300);
    color: #000;
}

.thap-than-list {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

.dungthan-advice {
    background: rgba(212, 175, 55, 0.1);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-gold);
}

.dungthan-advice h4 {
    margin-bottom: 12px;
    color: var(--accent-gold);
}

.advice-text {
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.reasoning {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 12px;
}

.strategy {
    color: var(--accent-gold);
    font-size: 0.9rem;
    margin-top: 8px;
}

/* =============================================================================
   NEW: REFINED DỤNG THẦN SECTIONS (v3.2)
   ============================================================================= */

/* Refined Badge */
.refined-badge {
    background: linear-gradient(135deg, #FF9800, #FF5722);
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: normal;
    margin-left: 10px;
    vertical-align: middle;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
    }

    50% {
        box-shadow: 0 0 15px rgba(255, 152, 0, 0.8);
    }
}

/* Override Reasons Section */
.dungthan-override-section {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1) 0%, rgba(156, 39, 176, 0.1) 100%);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #FF9800;
    margin-bottom: 15px;
}

.dungthan-override-section h4 {
    color: #FFB74D;
    margin-bottom: 10px;
}

.override-reasons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.override-item {
    padding: 8px 12px;
    background: rgba(255, 152, 0, 0.15);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Structure Warnings Section */
.dungthan-warnings-section {
    background: rgba(244, 67, 54, 0.1);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #F44336;
    margin-bottom: 15px;
}

.dungthan-warnings-section h4 {
    color: #EF9A9A;
    margin-bottom: 10px;
}

.structure-warnings {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.warning-item {
    padding: 8px 12px;
    background: rgba(244, 67, 54, 0.1);
    border-radius: 6px;
    font-size: 0.9rem;
    color: #EF9A9A;
}

/* Career Suggestions Section */
.dungthan-career-section {
    background: rgba(33, 150, 243, 0.1);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #2196F3;
    margin-bottom: 15px;
}

.dungthan-career-section h4 {
    color: #64B5F6;
    margin-bottom: 10px;
}

.career-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.career-tag {
    padding: 6px 14px;
    background: rgba(33, 150, 243, 0.2);
    border-radius: 16px;
    font-size: 0.85rem;
    color: #90CAF9;
    border: 1px solid rgba(33, 150, 243, 0.3);
    transition: all 0.2s ease;
}

.career-tag:hover {
    background: rgba(33, 150, 243, 0.35);
    transform: translateY(-1px);
}

/* Health Suggestions Section */
.dungthan-health-section {
    background: rgba(76, 175, 80, 0.1);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
    margin-bottom: 15px;
}

.dungthan-health-section h4 {
    color: #81C784;
    margin-bottom: 10px;
}

.health-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.health-item {
    padding: 6px 10px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Mobile responsive for new sections */
@media (max-width: 768px) {
    .career-tags {
        flex-direction: column;
    }

    .career-tag {
        text-align: center;
    }

    .refined-badge {
        display: block;
        margin: 10px 0 0 0;
        text-align: center;
    }
}


/* =============================================================================
   DOMAIN ADVICE SECTION (Thập Thần Chi Tượng)
   ============================================================================= */

.domain-advice-section {
    background: linear-gradient(135deg, rgba(103, 58, 183, 0.1) 0%, rgba(63, 81, 181, 0.08) 100%);
    border: 1px solid rgba(103, 58, 183, 0.3);
    border-radius: 10px;
    padding: 16px;
    margin-top: 16px;
}

.domain-advice-section h6 {
    color: var(--accent-primary);
    font-size: 1rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.domain-summary {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.95rem;
    color: var(--text-primary);
    border-left: 3px solid var(--accent-primary);
}

.domain-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.domain-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid;
    border-radius: 8px;
    padding: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.domain-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.domain-card.status-opportunity {
    border-left-color: #4CAF50;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, transparent 50%);
}

.domain-card.status-warning {
    border-left-color: #FF9800;
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1) 0%, transparent 50%);
}

.domain-card.status-critical {
    border-left-color: #F44336;
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.1) 0%, transparent 50%);
}

.domain-card.status-neutral {
    border-left-color: #9E9E9E;
}

.domain-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.domain-icon {
    font-size: 1.3rem;
}

.domain-name {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.domain-status-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.domain-status-badge.opportunity {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
}

.domain-status-badge.warning {
    background: rgba(255, 152, 0, 0.2);
    color: #FF9800;
}

.domain-status-badge.critical {
    background: rgba(244, 67, 54, 0.2);
    color: #F44336;
}

.domain-status-badge.neutral {
    background: rgba(158, 158, 158, 0.2);
    color: #9E9E9E;
}

.domain-tengod {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.domain-content {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Actionable Steps */
.actionable-steps {
    background: rgba(0, 150, 136, 0.1);
    border: 1px solid rgba(0, 150, 136, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.actionable-steps h6 {
    color: #26A69A;
    margin-bottom: 10px;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.step-item {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Savior Advice */
.savior-advice {
    background: rgba(233, 30, 99, 0.1);
    border: 1px solid rgba(233, 30, 99, 0.3);
    border-radius: 8px;
    padding: 12px;
}

.savior-advice h6 {
    color: #EC407A;
    margin-bottom: 10px;
}

.savior-reason {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-style: italic;
}

.savior-action {
    font-size: 0.9rem;
    color: var(--text-primary);
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 8px;
}

.savior-status {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.savior-status.positive {
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.15);
}

.savior-status.negative {
    color: #FF9800;
    background: rgba(255, 152, 0, 0.15);
}

/* Mobile Responsive for Domain Advice */
@media (max-width: 768px) {
    .domain-cards {
        grid-template-columns: 1fr;
    }

    .domain-header {
        flex-wrap: wrap;
    }

    .domain-status-badge {
        margin-left: auto;
    }

    .domain-content {
        font-size: 0.85rem;
    }
}


/* =============================================================================
   DAY MASTER (NHẬT CHỦ) SECTION
   ============================================================================= */

.day-master-section {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(156, 39, 176, 0.08) 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.day-master-section h5 {
    color: var(--accent-gold);
    margin-bottom: 15px;
}

.day-master-box {
    text-align: center;
    padding: 20px;
}

.dm-main {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.dm-element {
    font-size: 2rem;
    font-weight: bold;
    padding: 15px 25px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
}

.dm-info {
    flex: 1;
}

.dm-score {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.dm-level {
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.dm-level.vuong_cuc,
.dm-level.qua_vuong {
    color: #4CAF50;
}

.dm-level.thien_vuong {
    color: #8BC34A;
}

.dm-level.trung_hoa {
    color: #FF9800;
}

.dm-level.thien_nhuoc {
    color: #FF5722;
}

.dm-level.qua_nhuoc,
.dm-level.nhuoc_cuc {
    color: #F44336;
}

.dm-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

.dm-status {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1rem;
}

.dm-status.status-vuong {
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
    color: #fff;
}

.dm-status.status-suy {
    background: linear-gradient(135deg, #F44336, #FF5722);
    color: #fff;
}

.dm-status.status-medium {
    background: linear-gradient(135deg, #2196F3, #03A9F4);
    color: #fff;
}

.dm-detail {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

/* =============================================================================
   LAYMAN-FRIENDLY SUMMARY BLOCK (Energy Meter + Description)
   ============================================================================= */

.dm-layman-summary {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.08) 0%, rgba(33, 150, 243, 0.08) 100%);
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 20px;
}

.dm-summary-headline {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.dm-energy-icon {
    font-size: 2rem;
    line-height: 1;
}

.dm-energy-label {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: -0.3px;
}

.dm-summary-explanation {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.dm-summary-advice {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #81C784;
    padding: 10px 14px;
    background: rgba(76, 175, 80, 0.08);
    border-radius: 8px;
    border-left: 3px solid #4CAF50;
    margin-bottom: 14px;
}

/* Energy Meter */
.dm-energy-meter {
    margin-top: 4px;
}

.dm-energy-meter .meter-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.dm-energy-meter .meter-track {
    position: relative;
    height: 14px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    overflow: visible;
}

.dm-energy-meter .meter-fill {
    height: 100%;
    border-radius: 7px;
    transition: width 0.8s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dm-energy-meter .meter-fill.vuong_cuc,
.dm-energy-meter .meter-fill.qua_vuong {
    background: linear-gradient(90deg, #4CAF50, #66BB6A, #81C784);
}

.dm-energy-meter .meter-fill.thien_vuong {
    background: linear-gradient(90deg, #8BC34A, #AED581);
}

.dm-energy-meter .meter-fill.trung_hoa {
    background: linear-gradient(90deg, #FF9800, #FFB74D);
}

.dm-energy-meter .meter-fill.thien_nhuoc {
    background: linear-gradient(90deg, #42A5F5, #64B5F6);
}

.dm-energy-meter .meter-fill.qua_nhuoc {
    background: linear-gradient(90deg, #AB47BC, #BA68C8);
}

.dm-energy-meter .meter-fill.nhuoc_cuc {
    background: linear-gradient(90deg, #78909C, #90A4AE);
}

.dm-energy-meter .meter-marker {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 20px;
    background: rgba(255, 255, 255, 0.4);
    transform: translateX(-50%);
}

.dm-energy-meter .meter-marker .marker-label {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.dm-energy-meter .meter-range {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* =============================================================================
   DOMAIN LAYMAN PREDICTION 
   ============================================================================= */

.domain-layman-prediction {
    padding: 10px 12px;
    margin: 8px 0 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    border-left: 3px solid rgba(212, 175, 55, 0.5);
}

.domain-layman-prediction .prediction-text {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Mobile responsive for layman summary */
@media (max-width: 768px) {
    .dm-layman-summary {
        padding: 14px 16px;
    }

    .dm-summary-headline {
        gap: 10px;
    }

    .dm-energy-icon {
        font-size: 1.6rem;
    }

    .dm-energy-label {
        font-size: 1.1rem;
    }

    .dm-summary-explanation {
        font-size: 0.9rem;
    }

    .dm-summary-advice {
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    .domain-layman-prediction .prediction-text {
        font-size: 0.85rem;
    }
}

/* Dụng Thần Box inside Day Master Section */
.dung-than-box {
    margin-top: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

.dung-than-box h6 {
    color: var(--accent-gold);
    margin-bottom: 12px;
    font-size: 1rem;
}

.dung-than-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 10px;
}

.dung-than-item {
    padding: 12px;
    border-radius: 6px;
}

.dung-than-item.good {
    background: rgba(76, 175, 80, 0.15);
    border-left: 3px solid #4CAF50;
}

.dung-than-item.bad {
    background: rgba(244, 67, 54, 0.15);
    border-left: 3px solid #F44336;
}

.dung-than-item .label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.dung-than-item .elements {
    font-size: 1.1rem;
}

.dung-than-advice {
    padding: 10px;
    background: rgba(33, 150, 243, 0.1);
    border-radius: 6px;
    color: #90CAF9;
    font-style: italic;
    line-height: 1.5;
}

/* =============================================================================
   SECTION & STEP-BASED LOGS
   ============================================================================= */

.Nâng Cao-section {
    background: rgba(0, 0, 0, 0.25);
}

/* Priority subheader within groups */
.priority-subheader {
    padding: 8px 12px;
    margin: 8px 0 4px 0;
    background: rgba(156, 39, 176, 0.15);
    border-left: 3px solid #9C27B0;
    color: #CE93D8;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 4px;
}

/* Log item types specific to Nguyên Cục */
.log-pillar_internal {
    border-left: 3px solid #7E57C2;
}

.log-can_interaction {
    border-left: 3px solid #42A5F5;
}

.log-seasonal_modifiers,
.log-seasonal_detail {
    border-left: 3px solid #AB47BC;
}

.log-day_master {
    border-left: 3px solid var(--accent-gold);
    font-weight: 600;
}

/* Step-based log display */
.step-based-logs {
    padding: 10px;
}

.step-group {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.step-group .step-header {
    padding: 12px 15px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2) 0%, rgba(156, 39, 176, 0.15) 100%);
    color: var(--accent-gold);
    font-weight: bold;
    font-size: 1rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.step-group .step-content {
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
}

.step-group .log-item {
    padding: 6px 12px;
    margin: 4px 0;
    font-size: 0.85rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    line-height: 1.5;
}

.log-priority_header {
    background: rgba(156, 39, 176, 0.15) !important;
    color: #CE93D8;
    font-weight: 600;
    margin-top: 8px !important;
}

.log-note {
    background: rgba(33, 150, 243, 0.1) !important;
    color: #64B5F6;
    font-style: italic;
}

.log-can_sinh {
    border-left: 3px solid #4CAF50;
    color: #81C784;
}

.log-can_khac {
    border-left: 3px solid #F44336;
    color: #EF9A9A;
}

.log-can_skip_busy {
    border-left: 3px solid #9E9E9E;
    background: rgba(158, 158, 158, 0.1) !important;
    color: #BDBDBD;
    font-style: italic;
}

.log-thong_quan {
    border-left: 3px solid #4CAF50;
    background: rgba(76, 175, 80, 0.15) !important;
    color: #81C784;
    font-weight: 600;
}

.log-can_hop_pending {
    border-left: 3px solid #FF9800;
    color: #FFB74D;
}

.log-final_summary {
    background: rgba(212, 175, 55, 0.15) !important;
    color: var(--accent-gold);
    font-weight: bold;
    font-size: 1rem !important;
}

.log-final_element {
    color: var(--text-primary);
}

.log-mo_kho_status {
    border-left: 3px solid #9E9E9E;
    color: #BDBDBD;
}

.log-stem_combine,
.log-luc_hop,
.log-tam_hop,
.log-ban_tam_hop {
    border-left: 3px solid #4CAF50;
    color: #A5D6A7;
}

/* Tam Hợp CONCLUSION - Stand out with gold */
.log-tam_hop_conclusion {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.2), rgba(255, 215, 0, 0.1)) !important;
    border-left: 4px solid var(--accent-gold) !important;
    border-radius: 4px !important;
    padding: 10px 14px !important;
    margin: 8px 0 !important;
    color: var(--accent-gold) !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
}

/* Tam Hội CONCLUSION - Stand out with blue (Thủy cục) */
.log-tam_hoi_conclusion {
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.25), rgba(0, 188, 212, 0.15)) !important;
    border-left: 4px solid #2196F3 !important;
    border-radius: 4px !important;
    padding: 10px 14px !important;
    margin: 8px 0 !important;
    color: #64B5F6 !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
}

/* Tam Hội effect details */
.log-tam_hoi_effect {
    border-left: 3px solid #03A9F4;
    background: rgba(3, 169, 244, 0.08) !important;
    color: #81D4FA;
    padding-left: 20px !important;
}

.log-xung,
.log-tranh_xung,
.log-tranh_xung_damage {
    border-left: 3px solid #F44336;
    color: #EF9A9A;
}

.log-hinh,
.log-hinh_damage {
    border-left: 3px solid #FF9800;
    color: #FFB74D;
}

.log-hai {
    border-left: 3px solid #9C27B0;
    color: #CE93D8;
}

.log-pha {
    border-left: 3px solid #3F51B5;
    color: #7986CB;
}

/* =============================================================================
   RESPONSIVE - Mobile Adjustments for Nguyên Cục
   ============================================================================= */

@media (max-width: 768px) {
    .dungthan-elements {
        grid-template-columns: 1fr;
    }

    .strength-badge {
        font-size: 1.1rem;
        padding: 10px 20px;
    }

    .dm-main {
        flex-direction: column;
        text-align: center;
    }

    .dm-element {
        font-size: 1.4rem;
    }

    .dm-score {
        font-size: 1.2rem;
    }

    .dung-than-grid {
        grid-template-columns: 1fr;
    }

    .calc-table {
        font-size: 0.8rem;
    }

    .calc-table th,
    .calc-table td {
        padding: 6px 4px;
    }
}

/* =============================================================================
   COLLAPSIBLE DETAILS COMPONENT (Phase 27)
   ============================================================================= */

.collapsible-section {
    position: relative;
}

/* Details element base */
.calculation-details {
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

/* Summary (clickable header) */
.calculation-details summary {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.18) 0%, rgba(156, 39, 176, 0.12) 100%);
    border-radius: 8px;
    color: var(--accent-gold);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    list-style: none;
    /* Remove default marker */
    border: 1px solid rgba(212, 175, 55, 0.25);
}

/* Remove default marker for Chrome/Safari */
.calculation-details summary::-webkit-details-marker {
    display: none;
}

/* Remove default marker for Firefox */
.calculation-details summary::marker {
    display: none;
    content: '';
}

/* Hover state */
.calculation-details summary:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.28) 0%, rgba(156, 39, 176, 0.18) 100%);
    border-color: rgba(212, 175, 55, 0.4);
}

/* Focus state for accessibility */
.calculation-details summary:focus {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

.calculation-details summary:focus:not(:focus-visible) {
    outline: none;
}

/* Toggle icon */
.toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.15);
    border-radius: 4px;
}

.calculation-details[open] .toggle-icon {
    transform: rotate(90deg);
}

/* Hint text */
.toggle-hint {
    margin-left: auto;
    font-weight: normal;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.8;
}

.calculation-details[open] .toggle-hint {
    display: none;
}

/* Content container with animation */
.details-content {
    padding: 15px;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    animation: detailsSlideDown 0.3s ease-out;
}

@keyframes detailsSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Open state indicator */
.calculation-details[open] summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(156, 39, 176, 0.15) 100%);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .calculation-details summary {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    .toggle-icon {
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
    }

    .toggle-hint {
        font-size: 0.75rem;
    }

    .details-content {
        padding: 12px;
    }
}

/* =============================================================================
   ĐẠI VẬN EVOLUTION LINE CHART (SVG-based)
   ============================================================================= */

.evolution-section.line-chart-section {
    margin-top: 25px;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.08) 0%, rgba(156, 39, 176, 0.08) 100%);
    border: 1px solid rgba(33, 150, 243, 0.3);
    padding: 20px;
}

.evolution-section h5 {
    color: #64B5F6;
    margin-bottom: 8px;
}

.evolution-section .section-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 15px;
    font-style: italic;
}

/* Line Chart Legend */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.chart-legend-item:hover {
    opacity: 0.8;
}

.chart-legend-item .legend-line {
    width: 24px;
    height: 4px;
    border-radius: 2px;
}

.chart-legend-item .legend-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* SVG Chart Container */
.line-chart-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 15px;
    overflow-x: auto;
}

.evolution-svg {
    width: 100%;
    min-width: 600px;
    height: auto;
}

/* Grid Lines */
.grid-line {
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1;
    stroke-dasharray: 4 4;
}

.grid-line-vertical {
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 1;
    stroke-dasharray: 2 4;
}

/* Axis Lines */
.axis-line {
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 2;
}

/* Axis Labels */
.axis-label {
    fill: var(--text-secondary);
    font-size: 11px;
    font-family: 'Roboto', sans-serif;
}

.axis-label.x-label {
    fill: #90CAF9;
}

/* 2-Line X-axis labels: Can Chi + Age */
.axis-label.x-label-main {
    fill: #90CAF9;
    font-size: 10px;
    font-weight: 600;
}

.axis-label.x-label-sub {
    fill: var(--text-secondary);
    font-size: 9px;
    font-style: italic;
}

.axis-title {
    fill: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
}

/* Trend Lines */
.trend-line {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke-width 0.2s ease, opacity 0.2s ease;
}

.trend-line:hover {
    stroke-width: 4;
}

/* Element-specific line colors */
.element-line-Kim {
    stroke: #BDBDBD;
}

.element-line-Mộc {
    stroke: #66BB6A;
}

.element-line-Thủy {
    stroke: #42A5F5;
}

.element-line-Hỏa {
    stroke: #EF5350;
}

.element-line-Thổ {
    stroke: #FFCA28;
}

/* Data Points */
.data-point {
    fill: rgba(30, 30, 40, 0.9);
    stroke-width: 2.5;
    cursor: pointer;
    transition: r 0.15s ease, fill 0.15s ease;
}

.data-point:hover {
    r: 8;
    fill: white;
}

/* Element-specific point colors */
.element-point-Kim {
    stroke: #BDBDBD;
}

.element-point-Mộc {
    stroke: #66BB6A;
}

.element-point-Thủy {
    stroke: #42A5F5;
}

.element-point-Hỏa {
    stroke: #EF5350;
}

.element-point-Thổ {
    stroke: #FFCA28;
}

/* Chart Note */
.chart-note {
    margin-top: 12px;
    text-align: center;
}

.chart-note small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 768px) {
    .line-chart-container {
        padding: 10px;
    }

    .chart-legend {
        gap: 16px;
        padding: 8px 12px;
    }

    .chart-legend-item .legend-line {
        width: 18px;
    }

    .chart-legend-item .legend-label {
        font-size: 0.8rem;
    }

    .evolution-svg {
        min-width: 500px;
    }
}

/* =============================================================================
   COLLAPSIBLE TOGGLE SECTIONS (Group G UI Improvement)
   ============================================================================= */

/* Toggle Header - Clickable */
.dungthan-toggle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(103, 58, 183, 0.15) 0%, rgba(63, 81, 181, 0.1) 100%);
    border: 1px solid rgba(103, 58, 183, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 16px;
    user-select: none;
}

.dungthan-toggle-header:hover {
    background: linear-gradient(135deg, rgba(103, 58, 183, 0.25) 0%, rgba(63, 81, 181, 0.15) 100%);
    border-color: rgba(103, 58, 183, 0.5);
}

.dungthan-toggle-header .toggle-title {
    font-weight: 600;
    color: var(--accent-primary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dungthan-toggle-header .toggle-chevron {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    color: var(--accent-primary);
}

.dungthan-toggle-header.expanded .toggle-chevron {
    transform: rotate(180deg);
}

/* Toggle Content - Hidden by default */
.dungthan-toggle-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 0 8px 8px;
    border: 1px solid rgba(103, 58, 183, 0.2);
    border-top: none;
    margin-top: -4px;
}

.dungthan-toggle-content.expanded {
    max-height: 2000px;
    padding: 16px;
}

/* Quick Conclusion Card - Always visible */
.dungthan-quick-conclusion {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(33, 150, 243, 0.1) 100%);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 10px;
    padding: 16px;
    margin: 16px 0;
}

.dungthan-quick-conclusion h6 {
    color: #4CAF50;
    margin-bottom: 12px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.conclusion-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.conclusion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid;
}

.conclusion-item.direction {
    border-left-color: #4CAF50;
}

.conclusion-item.color {
    border-left-color: #E91E63;
}

.conclusion-item.career {
    border-left-color: #2196F3;
}

.conclusion-item.avoid {
    border-left-color: #F44336;
}

.conclusion-item .item-icon {
    font-size: 1.3rem;
}

.conclusion-item .item-content {
    flex: 1;
}

.conclusion-item .item-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.conclusion-item .item-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Mobile responsive for toggle */
@media (max-width: 768px) {
    .conclusion-grid {
        grid-template-columns: 1fr;
    }

    .dungthan-toggle-header {
        padding: 10px 12px;
    }

    .dungthan-toggle-header .toggle-title {
        font-size: 0.9rem;
    }

    .dungthan-toggle-content.expanded {
        padding: 12px;
    }

    .conclusion-item {
        padding: 8px 10px;
    }
}