/* ===== CSS Variables & Reset ===== */
:root {
    --primary: #6C47FF;
    --primary-dark: #5430E8;
    --primary-light: #EDE5FF;
    --secondary: #FF6B35;
    --secondary-light: #FFF0E9;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;

    --text-primary: #1A1A2E;
    --text-secondary: #4A5568;
    --text-muted: #9CA3AF;
    --text-white: #FFFFFF;

    --bg-primary: #FFFFFF;
    --bg-secondary: #F7F8FC;
    --bg-dark: #1A1A2E;

    --border: #E5E7EB;
    --border-light: #F3F4F6;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --font-hi: 'Noto Sans Devanagari', 'Inter', sans-serif;
    --font-en: 'Inter', 'Noto Sans Devanagari', sans-serif;
    --ui-title-size: 1.05rem;
    --ui-title-weight: 700;
    --ui-subtext-size: 0.9rem;
    --ui-subtext-weight: 500;
    --ui-value-size: 1.65rem;
    --ui-value-weight: 800;

    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

/* Hide scrollbars globally across all pages */
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
*::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

body {
    font-family: var(--font-hi);
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.lang-en {
    font-family: var(--font-en);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

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

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-weight: 600;
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.btn-sm {
    padding: 8px 20px;
    font-size: 0.875rem;
}

.btn-md {
    padding: 12px 28px;
    font-size: 1rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1.05rem;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 60, 225, 0.35);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg-secondary);
}

.btn-white {
    background: white;
    color: var(--primary);
    border-color: white;
}

.btn-white:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

.btn-secondary:hover {
    background: #e55a28;
    transform: translateY(-2px);
}

/* ===== Navigation ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

.navbar.scrolled {
    box-shadow: var(--shadow-sm);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 10px;
    color: inherit;
}

.logo-universal {
    display: none;
    width: 180px;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    flex-shrink: 0;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-text {
    display: inline-flex;
    align-items: baseline;
    gap: 0;
}

.logo-mark img {
    width: 32px;
    height: 36px;
    display: block;
    object-fit: contain;
}

.logo-text {
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1;
    color: #111827;
    letter-spacing: -1.2px;
}

.logo-kitaab {
    color: #6C47FF;
}

/* Legacy — keep for any stray .logo-icon references */
.logo-icon {
    display: none;
}

.hk-theme-icon-node svg {
    width: 1em;
    height: 1em;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: middle;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    position: relative;
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

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

.lang-toggle {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

/* ===== Section Headers ===== */
.section-header {
    text-align: center;
    margin-bottom: 56px;
}

.section-badge {
    display: inline-block;
    padding: 6px 18px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 12px;
}

.section-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(108, 60, 225, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%234A5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.input-group {
    display: flex;
    gap: 0;
}

.input-group .input-prefix {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.input-group .form-input {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-divider::before,
.form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    :root {
        --ui-subtext-size: 0.82rem;
        --ui-subtext-weight: 500;
    }

    .nav-links {
        display: none;
    }

    .nav-actions .btn {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .nav-links.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: white;
        padding: 24px;
        gap: 16px;
        box-shadow: var(--shadow-md);
        border-bottom: 1px solid var(--border);
    }

    .nav-links.active+.nav-actions .btn {
        display: inline-flex;
    }

    .section-header h2 {
        font-size: 1.75rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* PJAX navigation transition — smooth crossfade instead of hard blink */
main.dashboard-main,
main.page-main {
    transition: opacity 0.12s ease;
}
html.hk-pjax-loading main.dashboard-main,
html.hk-pjax-loading main.page-main {
    opacity: 0.4;
}
