:root {
    --primary-color: #0F4C81;
    --primary-hover: #0a355c;
    --bg-main: #F4F7F9;
    --bg-card: #FFFFFF;
    --text-dark: #2C3E50;
    --text-muted: #6C7A89;
    --border-color: #E2E8F0;
    --box-shadow: 0 8px 24px rgba(15, 76, 129, 0.06);
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { background-color: var(--bg-main); color: var(--text-dark); font-family: 'Inter', sans-serif; line-height: 1.6; }
h1, h2, h3, h4 { font-family: 'Poppins', sans-serif; color: var(--primary-color); }
.container { width: 90%; max-width: 1200px; margin: 0 auto; }

/* ================= Header ================= */
header { background: var(--bg-card); padding: 15px 5%; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 100; }
.logo { font-size: 24px; font-weight: 700; color: var(--primary-color); display: flex; align-items: center; gap: 10px; font-family: 'Poppins', sans-serif; }
nav { display: flex; align-items: center; gap: 20px; }
nav a { text-decoration: none; color: var(--text-dark); font-weight: 500; transition: color 0.3s ease; }
nav a:hover, nav a.active { color: var(--primary-color); }
.lang-switch { padding: 6px 12px; border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; background: var(--bg-main); font-family: 'Inter', sans-serif;}
.menu-toggle { display: none; font-size: 24px; cursor: pointer; color: var(--primary-color); }

/* ================= Ads ================= */
.ad-container { background: #e2e8f0; color: #94a3b8; display: flex; justify-content: center; align-items: center; margin: 30px auto; border: 1px dashed #cbd5e1; border-radius: var(--radius); font-size: 14px;}
.top-ad, .bottom-ad { width: 90%; max-width: 728px; height: 90px; }
.in-article-ad { width: 90%; max-width: 1200px; height: 120px; }

/* ================= Hero Section ================= */
.hero-section { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 50px; padding: 60px 0; }
.hero-text-wrapper h1 { font-size: 46px; line-height: 1.2; margin-bottom: 20px; }
.hero-text-wrapper .highlight { color: var(--primary-color); }
.hero-text-wrapper p { font-size: 18px; color: var(--text-muted); margin-bottom: 30px; }

.search-box { display: flex; background: var(--bg-card); border-radius: 50px; padding: 5px; box-shadow: var(--box-shadow); border: 1px solid var(--border-color); max-width: 450px; }
.search-box i { padding: 15px; color: var(--text-muted); }
.search-box input { flex: 1; border: none; outline: none; font-size: 16px; background: transparent; }
.search-box button { background: var(--primary-color); color: white; border: none; padding: 0 25px; border-radius: 50px; font-weight: 600; cursor: pointer; transition: 0.3s;}
.search-box button:hover { background: var(--primary-hover); }

/* ================= Premium Calculator Design ================= */
.hero-calc-wrapper { display: flex; justify-content: center; width: 100%; min-height: 500px; }
.advance-calculator.sci-calc-container { 
    max-width: 750px; 
    width: 100%; 
    padding: 20px; 
    background: #ffffff; 
    border: 1px solid var(--border-color); 
    box-shadow: 0 20px 40px rgba(15, 76, 129, 0.12); 
    border-radius: 16px; 
    transition: 0.3s ease; 
}

.sci-screen { position: relative; background: #f8fafc; border-radius: 10px; padding: 20px; text-align: right; margin-bottom: 20px; border: 1px inset #e2e8f0; }
#calc-display { font-size: 32px; font-weight: 700; color: var(--text-dark); overflow-x: auto; margin-top: 5px; letter-spacing: 1px;}

.pip-btn { position: absolute; top: 15px; left: 20px; background: transparent; border: none; color: var(--primary-color); font-size: 20px; cursor: pointer; opacity: 0.5; transition: all 0.3s ease; }
.pip-btn:hover { opacity: 1; transform: scale(1.1); }

.calc-keys-wrapper {
    display: flex;
    flex-direction: row;
    gap: 15px; 
}
.sci-panel, .basic-panel {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px; 
}

.sci-btn { 
    font-size: 14px; 
    font-weight: 600; 
    font-family: 'Inter', sans-serif; 
    padding: 12px 0; 
    border-radius: 8px; 
    border: 1px solid #e2e8f0; 
    background: #f8fafc; 
    color: var(--primary-color); 
    cursor: pointer; 
    transition: 0.2s; 
}
.sci-btn:hover { background: #e2e8f0; }
.sci-btn:active { transform: scale(0.95); }

.num-btn { background: #e0f2fe; color: #0F4C81; font-weight: 700; font-size: 16px; }
.op-btn { background: #bae6fd; font-weight: 700; font-size: 16px; }
.action-btn { background: #f1f5f9; color: #475569; }
.clear-btn { background: #94a3b8; color: white; border: none; }
.equal-btn { background: var(--primary-color); color: white; border: none; }

.radio-group { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; }

/* History Log */
.calc-history-log { margin-top: 20px; padding: 15px; background: #f8fafc; border-radius: 10px; border: 1px inset #e2e8f0; max-height: 120px; overflow-y: auto; font-size: 14px; color: var(--text-muted); text-align: right; display: flex; flex-direction: column; gap: 8px; }
.calc-history-log::-webkit-scrollbar { width: 6px; }
.calc-history-log::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 10px; }
.history-item { border-bottom: 1px dashed #e2e8f0; padding-bottom: 8px; word-wrap: break-word; }
.history-item:last-child { border-bottom: none; color: var(--text-dark); font-weight: 500; }
.history-error { color: #ef4444; }

.section-title { text-align: center; margin: 60px 0 40px; }
.section-title h2 { font-size: 32px; }
.section-title p { color: var(--text-muted); margin-top: 5px; }

.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 30px; margin-bottom: 50px; }
.tool-card { background: var(--bg-card); padding: 30px; border-radius: var(--radius); text-decoration: none; box-shadow: var(--box-shadow); border: 1px solid var(--border-color); transition: all 0.3s ease; display: flex; flex-direction: column; align-items: flex-start; }
.tool-card:hover { transform: translateY(-8px); border-color: var(--primary-color); box-shadow: 0 15px 35px rgba(15, 76, 129, 0.12); }
.icon-box { background: #eaf2f8; color: var(--primary-color); width: 50px; height: 50px; border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 24px; margin-bottom: 20px; transition: 0.3s; }
.tool-card:hover .icon-box { background: var(--primary-color); color: white; }
.tool-card h3 { margin-bottom: 10px; color: var(--text-dark); font-size: 20px; }
.tool-card p { color: var(--text-muted); font-size: 14px; }

footer { background: #1a252f; color: #fff; padding: 40px 0 20px; margin-top: 60px; }
.footer-content { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #2c3e50; padding-bottom: 20px; margin-bottom: 20px; }
.footer-logo { font-family: 'Poppins', sans-serif; font-size: 24px; font-weight: 700; }
.footer-links a { color: #bdc3c7; text-decoration: none; margin-left: 20px; font-size: 14px; transition: 0.3s; }
.footer-links a:hover { color: #fff; }
.copyright { text-align: center; color: #7f8c8d; font-size: 14px; }

/* ================= Mobile Responsive ================= */
@media (max-width: 992px) {
    .hero-section { grid-template-columns: 1fr; text-align: center; display: flex; flex-direction: column; }
    .hero-text-wrapper { order: -1; margin-bottom: 30px; }
}

@media (max-width: 768px) {
    .menu-toggle { display: block; }
    nav { display: none; flex-direction: column; width: 100%; position: absolute; top: 70px; left: 0; background: var(--bg-card); padding: 20px 0; box-shadow: 0 10px 20px rgba(0,0,0,0.1); border-top: 1px solid var(--border-color); }
    nav.active { display: flex; }
    
    .calc-keys-wrapper { flex-direction: column; gap: 20px; }
    .sci-panel, .basic-panel { gap: 10px; } 
    .sci-btn { padding: 16px 0; font-size: 15px; }
    
    .footer-content { flex-direction: column; gap: 20px; text-align: center; }
}

/* 🟢 PiP Window Specific Styling (Compact & Scroll-Free Layout) 🟢 */
body.pip-mode {
    padding: 0; 
    background: var(--bg-main);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* স্ক্রলবার পুরোপুরি বন্ধ করা হলো */
    margin: 0;
    height: 100vh;
}

body.pip-mode .advance-calculator {
    border: none;
    box-shadow: none; 
    width: 100%; 
    height: 100%;
    max-width: 100%; 
    margin: 0; 
    padding: 12px; /* প্যাডিং কমানো হলো */
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

body.pip-mode .sci-screen {
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
}

body.pip-mode #calc-display {
    font-size: 26px; /* ফন্ট সাইজ কিছুটা ছোট করা হলো */
}

body.pip-mode .calc-keys-wrapper {
    flex-direction: column; 
    gap: 10px; /* গ্যাপ কমানো হলো */
    flex: 1; 
}

body.pip-mode .sci-panel, body.pip-mode .basic-panel {
    gap: 6px; /* বাটনগুলোর ভেতরের গ্যাপ কমানো হলো */
}

body.pip-mode .sci-btn {
    padding: 8px 0; /* বাটনের উচ্চতা কমানো হলো */
    font-size: 13px;
    border-radius: 6px;
}

body.pip-mode .calc-history-log {
    margin-top: 10px;
    padding: 8px;
    max-height: 50px; /* হিস্ট্রি লগ ছোট করা হলো */
    font-size: 12px;
}

body.pip-mode .pip-btn {
    display: none; /* PiP মোডে PiP বাটন হাইড করা হলো */
}