* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Roboto', 'Segoe UI', sans-serif; }
body { background-color: #f9fbfd; line-height: 1.6; color: #333; overflow-x: hidden; }
a { text-decoration: none; color: #2F586A; transition: color 0.3s ease; }
a:hover { color: #1a3a49; }
html { scroll-behavior: smooth; }

/* Header */
#header { background-color: #2F586A; background-image: linear-gradient(135deg, #2F586A, #1a3a49); padding: 3% 3%; position: sticky; top: 0; z-index: 1000; box-shadow: 0 4px 12px rgba(0,0,0,0.15); display: flex; justify-content: space-between; align-items: center; height: 70px; }
#header-logo-name { display: flex; align-items: center; transition: transform 0.3s ease; }
#header-logo-name:hover { transform: translateY(-2px); }
#logo { height: 50px; width: 50px; border-radius: 12px; object-fit: cover; }
#company-name { font-size: 1.5rem; color: white; font-weight: 600; letter-spacing: 0.5px; margin-left: 1rem; }
#header-right { display: flex; align-items: center; gap: 1.5rem; }
#search-post-div { position: relative; }
#search-post { height: 40px; width: clamp(200px, 25vw, 300px); border: none; border-radius: 20px; padding: 0 1rem 0 2.8rem; background-image: url('../img/search_icon.png'); background-size: 16px; background-repeat: no-repeat; background-position: 15px center; font-size: 0.9rem; color: #2F586A; transition: all 0.3s ease; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
#search-post:focus { outline: none; box-shadow: 0 3px 10px rgba(0,0,0,0.2); width: clamp(220px, 30vw, 350px); }
#search-post::placeholder { color: #8aa5b1; font-size: 0.85rem; }
#searchResultDiv { position: absolute; top: calc(100% + 5px); left: 0; background-color: white; width: 100%; border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); z-index: 1000; max-height: 300px; overflow-y: auto; display: none; }
.postSearchDiv { padding: 0.8rem 1rem; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: background-color 0.2s ease; display: flex; align-items: center; }
.postSearchDiv:last-child { border-bottom: none; }
.postSearchDiv:hover { background-color: #f5f9fc; }
.postSearchCard { color: #2F586A; font-size: 0.9rem; margin: 0; font-weight: 500; }
#home-about-div { display: flex; gap: 0.8rem; }
#home-btn, #about-btn { background-color: rgba(255,255,255,0.12); color: white; border: none; padding: 0.5rem 1.2rem; border-radius: 50px; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all 0.3s ease; }
#home-btn:hover, #about-btn:hover { background-color: rgba(255,255,255,0.25); transform: translateY(-2px); }
#login-signup { display: none; }

/* Layout */
#full-page-content-div { margin: 2% 2%; display: flex; flex-wrap: wrap; gap: 2rem; }
.calculator-main-div { flex: 1 1 70%; min-width: 300px; }
.calculator-wrapper { display: flex; flex-direction: column; gap: 1.5rem; }
.sidebar-content-div { flex: 1 1 25%; min-width: 250px; }

/* Main Card */
.calculator-card { background-color: white; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.08); overflow: hidden; }

.calculator-header { background: linear-gradient(135deg, #2F586A, #1a3a49); padding: 2rem; text-align: center; color: white; }
.calculator-header h1 { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.calculator-header p { font-size: 1rem; opacity: 0.9; }

.calculator-body { padding: 2rem; display: flex; flex-direction: column; gap: 2rem; }

/* Form Sections */
.form-section { display: flex; flex-direction: column; gap: 1rem; }
.section-heading { color: #2F586A; font-size: 1.2rem; font-weight: 700; padding-bottom: 0.5rem; border-bottom: 2px solid #e6f2f8; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.2rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { color: #2F586A; font-weight: 600; font-size: 0.95rem; }
.form-group input, .form-group select { padding: 0.75rem; border: 2px solid #d9e2e7; border-radius: 8px; font-size: 0.95rem; background-color: #f9fbfd; transition: all 0.3s ease; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: #2F586A; background-color: white; box-shadow: 0 0 0 3px rgba(47,88,106,0.1); }

/* Radio */
.radio-group { display: flex; gap: 0.8rem; }
.radio-option { flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem; border: 2px solid #d9e2e7; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; background-color: white; }
.radio-option:hover { border-color: #2F586A; background-color: #f5f9fc; }
.radio-option input[type="radio"] { accent-color: #2F586A; }
.radio-option input[type="radio"]:checked + span { font-weight: 700; color: #2F586A; }
.radio-option span { font-size: 0.9rem; color: #5a7d8f; }

/* Unit Toggle */
.unit-toggle { display: flex; gap: 0.3rem; margin-top: 0.4rem; background-color: #f5f9fc; padding: 0.2rem; border-radius: 50px; }
.unit-btn { flex: 1; padding: 0.35rem 0.7rem; border: none; border-radius: 50px; background-color: transparent; color: #2F586A; font-weight: 600; cursor: pointer; transition: all 0.2s ease; font-size: 0.82rem; }
.unit-btn.active { background-color: #2F586A; color: white; }
.unit-btn:hover:not(.active) { background-color: rgba(47,88,106,0.1); }

/* Buttons */
.button-group { display: flex; gap: 1rem; }
.btn { flex: 1; padding: 0.9rem 1.5rem; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; text-transform: uppercase; letter-spacing: 0.5px; }
.btn-primary { background: linear-gradient(135deg, #2F586A, #1a3a49); color: white; box-shadow: 0 4px 12px rgba(47,88,106,0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(47,88,106,0.4); }
.btn-secondary { background-color: #f5f9fc; color: #2F586A; border: 2px solid #d9e2e7; }
.btn-secondary:hover { background-color: #e6f2f8; border-color: #2F586A; }

/* Results */
.results-section { display: none; flex-direction: column; gap: 1.2rem; border-top: 2px solid #e6f2f8; padding-top: 2rem; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* Section headings inside results get extra top spacing to visually group with content below */
.results-section .section-heading { margin-top: 0.8rem; }

/* Result Banner */
.result-banner { background: linear-gradient(135deg, #2F586A, #1a3a49); color: white; padding: 2rem; border-radius: 10px; text-align: center; }
.result-banner-label { font-size: 0.95rem; opacity: 0.85; margin-bottom: 0.4rem; }
.result-banner-value { font-size: 3.5rem; font-weight: 700; margin: 0.3rem 0; }
.result-banner-sub { font-size: 0.95rem; opacity: 0.85; }

/* Range Boxes */
.result-range { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.range-box { background-color: #f5f9fc; border: 2px solid #d9e2e7; border-radius: 10px; padding: 1.2rem; text-align: center; display: flex; flex-direction: column; gap: 0.3rem; transition: all 0.2s ease; }
.range-box:hover { border-color: #2F586A; transform: translateY(-2px); }
.range-box-ideal { border-color: #2F586A; background-color: #eaf3f7; }
.range-label { font-size: 0.78rem; font-weight: 700; color: #8aa5b1; text-transform: uppercase; letter-spacing: 0.5px; }
.range-value { font-size: 1.8rem; font-weight: 700; color: #2F586A; }
.range-hint { font-size: 0.75rem; color: #8aa5b1; }

/* Info Blocks */
.info-block { padding: 1.2rem 1.5rem; border-radius: 8px; font-size: 0.9rem; line-height: 1.6; }
.info-block h4 { margin-bottom: 0.5rem; font-size: 1rem; }
.info-block-blue { background-color: #e3f2fd; border-left: 4px solid #2196f3; color: #1565c0; }
.info-block-blue h4 { color: #1565c0; }
.info-block-warning { background-color: #fff3e0; border-left: 4px solid #ff9800; color: #5a3e00; }

/* Meal Grid */
.meal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; }
.meal-tile { background-color: #f5f9fc; border-left: 4px solid #2F586A; border-radius: 8px; padding: 1rem; text-align: center; transition: all 0.2s ease; }
.meal-tile:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(47,88,106,0.1); }
.meal-tile-icon { font-size: 1.4rem; margin-bottom: 0.3rem; }
.meal-tile-name { font-size: 0.82rem; font-weight: 600; color: #5a7d8f; margin-bottom: 0.3rem; }
.meal-tile-value { font-size: 1.4rem; font-weight: 700; color: #2F586A; }
.meal-tile-pct { font-size: 0.72rem; color: #8aa5b1; margin-top: 0.2rem; }

/* Food Grid */
.food-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.6rem; }
.food-item { display: flex; justify-content: space-between; align-items: center; background-color: #f5f9fc; padding: 0.65rem 1rem; border-radius: 8px; border: 1px solid #d9e2e7; transition: all 0.2s ease; }
.food-item:hover { border-color: #2F586A; background-color: #e6f2f8; }
.food-name { font-weight: 600; color: #2F586A; font-size: 0.88rem; }
.food-amount { font-size: 0.78rem; color: #8aa5b1; }

/* Tips */
.tips-list { display: flex; flex-direction: column; gap: 0.5rem; }
.tip-item { padding: 0.65rem 0.65rem 0.65rem 2rem; background-color: #f5f9fc; border-radius: 8px; font-size: 0.88rem; color: #5a7d8f; position: relative; }
.tip-item::before { content: '✓'; position: absolute; left: 0.65rem; color: #2F586A; font-weight: 700; }

/* Print Button */
.print-btn { display: block; margin: 0 auto; background-color: white; color: #2F586A; padding: 0.75rem 2rem; border: 2px solid #2F586A; border-radius: 50px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.print-btn:hover { background-color: #2F586A; color: white; }

/* Sidebar */
#related-calculators-div, #category-display-div { margin-bottom: 2rem; background-color: white; border-radius: 10px; padding: 1.5rem; box-shadow: 0 4px 15px rgba(0,0,0,0.08); }
#related-calculators-heading, #category-display-heading { font-weight: 700; color: #2F586A; font-size: 1.2rem; margin-bottom: 1.2rem; padding-bottom: 0.8rem; border-bottom: 2px solid #2F586A; width: fit-content; }
#related-calculators-contents, #category-display-contents { display: flex; flex-wrap: wrap; gap: 0.8rem; }
#related-tools-div { margin-bottom: 2rem; background-color: white; border-radius: 10px; padding: 1.5rem; box-shadow: 0 4px 15px rgba(0,0,0,0.08); }
#related-tools-heading { font-weight: 700; color: #2F586A; font-size: 1.2rem; margin-bottom: 1.2rem; padding-bottom: 0.8rem; border-bottom: 2px solid #2F586A; width: fit-content; }
#related-tools-contents { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.relatedCalculatorCard { border: 1px solid #d9e2e7; padding: 0.6rem 1rem; border-radius: 50px; cursor: pointer; transition: all 0.3s ease; background-color: white; font-size: 0.9rem; color: #2F586A; font-weight: 500; }
.relatedCalculatorCard:hover { background-color: #2F586A; color: white; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(47,88,106,0.15); }
.categoryCardsDiv { border: 1px solid #d9e2e7; padding: 0.6rem 1rem; border-radius: 50px; cursor: pointer; transition: all 0.3s ease; background-color: white; font-size: 0.9rem; color: #2F586A; font-weight: 500; }
.categoryCardsDiv:hover { background-color: #2F586A; color: white; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(47,88,106,0.15); }

/* Footer */
#footer-div { background-color: #2F586A; background-image: linear-gradient(to right, #2F586A, #1a3a49); padding: 3rem 5%; color: white; margin-top: 3rem; }
#footer-companyDetail-div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
#footer-companyDetail-sub-div1 { flex: 1 1 60%; min-width: 300px; }
#footer-Cname-logo { display: flex; align-items: center; margin-bottom: 1.5rem; }
#footer-logo-img { height: 50px; width: 50px; border-radius: 15px; object-fit: cover; }
#footer-companyName-div { color: white; padding-left: 1rem; font-size: 1.2rem; font-weight: 600; }
#company-description { color: rgba(255,255,255,0.9); line-height: 1.7; font-size: 0.95rem; }
#footer-companyDetail-sub-div2 { flex: 1 1 30%; min-width: 200px; }
#follow-us { color: white; text-align: center; font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }
#footer-connections { display: flex; justify-content: center; gap: 1rem; margin-bottom: 1.5rem; }
#facebook-logo, #instagram-logo, #mail-logo { height: 40px; width: 40px; border-radius: 50%; transition: transform 0.3s ease; background-color: rgba(255,255,255,0.1); padding: 5px; object-fit: contain; }
#facebook-logo:hover, #instagram-logo:hover, #mail-logo:hover { transform: translateY(-3px) scale(1.1); background-color: rgba(255,255,255,0.2); }
#company-copyrights-div { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 1.5rem; }
#company-copyrights-sub-div { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin-bottom: 1rem; }
.terms-policy-disclaimer { color: rgba(255,255,255,0.8); transition: color 0.2s ease; font-size: 0.9rem; }
.terms-policy-disclaimer:hover { color: white; text-decoration: underline; }
#all-rights-reserved { color: white; text-align: center; font-weight: 500; font-size: 0.9rem; }

/* Responsive */
@media (max-width: 900px) {
    #full-page-content-div { flex-direction: column; }
    .calculator-main-div { width: 100%; order: 1; }
    .sidebar-content-div { width: 100%; order: 2; }
    .result-range { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    #header { padding: 0 4%; height: 60px; }
    #logo { height: 45px; width: 45px; }
    #company-name { display: none; }
    #search-post { width: 40px; height: 40px; padding: 0; background-position: center; font-size: 0; border-radius: 50%; }
    #search-post:focus { width: 200px; border-radius: 20px; font-size: 0.9rem; padding: 0 1rem 0 2.8rem; background-position: 15px center; }
    #searchResultDiv { position: fixed; top: 60px; left: 0; width: 100%; max-width: 100%; border-radius: 0 0 10px 10px; max-height: 60vh; z-index: 1005; }
    #home-btn, #about-btn { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
    .calculator-header h1 { font-size: 1.5rem; }
    .calculator-body { padding: 1.5rem; }
    .button-group { flex-direction: column; }
    .radio-group { flex-direction: column; }
    .result-banner-value { font-size: 2.5rem; }
}
@media (max-width: 600px) {
    .result-range { grid-template-columns: 1fr; }
    .meal-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    #header { padding: 0 3%; }
    #header-right { gap: 0.3rem; }
    #home-btn, #about-btn { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
    #search-post:focus { width: 160px; }
    .calculator-body { padding: 1rem; }
}
@media print {
    .button-group, .print-btn, #header, .sidebar-content-div { display: none; }
    .calculator-card { box-shadow: none; }
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #2F586A; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #1a3a49; }
