/**
 * QiMen HuyenKhong Frontend Styles
 */

/* Chart Container */
.qimen-chart-container {
    max-width: 100%;
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.qimen-chart-header {
    text-align: center;
    margin-bottom: 20px;
}

.qimen-chart-header h3 {
    color: #333;
    margin-bottom: 10px;
}

.qimen-chart-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 14px;
    color: #666;
}

.qimen-chart-info span {
    white-space: nowrap;
}

/* Palace Grid */
.qimen-palace-table {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-collapse: collapse;
}

.qimen-palace-table td {
    width: 33.33%;
    height: 150px;
    border: 2px solid #ddd;
    padding: 10px;
    vertical-align: top;
    background: white;
}

.palace-center {
    background: #f0f0f0 !important;
    text-align: center;
    vertical-align: middle !important;
    font-weight: bold;
    color: #999;
}

/* Individual Palace */
.qimen-palace {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.palace-header {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.palace-content {
    flex: 1;
    font-size: 12px;
}

.palace-content > div {
    margin: 3px 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.palace-content .label {
    color: #666;
    min-width: 35px;
}

.palace-content .value {
    font-weight: 500;
    color: #333;
}

.palace-content .score {
    margin-left: auto;
    font-weight: bold;
    padding: 0 4px;
    border-radius: 3px;
}

.palace-footer {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #eee;
    text-align: right;
}

.total-score {
    font-weight: bold;
    font-size: 14px;
}

/* Value Colors */
.score:contains("+") {
    color: #22c55e;
}

.score:contains("-") {
    color: #ef4444;
}

/* Palace Quality Classes */
.qimen-palace.excellent {
    background: #f0fdf4;
    border-color: #22c55e;
}

.qimen-palace.good {
    background: #f7fee7;
    border-color: #84cc16;
}

.qimen-palace.neutral {
    background: #fefce8;
    border-color: #facc15;
}

.qimen-palace.bad {
    background: #fff7ed;
    border-color: #fb923c;
}

.qimen-palace.terrible {
    background: #fef2f2;
    border-color: #ef4444;
}

/* Daily Overview */
.qimen-daily-overview {
    margin: 20px 0;
}

.hours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.hour-block {
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid #ddd;
    background: white;
    transition: transform 0.2s;
}

.hour-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.hour-time {
    font-weight: bold;
    margin-bottom: 5px;
}

.hour-branch {
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.hour-score {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 3px;
}

.hour-rating {
    font-size: 12px;
    text-transform: uppercase;
}

/* Hour Quality Classes */
.hour-excellent {
    background: #22c55e;
    color: white;
    border-color: #16a34a;
}

.hour-good {
    background: #84cc16;
    color: white;
    border-color: #65a30d;
}

.hour-neutral {
    background: #facc15;
    color: #333;
    border-color: #eab308;
}

.hour-bad {
    background: #fb923c;
    color: white;
    border-color: #f97316;
}

.hour-terrible {
    background: #ef4444;
    color: white;
    border-color: #dc2626;
}

/* Analysis Section */
.qimen-analysis {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.analysis-summary {
    text-align: center;
    margin-bottom: 20px;
}

.rating {
    display: inline-block;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 18px;
}

.rating-5 {
    background: #22c55e;
    color: white;
}

.rating-4 {
    background: #84cc16;
    color: white;
}

.rating-3 {
    background: #facc15;
    color: #333;
}

.rating-2 {
    background: #fb923c;
    color: white;
}

.rating-1 {
    background: #ef4444;
    color: white;
}

.rating-label {
    margin-right: 10px;
}

.rating-score {
    font-weight: bold;
}

.analysis-details h5 {
    margin-top: 15px;
    margin-bottom: 10px;
    color: #333;
}

.good-activities {
    color: #22c55e;
}

.bad-activities {
    color: #ef4444;
}

.analysis-recommendations {
    margin-top: 20px;
    padding: 15px;
    background: #f3f4f6;
    border-radius: 6px;
}

/* Best Hours Table */
.best-hours-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.best-hours-table th,
.best-hours-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.best-hours-table th {
    background: #f3f4f6;
    font-weight: bold;
}

.best-hours-table tr.rating-5 td {
    background: #f0fdf4;
}

.best-hours-table tr.rating-4 td {
    background: #f7fee7;
}

.best-hours-table tr.rating-3 td {
    background: #fefce8;
}

.best-hours-table tr.rating-2 td {
    background: #fff7ed;
}

.best-hours-table tr.rating-1 td {
    background: #fef2f2;
}

/* Lục Hào Table in Sidebar */
.luc-hao-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 12px;
}

.luc-hao-table th,
.luc-hao-table td {
    padding: 6px 8px;
    text-align: center;
    border: 1px solid #ddd;
}

.luc-hao-table th {
    background: #2c3e50;
    color: white;
    font-weight: bold;
    font-size: 11px;
}

.luc-hao-table td.hao-symbol {
    font-family: monospace;
    font-size: 14px;
    font-weight: bold;
    color: #2c3e50;
}

.luc-hao-table tr.hao-dong {
    background: #ffebee;
}

.luc-hao-table tr.hao-dong td {
    color: #d32f2f;
    font-weight: bold;
}

.luc-hao-table .dong-marker {
    color: #d32f2f;
    font-size: 10px;
    margin-left: 4px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Analysis Form */
.qimen-analysis-form {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.qimen-submit {
    background: #3b82f6;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.qimen-submit:hover {
    background: #2563eb;
}

/* Legend */
.qimen-legend {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.color-box.excellent {
    background: #22c55e;
}

.color-box.good {
    background: #84cc16;
}

.color-box.neutral {
    background: #facc15;
}

.color-box.bad {
    background: #fb923c;
}

.color-box.terrible {
    background: #ef4444;
}

/* Widget Styles */
.qimen-widget {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.current-time {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin: 10px 0;
}

.quick-analysis {
    text-align: center;
    margin: 15px 0;
}

.score-display {
    margin-bottom: 10px;
}

.score-display .score {
    font-size: 24px;
    font-weight: bold;
    margin-right: 10px;
}

.recommendation {
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
}

.recommendation.excellent {
    background: #f0fdf4;
    color: #16a34a;
}

.recommendation.good {
    background: #f7fee7;
    color: #65a30d;
}

.recommendation.neutral {
    background: #fefce8;
    color: #a16207;
}

.recommendation.poor {
    background: #fff7ed;
    color: #c2410c;
}

.recommendation.bad {
    background: #fef2f2;
    color: #b91c1c;
}

/* Responsive Design */
@media (max-width: 768px) {
    .qimen-chart-info {
        flex-direction: column;
        gap: 5px;
    }
    
    .qimen-palace-table td {
        height: 120px;
        padding: 5px;
        font-size: 11px;
    }
    
    .palace-content .label {
        min-width: 30px;
    }
    
    .hours-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .legend-items {
        flex-direction: column;
        gap: 8px;
    }
}

/* Direction Check Styles */
.qimen-direction-check {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.direction-result {
    margin-top: 15px;
    padding: 20px;
    border-radius: 6px;
    border: 2px solid;
}

.direction-result.good {
    background: #f0fdf4;
    border-color: #22c55e;
}

.direction-result.bad {
    background: #fef2f2;
    border-color: #ef4444;
}

.result-summary {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 18px;
}

.result-icon {
    font-size: 36px;
    font-weight: bold;
}

.direction-result.good .result-icon {
    color: #22c55e;
}

.direction-result.bad .result-icon {
    color: #ef4444;
}

.result-details {
    margin-bottom: 20px;
}

.result-details p {
    margin: 8px 0;
}

.door-analysis {
    font-weight: 500;
    color: #333;
}

.direction-values {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.direction-values th,
.direction-values td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.direction-values th {
    background: #f3f4f6;
    font-weight: bold;
}

.direction-values tr.total {
    background: #f9f9f9;
}

.direction-values tr.total td {
    border-top: 2px solid #333;
    border-bottom: none;
}

.direction-values .score {
    text-align: right;
    font-weight: bold;
    font-family: monospace;
}

.analysis-text {
    margin-top: 20px;
    padding: 15px;
    background: #f3f4f6;
    border-radius: 6px;
}

/* Simplified Hexagram Table - No Borders */
.hexagram-display-table-simple {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.hexagram-row-simple {
    display: grid;
    grid-template-columns: 1fr 120px 100px;
    padding: 8px 12px;
    background: white;
    position: relative;
    align-items: center;
    gap: 10px;
}

.hexagram-row-simple:hover {
    background: #f8f9fa;
}

.hexagram-row-simple.moving-line {
    background: #ffebee;
    font-weight: bold;
    color: #c62828;
}

.hexagram-row-simple.moving-line .col-line-symbol {
    color: #e74c3c;
}

.col-element {
    text-align: center;
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.moving-line .col-element {
    color: #c62828;
    font-weight: bold;
}

/* New Hourly Widget Styles */
.qimen-hourly-widget {
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.qimen-hourly-widget .widget-section {
    margin-bottom: 20px;
}

.qimen-hourly-widget .widget-section h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: #374151;
    font-weight: 600;
}

/* Huyền không grid */
.huyen-khong-grid {
    margin: 10px 0;
}

.huyen-khong-row {
    display: flex;
    justify-content: center;
}

.huyen-khong-cell {
    width: 65px;
    height: 55px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    padding: 4px;
    text-align: center;
    position: relative;
    border-radius: 3px;
}

.huyen-khong-cell .star-number {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    color: #374151;
    margin-top: 6px;
}

.huyen-khong-cell .star-name {
    font-size: 11px;
    font-weight: normal;
    color: #6b7280;
    margin-top: 4px;
    line-height: 1.2;
    text-transform: none;
}

.huyen-khong-cell.highlight-yellow {
    background: #fef3c7;
    border-color: #fbbf24;
}

.huyen-khong-cell.center {
    border: 2px solid #7c3aed;
}

/* Kỳ Môn Section */
.qimen-section {
    margin-top: 20px;
}

.qimen-section h4 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #374151;
}

.qimen-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.palace-cell {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 8px;
    text-align: center;
    position: relative;
}

.palace-cell.highlight-yellow {
    background: #fef3c7;
    border-color: #fbbf24;
}

.palace-num {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 10px;
    color: #9ca3af;
}

.palace-door {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.palace-door.good-door {
    color: #059669;
    font-weight: bold;
}

.palace-score {
    font-size: 16px;
    font-weight: bold;
    color: #374151;
}

.palace-cell.empty {
    background: transparent;
    border: none;
}

/* Kinh Dịch styles */
.kinh-dich-info {
    text-align: center;
    padding: 10px;
    background: #f9fafb;
    border-radius: 4px;
}

.gua-name {
    font-size: 16px;
    font-weight: 500;
    color: #374151;
}

.trigram-info {
    font-size: 24px;
    margin-top: 5px;
    font-family: monospace;
    letter-spacing: 2px;
}

/* Lục Hào styles */
.luc-hao-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 4px;
}

.hao-line {
    font-family: monospace;
    font-size: 20px;
    line-height: 1;
    color: #374151;
}

.hao-line.hao-dong {
    color: #dc2626;
    font-weight: bold;
    position: relative;
}

.hao-line.hao-dong::after {
    content: '◉';
    position: absolute;
    right: -20px;
    font-size: 12px;
    color: #dc2626;
}

.dong-marker {
    font-size: 12px;
    color: #dc2626;
    font-weight: bold;
    margin-left: 5px;
}

/* Simplified Lục Hào in Sidebar */
.luc-hao-simple {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: #f9fafb;
    border-radius: 4px;
}

.hao-row-simple {
    display: grid;
    grid-template-columns: 1fr 80px 80px;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: white;
    border-radius: 2px;
}

.hao-row-simple.hao-dong {
    background: #ffebee;
    color: #d32f2f;
    font-weight: bold;
}

.hao-row-simple .hao-symbol {
    font-family: monospace;
    font-size: 18px;
    font-weight: bold;
    color: #374151;
    text-align: center;
}

.hao-row-simple.hao-dong .hao-symbol {
    color: #dc2626;
}

.hao-row-simple .luc-than {
    font-size: 12px;
    text-align: center;
    color: #555;
}

.hao-row-simple.hao-dong .luc-than {
    color: #d32f2f;
    font-weight: bold;
}

.hao-row-simple .element {
    font-size: 11px;
    text-align: center;
    color: #666;
    font-weight: 500;
}

.hao-row-simple.hao-dong .element {
    color: #d32f2f;
    font-weight: bold;
}
