* { 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; }

/* Page Header */
.page-header-card { background: linear-gradient(135deg, #2F586A, #1a3a49); border-radius: 10px; padding: 2rem; text-align: center; color: white; box-shadow: 0 4px 15px rgba(0,0,0,0.08); }
.page-header-card h1 { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.page-header-card p { font-size: 1rem; opacity: 0.9; }

/* Converter Card — single unified container */
.converter-card { background-color: white; border-radius: 10px; padding: 2rem; box-shadow: 0 4px 15px rgba(0,0,0,0.08); display: flex; flex-direction: column; gap: 1.5rem; }

/* Upload Area */
.upload-area { border: 2px dashed #b0c8d4; border-radius: 10px; padding: 3rem 2rem; text-align: center; background-color: #f5f9fc; cursor: pointer; transition: all 0.25s ease; }
.upload-area:hover, .upload-area.dragover { background-color: #e6f2f8; border-color: #2F586A; }
.upload-icon { font-size: 2.5rem; margin-bottom: 0.6rem; }
.upload-text { color: #2F586A; font-size: 1rem; font-weight: 600; }
.upload-subtext { color: #8aa5b1; font-size: 0.82rem; margin-top: 0.3rem; }
input[type="file"] { display: none; }

/* Preview Grid */
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.8rem; }
.preview-card { background-color: #f5f9fc; border: 1px solid #d9e2e7; border-radius: 8px; padding: 0.7rem; position: relative; transition: border-color 0.2s ease; }
.preview-card:hover { border-color: #2F586A; }
.preview-img { width: 100%; height: 110px; object-fit: contain; border-radius: 4px; background-color: white; margin-bottom: 0.4rem; }
.preview-name { font-weight: 600; color: #2F586A; font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-size { font-size: 0.72rem; color: #8aa5b1; }
.remove-btn { position: absolute; top: 0.35rem; right: 0.35rem; background-color: #ff4444; color: white; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 0.7rem; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s ease; }
.remove-btn:hover { background-color: #cc0000; }

/* Settings Divider */
.settings-divider { display: flex; align-items: center; gap: 1rem; color: #8aa5b1; font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.settings-divider::before, .settings-divider::after { content: ''; flex: 1; height: 1px; background-color: #e6f2f8; }

/* Settings Panel */
.settings-panel { display: flex; flex-direction: column; gap: 1.2rem; }

.settings-row { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: flex-start; }
.settings-row-secondary { padding-top: 0.5rem; border-top: 1px solid #f0f0f0; }

.setting-group { display: flex; flex-direction: column; gap: 0.4rem; }
.setting-group-quality { flex: 1; min-width: 200px; }
.setting-inline { flex-direction: column; }

.setting-label { font-weight: 600; color: #2F586A; font-size: 0.9rem; }
.toggle-label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.setting-hint { font-size: 0.78rem; color: #8aa5b1; }

/* Format Buttons */
.format-buttons { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.format-btn { padding: 0.45rem 0.9rem; border: 2px solid #d9e2e7; border-radius: 8px; background-color: white; color: #2F586A; font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all 0.2s ease; }
.format-btn:hover { border-color: #2F586A; background-color: #f5f9fc; }
.format-btn.active { background-color: #2F586A; color: white; border-color: #2F586A; }

/* Quality Slider — fill handled via JS inline style */
.quality-slider { width: 100%; -webkit-appearance: none; height: 6px; border-radius: 3px; outline: none; cursor: pointer; }
.quality-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #2F586A; cursor: pointer; box-shadow: 0 2px 6px rgba(47,88,106,0.35); border: 2px solid white; }
.quality-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #2F586A; cursor: pointer; border: 2px solid white; box-shadow: 0 2px 6px rgba(47,88,106,0.35); }
.quality-labels { display: flex; justify-content: space-between; font-size: 0.72rem; color: #8aa5b1; margin-top: 0.2rem; }

/* Progress */
.convert-progress { display: flex; flex-direction: column; gap: 0.4rem; }
.progress-bar { height: 6px; background-color: #e6f2f8; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(135deg, #2F586A, #1a3a49); border-radius: 3px; transition: width 0.3s ease; width: 0%; }
#progressText { font-size: 0.82rem; color: #5a7d8f; }

/* Action Row */
.action-row { display: flex; gap: 0.8rem; padding-top: 0.5rem; border-top: 1px solid #f0f0f0; }
.btn { padding: 0.8rem 1.5rem; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.25s ease; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; }
.btn-primary { background: linear-gradient(135deg, #2F586A, #1a3a49); color: white; box-shadow: 0 3px 10px rgba(47,88,106,0.25); flex: 1; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(47,88,106,0.35); }
.btn-primary:disabled { background: #b0c8d4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background-color: #f5f9fc; color: #2F586A; border: 2px solid #d9e2e7; }
.btn-secondary:hover { background-color: #e6f2f8; border-color: #2F586A; }
.btn-sm { padding: 0.45rem 1rem; font-size: 0.82rem; }
.btn-download-result { background: linear-gradient(135deg, #2F586A, #1a3a49); color: white; padding: 0.7rem 1.5rem; font-size: 0.9rem; border-radius: 8px; border: none; cursor: pointer; font-weight: 600; transition: all 0.25s ease; white-space: nowrap; box-shadow: 0 3px 10px rgba(47,88,106,0.25); }
.btn-download-result:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(47,88,106,0.35); }

/* Results Section */
.results-section { background-color: white; border-radius: 10px; padding: 1.5rem; box-shadow: 0 4px 15px rgba(0,0,0,0.08); }
.results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; padding-bottom: 0.8rem; border-bottom: 2px solid #e6f2f8; }
.results-title { color: #2F586A; font-size: 1.1rem; font-weight: 700; }

/* Result Cards */
.result-card { display: flex; align-items: center; gap: 1rem; padding: 0.9rem; border: 1px solid #e6f2f8; border-radius: 8px; margin-bottom: 0.7rem; transition: border-color 0.2s ease; }
.result-card:hover { border-color: #2F586A; }
.result-thumb { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; background-color: #f5f9fc; border: 1px solid #e6f2f8; flex-shrink: 0; }
.result-info { flex: 1; min-width: 0; }
.result-name { font-weight: 600; color: #2F586A; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0.25rem; }
.result-stats { display: flex; gap: 1rem; font-size: 0.8rem; color: #8aa5b1; flex-wrap: wrap; }
.stat-saved { color: #4CAF50; font-weight: 600; }
.stat-larger { color: #ff9800; font-weight: 600; }

/* 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; }
}
@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; }
    .converter-card { padding: 1.2rem; }
    .action-row { flex-direction: column; }
    .result-card { flex-wrap: wrap; }
    .page-header-card h1 { font-size: 1.5rem; }
}
@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; }
    .converter-card { padding: 1rem; }
    .preview-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #2F586A; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #1a3a49; }
