:root {
    --bg: #f4f7f6;
    --surface: #ffffff;
    --surface2: #f1f5f9;
    --primary: #1e40af; /* Deep Blue */
    --primary-hover: #1e3a8a;
    --primary-light: #eff6ff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.6;
}

.urdu-text, .i18n[data-ur], .i18n[data-rm] {
    font-family: 'Noto Nastaliq Urdu', 'Amiri', serif;
}

.arabic-text {
    font-family: 'Amiri', serif;
    direction: rtl;
    font-size: 1.2em;
}

a { color: var(--primary); text-decoration: none; transition: 0.3s; }
a:hover { color: var(--primary-hover); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Topbar for Lang Switcher */
.topbar { background: var(--primary-hover); color: white; padding: 8px 0; font-size: 13px; }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; }
.topbar-links { display: flex; gap: 15px; align-items: center; }
.topbar-links a { color: #cbd5e1; }
.topbar-links a:hover { color: white; }

.lang-switcher { position: relative; }
.lang-btn { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: white; padding: 4px 10px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 12px; transition: 0.2s; }
.lang-btn:hover { background: rgba(255,255,255,0.1); }
.lang-menu { position: absolute; top: 100%; right: 0; background: white; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); margin-top: 5px; min-width: 120px; display: none; z-index: 1000; overflow: hidden; }
.lang-menu.show { display: block; }
.lang-option { padding: 8px 15px; color: var(--text-main); cursor: pointer; font-size: 13px; font-weight: 500; transition: 0.2s; }
.lang-option:hover { background: var(--surface2); color: var(--primary); }

/* Header & Nav */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 32px;
    color: var(--primary);
}

.logo-text { display: flex; flex-direction: column; }
.logo-name { font-size: 22px; font-weight: 700; color: var(--text-main); letter-spacing: 0.5px; }
.logo-sub { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; font-family: 'Inter', sans-serif;}

.main-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: var(--text-muted);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius);
    transition: 0.3s;
    font-size: 15px;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
    font-weight: 600;
}

/* Hero */
.page-hero {
    text-align: center;
    padding: 60px 20px 40px;
}

.page-hero h1 {
    font-size: 42px;
    margin-bottom: 15px;
    color: var(--text-main);
    font-weight: 800;
}

.page-hero p {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 650px;
    margin: 0 auto;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    padding: 20px 0 60px;
}

.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    text-align: left;
    transition: 0.3s;
    display: block;
    box-shadow: var(--shadow);
}
html[dir="rtl"] .tool-card { text-align: right; }

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.tool-icon {
    width: 60px; height: 60px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    margin-bottom: 20px;
}

.tool-card h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text-main);
}

.tool-card p {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.5;
}

/* Converter / Editor Panels */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    background: #fafafa;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.panel-label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 15px;
}

textarea {
    width: 100%;
    min-height: 250px;
    background: transparent;
    border: none;
    padding: 20px;
    color: var(--text-main);
    font-size: 20px;
    resize: vertical;
    outline: none;
}
textarea::placeholder { color: #cbd5e1; }

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(30, 64, 175, 0.3);
    transform: translateY(-2px);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: 0.2s;
    padding: 4px;
}

.icon-btn:hover { color: var(--primary); }

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: space-between;
    background: var(--surface);
    padding: 12px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: 15px 0;
    font-size: 14px;
    box-shadow: var(--shadow);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.stat-val {
    color: var(--primary);
    font-weight: bold;
    background: var(--primary-light);
    padding: 2px 10px;
    border-radius: 12px;
}

/* Footer */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 40px 0 20px;
    margin-top: 60px;
    text-align: center;
}

.footer-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
}

.footer-text {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.footer-links {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

/* Toast */
#toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-main);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    box-shadow: var(--shadow-hover);
    opacity: 0;
    transition: 0.3s;
    z-index: 1000;
}

#toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.conv-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
}

@media (max-width: 768px) {
    .conv-grid { grid-template-columns: 1fr; }
    .main-nav { display: none; } /* Mobile nav toggle can be added later */
}
