/* --- CSS Variables for Theming --- */
#am-loshu-container {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --text-color-light: #ccc;
    --gold-color: #D4AF37;
    --border-color: #444;
    --input-bg: #333;
    --cell-bg: #2a2a2a;
    --cell-bg-missing: #222;
    --list-item-bg: rgba(212, 175, 55, 0.05);
    --cta-gradient: radial-gradient(circle, #382c0b, #1a1a1a);
    --btn-text-color: #1a1a1a;
    --slider-bg: #ccc;
}

#am-loshu-container.light-theme {
    --bg-color: #fdfdfd;
    --text-color: #333333;
    --text-color-light: #555555;
    --gold-color: #b98e28;
    --border-color: #cccccc; 
    --input-bg: #eeeeee;
    --cell-bg: #f5f5f5;
    --cell-bg-missing: #f0f0f0;
    --list-item-bg: rgba(185, 142, 40, 0.1);
    --cta-gradient: radial-gradient(circle, #f5efe1, #fdfdfd);
    --btn-text-color: #ffffff;
    --slider-bg: #888;
}

/* Main Container */
#am-loshu-container {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    padding: 30px;
    border-radius: 15px;
    border: 1px solid var(--gold-color);
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
.am-loshu-header h2 { color: var(--text-color); text-align: center; margin-top: 0; margin-bottom: 10px; }
.am-loshu-header p { text-align: center; max-width: 450px; margin: 0 auto 30px; color: var(--text-color-light); font-size: 0.95em; line-height: 1.5; }

/* Form Layout */
.am-dob-label { display: block; text-align: center; margin-bottom: 10px; font-weight: bold; color: var(--text-color-light); }
.am-form-input-wrapper { margin-bottom: 15px; }
#am-loshu-form input[type="date"], #am-calculate-btn { width: 100%; max-width: 600px; display: block; margin-left: auto; margin-right: auto; box-sizing: border-box; }
#am-loshu-form input[type="date"] { background: var(--input-bg); color: var(--text-color); border: 1px solid var(--border-color); padding: 12px; border-radius: 8px; font-family: inherit; text-align: center; }
#am-calculate-btn { background-color: var(--gold-color); color: var(--btn-text-color); font-weight: bold; border: none; padding: 14px 28px; border-radius: 8px; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; }
#am-calculate-btn:hover { transform: scale(1.05); box-shadow: 0 0 15px var(--gold-color); }

/* --- UPDATED: Theme Toggle & Icon Styles --- */
.am-bottom-controls { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 25px 0; }
.am-theme-icon svg { width: 24px; height: 24px; fill: var(--text-color-light); }
.am-theme-icon .sun-icon { display: none; }
.am-theme-icon .moon-icon { display: block; }
#am-loshu-container.light-theme .am-theme-icon .sun-icon { display: block; }
#am-loshu-container.light-theme .am-theme-icon .moon-icon { display: none; }
.am-theme-switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.am-theme-switch input { opacity: 0; width: 0; height: 0; }
.am-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--slider-bg); transition: .4s; border-radius: 26px; }
.am-slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .am-slider { background-color: var(--gold-color); }
input:checked + .am-slider:before { transform: translateX(24px); }

/* Results Area */
#am-loshu-results.hidden { display: none; }
#am-loshu-results h4 { text-align: center; color: var(--gold-color); font-size: 1.2em; }
#am-grid-display { display: grid; grid-template-columns: repeat(3, minmax(80px, 100px)); gap: 10px; justify-content: center; margin: 20px 0 40px; }
.am-grid-cell { aspect-ratio: 1 / 1; display: flex; justify-content: center; align-items: center; font-size: 2.2em; font-weight: bold; background: var(--cell-bg); border: 1px solid var(--border-color); border-radius: 10px; color: var(--gold-color); }
.am-grid-cell.missing { opacity: 0.5; color: var(--text-color-light); background: var(--cell-bg-missing); }

/* Start New Reading Button */
#am-reset-btn { display: block; margin: 30px auto 30px auto; background-color: transparent; color: var(--gold-color); border: 2px solid var(--gold-color); padding: 10px 25px; border-radius: 8px; cursor: pointer; font-weight: bold; transition: all 0.3s ease; }
#am-reset-btn:hover { background-color: var(--gold-color); color: var(--btn-text-color); }

/* Analysis Section */
.am-analysis-section ul { list-style: none; padding: 0; }
.am-analysis-section h3 { color: var(--gold-color); border-bottom: 1px solid var(--gold-color); padding-bottom: 5px; margin-top: 30px; }
.core-details-block { margin-bottom: 20px; }
.core-details-block h4 { color: var(--text-color); text-align: left; font-size: 1.1em; }
.core-details-block p { font-size: 0.95em; }
.core-details-block .pros { color: #28a745; }
.core-details-block .cons { color: #dc3545; }

/* Static Footer, CTA, Social */
#am-static-footer { border-top: 1px solid var(--border-color); padding-top: 20px; margin-top: 30px; }
.am-cta-section { padding: 10px 0; text-align: center; }
.am-cta-section h3 { color: var(--text-color); border: none; }
.am-cta-section p { max-width: 600px; margin: 15px auto; }
.am-cta-button { display: inline-block; margin-top: 10px; padding: 15px 30px; background-color: var(--gold-color); color: var(--btn-text-color); text-decoration: none; font-weight: bold; border-radius: 8px; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.am-cta-button:hover { transform: scale(1.05); box-shadow: 0 0 20px var(--gold-color); }

.am-footer-section { margin-top: 30px; }
.am-social-share { display: flex; justify-content: center; align-items: center; gap: 15px; margin-bottom: 20px; flex-wrap: wrap; }
.am-social-share-title { width: 100%; text-align: center; margin-bottom: 10px; font-weight: bold; color: var(--text-color-light); }
.am-social-share a { display: flex; justify-content: center; align-items: center; width: 40px; height: 40px; text-decoration: none; background-color: var(--input-bg); border-radius: 50%; transition: transform 0.2s ease; }
.am-social-share a:hover { transform: scale(1.1); }
.am-social-share svg { width: 20px; height: 20px; fill: var(--text-color-light); }
.am-powered-by { text-align: center; font-size: 0.9em; margin-top: 20px; }
.am-powered-by span { color: var(--text-color) !important; }
.am-powered-by a { color: var(--gold-color) !important; text-decoration: none; font-weight: bold; }