/* style.css (Modified) */

/* Global Reset & Box Sizing */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px; /* Base font size */
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    display: flex;
    background: #f0f2f5; /* Slightly different background for contrast */
    min-height: 100vh;
    padding: 20px; /* Padding around the entire layout */
    gap: 20px; /* Space between columns */
    overflow: hidden; /* Prevent body scrolling, columns will scroll */
}

/* --- Column Styling --- */

/* Base styles for all columns */
.sidebar,
.main-content,
.right-panel {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow-y: auto; /* Enable vertical scrolling within each column */
    height: calc(100vh - 40px); /* Full height minus body padding */
}

/* Column 1: Sidebar */
.sidebar {
    flex: 0 0 220px; /* Don't grow, don't shrink, base width 320px */
    /* Existing sidebar styles like padding adjusted for consistency */
}

/* Column 2: Main Content (Cards) */
.main-content {
    flex: 1 1 auto; /* Grow and shrink, take up remaining space */
    /* Existing content styles like padding adjusted */
}

/* Column 3: Right Panel (Stats & Aspects) */
.right-panel {
    flex: 0 0 340px; /* Adjust width as needed */
    display: flex; /* Arrange children vertically */
    flex-direction: column;
    gap: 20px; /* Space between stats and aspect tool */
}

/* --- Element Styling (Mostly unchanged, some minor adjustments) --- */

h2, h3 {
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.interpretation-card {
    margin-bottom: 15px; /* Adjusted margin */
    padding: 18px; /* Slightly adjusted padding */
    background: #ffffff;
    border-radius: 8px; /* Slightly smaller radius */
    border-left: 5px solid #4a90e2; /* Example color */
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease-in-out;
}
.interpretation-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.interpretation-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.interpretation-card p {
    white-space: pre-line;
    line-height: 1.65; /* Increased line-height */
    font-size: 0.9rem;
    color: #555;
}

.planet-icon {
    font-size: 1.4rem;
    color: #4a90e2;
}

.tags {
    display: flex;
    flex-wrap: wrap; /* Allow tags to wrap */
    gap: 6px;
    margin-bottom: 12px; /* Adjusted margin */
}

.tag {
    background: #e8f0fe;
    color: #4a90e2;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
}

.close-btn {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #aaa;
    transition: color 0.2s;
    padding: 5px; /* Easier to click */
    line-height: 1;
}

.close-btn:hover {
    color: #e74c3c;
}

/* Sidebar Specific */
.celestial-title {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ecf0f1;
    font-weight: 600;
}

.menu-group {
    display: flex;
    /* flex-direction: column; */ /* <--- 移除或注释掉这一行 */
    flex-direction: row;      /* <--- 或者显式设置为 row (这是默认值) */
    gap: 10px;                 /* <--- 保持或调整间隙 */
    margin-bottom: 15px;
}

.dropdown {
    flex: 1; /* 让每个下拉菜单容器平分空间 */
}

.dropdown label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: #666;
}

select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    background: #fdfdfd;
    font-size: 0.9rem;
    cursor: pointer;
}
select:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* Stats Tables Styling */
.stats-container {
     /* Container for stats tables */
     /* No extra styles needed unless specific spacing required */
}

.stats-container h3 { /* Adjusted selector */
    font-size: 1rem;
}

#zodiacStats,
#houseStats {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px; /* Space below each table */
    font-size: 0.85rem;
}

#zodiacStats th, #zodiacStats td,
#houseStats th, #houseStats td {
    padding: 10px 12px; /* Adjusted padding */
    text-align: center;
    border: 1px solid #eef2f7;
}

#zodiacStats th,
#houseStats th {
    background: #f8f9fb;
    color: #333;
    font-weight: 600;
}

#zodiacStats td,
#houseStats td {
    background: white;
    color: #555;
}

#zodiacStats tr:not(.column-total):hover td,
#houseStats tr:not(.house-column-total):hover td {
    background-color: #f5f7fa;
}

.column-total td,
.house-column-total td {
    background-color: #e8f0fe !important;
    font-weight: 600;
    color: #4a90e2;
}

#zodiacStats td:last-child,
#houseStats td:last-child {
    /* Style for row totals - slightly distinct background */
    background-color: #f9f9f9;
    font-weight: 500;
}

/* Aspect Query Styling */
.phase-query-container {
    /* border: 1px solid #e0e0e0; */ /* Optional border */
    border-radius: 8px;
    padding: 15px;
    background-color: #fdfdfd; /* Slightly off-white */
    /* No margin-top needed, rely on right-panel gap */
}
.phase-query-container h3 {
    font-size: 1rem;
}

.aspect-query-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.aspect-query-table th {
    padding: 8px;
    text-align: center;
    background-color: #f2f5f8;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
}

.aspect-query-table td {
    padding: 8px;
    text-align: center;
    vertical-align: top; /* Align selects to the top */
}

.table-select {
    width: 100%; /* Use full cell width */
    /* Existing select styles apply */
}

.result-panel {
    /* padding: 15px; */ /* Padding provided by container */
    /* border: 1px solid #e0e0e0; */
    border-radius: 4px;
    background-color: white;
    min-height: 80px;
    margin-top: 10px;
}

.result-panel h3 {
    font-size: 0.9rem;
    margin-top: 0;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

#result-content p {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.6;
    white-space: pre-line;
}

#result-content .error {
    color: #d9534f; /* Bootstrap danger color */
    font-weight: bold;
}


/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px; /* Slimmer scrollbar */
    height: 6px;
    background-color: #f5f5f5;
}

::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #aaa;
}

/* Responsive (Simple Example: Stack columns on small screens) */
@media (max-width: 1024px) { /* Adjust breakpoint as needed */
     .right-panel {
        flex-basis: 300px; /* Narrower right panel on medium screens */
     }
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
        height: auto; /* Allow body to grow */
        padding: 10px; /* Less padding on mobile */
        gap: 15px;
    }

    .sidebar,
    .main-content,
    .right-panel {
        flex-basis: auto; /* Reset flex-basis */
        width: 100%; /* Full width */
        height: auto; /* Allow height to adjust to content */
        max-height: 60vh; /* Limit height with scrolling */
    }
}