/* assets/css/main.css */
/* CalcHub Core Global Styles & Pixel-Perfect Homepage UI */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.2s ease, color 0.2s ease;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease, opacity 0.15s ease;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

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

.container {
    width: 100%;
    max-width: var(--container-max, 1468px);
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* ==========================================
   HEADER & NAVIGATION
========================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    height: 72px;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.68rem;
    color: var(--text-primary);
    flex-shrink: 0;
    text-decoration: none;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: transparent;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px -4px rgba(37, 99, 235, 0.38);
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-logo:hover .brand-icon {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 8px 18px -4px rgba(79, 70, 229, 0.45);
}

.brand-name {
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: #0f172a;
    display: flex;
    align-items: baseline;
    white-space: nowrap;
}

html.dark .brand-name {
    color: #f8fafc;
}

.brand-name span {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

html.dark .brand-name span {
    background: linear-gradient(135deg, #60a5fa 0%, #818cf8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-tld {
    font-style: normal;
    font-size: 0.78rem;
    font-weight: 800;
    color: #059669;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 0.08rem 0.38rem;
    border-radius: 6px;
    margin-left: 0.28rem;
    letter-spacing: 0;
}

html.dark .brand-tld {
    color: #34d399;
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(52, 211, 153, 0.35);
}

.brand-tagline {
    font-size: 0.65rem;
    color: #64748b;
    font-weight: 600;
    display: block;
    margin-top: 2px;
    letter-spacing: -0.01em;
}

html.dark .brand-tagline {
    color: #94a3b8;
}

.nav-links {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.2rem;
    list-style: none;
}

.btn-icon-circle.mobile-nav-toggle,
.mobile-nav-toggle {
    display: none;
}

.mobile-nav-drawer {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 20px 35px -10px rgba(15, 23, 42, 0.16);
    z-index: 95;
    padding: 0.75rem 0 1rem;
}

.mobile-nav-drawer.open {
    display: block;
    animation: megaPanelFade 0.18s ease-out;
}

.mobile-nav-inner {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.72rem 0.95rem;
    border-radius: 11px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.94rem;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.14s ease, color 0.14s ease;
}

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

html.dark .mobile-nav-link.active {
    color: #93c5fd;
}

.mobile-nav-fav {
    margin-top: 0.25rem;
    border-top: 1px solid var(--border-color-subtle);
    padding-top: 0.85rem;
    color: #e11d48;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    transition: all 0.15s ease;
}

html.dark .nav-link {
    color: #94a3b8;
}

.nav-link:hover {
    color: #2563eb;
}

.nav-link.active {
    color: #2563eb;
    background-color: #eef2ff;
    font-weight: 700;
}

html.dark .nav-link.active {
    background-color: #1e1b4b;
    color: #60a5fa;
}

.nav-link.btn-category {
    background-color: #eef2ff;
    color: #2563eb;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-full);
    padding: 0.45rem 1rem;
    transition: all 0.15s ease;
}

.nav-link.btn-category.active {
    background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.nav-link.btn-category.active svg {
    transform: rotate(180deg);
    color: #ffffff;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.btn-icon-circle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: none;
    background-color: transparent;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon-circle:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

html.dark .btn-icon-circle:hover {
    background-color: #1e293b;
    color: #f8fafc;
}

.btn-favorites {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1.15rem;
    border-radius: var(--radius-full);
    background-color: #2563eb;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-favorites:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

.favorites-count-badge {
    background-color: #ffffff;
    color: #2563eb;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-full);
    margin-left: 0.2rem;
}

/* ==========================================
   MEGA-MENU MODAL / DROPDOWN (Screenshot 2 Exact Match)
========================================== */
.categories-mega-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    width: min(96vw, 1468px);
    height: min(630px, calc(100vh - var(--header-height) - 18px));
    max-height: min(630px, calc(100vh - var(--header-height) - 18px));
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    box-shadow: 0 28px 60px -15px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(15, 23, 42, 0.04);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s;
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.categories-mega-menu.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.categories-mega-menu.tools-mega-menu {
    height: auto;
    max-height: calc(100vh - var(--header-height) - 24px);
    overflow-y: auto;
}

.mega-mobile-topbar {
    display: none;
}

.mega-menu-grid {
    display: grid;
    grid-template-columns: 278px minmax(0, 1fr);
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* 1. Left Sidebar */
.mega-menu-sidebar {
    background-color: #f8fafc;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

html.dark .mega-menu-sidebar {
    background-color: #0b1120;
    border-color: #1e293b;
}

.mega-sidebar-list {
    overflow-y: auto;
    padding: 0.65rem 0.7rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.mega-sidebar-list::-webkit-scrollbar {
    width: 4px;
}

.mega-sidebar-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.mega-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.36rem 0.68rem;
    border-radius: 10px;
    font-size: 0.815rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    margin-bottom: 2px;
    transition: all 0.14s ease;
    user-select: none;
}

html.dark .mega-category-item {
    color: #94a3b8;
}

.mega-category-item-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.mega-category-item-left img {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.mega-category-item-left span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mega-cat-chevron {
    font-size: 1.05rem;
    color: #94a3b8;
    font-weight: 400;
    line-height: 1;
    transition: transform 0.14s ease, color 0.14s ease;
}

.mega-category-item:hover,
.mega-category-item.active {
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

.mega-category-item.active {
    box-shadow: inset 3px 0 0 #2563eb;
}

html.dark .mega-category-item:hover,
html.dark .mega-category-item.active {
    background-color: #1e293b;
    color: #60a5fa;
}

.mega-category-item.active .mega-cat-chevron,
.mega-category-item:hover .mega-cat-chevron {
    color: #2563eb;
    transform: translateX(2px);
}

html.dark .mega-category-item.active .mega-cat-chevron,
html.dark .mega-category-item:hover .mega-cat-chevron {
    color: #60a5fa;
}

.mega-sidebar-footer {
    padding: 0.35rem 0.1rem 0.25rem;
    margin-top: 0.35rem;
    border-top: 1px solid #e2e8f0;
    background: transparent;
    flex-shrink: 0;
}

html.dark .mega-sidebar-footer {
    border-color: #1e293b;
    background: transparent;
}

.mega-all-cats-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.48rem 0.75rem;
    border-radius: 12px;
    background-color: #eff6ff;
    color: #2563eb;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    border: 1px solid rgba(191, 219, 254, 0.6);
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.05);
}

.mega-all-cats-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.mega-all-cats-icon {
    color: #2563eb;
    flex-shrink: 0;
}

.mega-all-cats-text {
    font-size: 0.86rem;
    font-weight: 700;
    color: #2563eb;
    white-space: nowrap;
}

.mega-all-cats-arrow {
    color: #2563eb;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.mega-all-cats-btn:hover {
    background-color: #dbeafe;
    border-color: #93c5fd;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.16);
    color: #1d4ed8;
}

.mega-all-cats-btn:hover .mega-all-cats-arrow {
    transform: translateX(3px);
}

html.dark .mega-all-cats-btn {
    background-color: #1e293b;
    border-color: #334155;
    color: #60a5fa;
    box-shadow: none;
}

html.dark .mega-all-cats-icon,
html.dark .mega-all-cats-text,
html.dark .mega-all-cats-arrow {
    color: #60a5fa;
}

html.dark .mega-all-cats-btn:hover {
    background-color: #1e3a8a;
    border-color: #3b82f6;
    color: #ffffff;
}

html.dark .mega-all-cats-btn:hover .mega-all-cats-icon,
html.dark .mega-all-cats-btn:hover .mega-all-cats-text,
html.dark .mega-all-cats-btn:hover .mega-all-cats-arrow {
    color: #ffffff;
}

/* 2. Middle Content Panel */
.mega-menu-content-wrap {
    overflow: hidden;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    min-width: 0;
}

.mega-menu-content {
    padding: 1.4rem 1.75rem;
    overflow-y: auto;
    background-color: #ffffff;
    height: 100%;
    max-height: 100%;
}

html.dark .mega-menu-content {
    background-color: #131b2e;
}

.mega-menu-content::-webkit-scrollbar {
    width: 5px;
}

.mega-menu-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.mega-category-panel {
    display: none;
    height: 100%;
    grid-template-columns: minmax(0, 1fr) 316px;
    max-height: 100%;
    min-height: 0;
}

.mega-category-panel.active {
    display: grid;
    animation: megaPanelFade 0.18s ease-out;
}

.mega-panel-main {
    padding: 1.15rem 1.45rem 1.5rem;
    overflow-y: auto;
    background-color: #ffffff;
    height: 100%;
    max-height: 100%;
    min-height: 0;
}

html.dark .mega-panel-main {
    background-color: #131b2e;
}

.mega-panel-main::-webkit-scrollbar {
    width: 5px;
}

.mega-panel-main::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

@keyframes megaPanelFade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mega-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.78rem;
    border-bottom: 1px solid #f1f5f9;
    gap: 1rem;
}

html.dark .mega-panel-header {
    border-color: #1e293b;
}

.mega-header-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.mega-cat-icon-frame {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

html.dark .mega-cat-icon-frame {
    background: rgba(255, 255, 255, 0.08) !important;
}

.mega-cat-header-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    display: block;
}

.mega-panel-title-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.mega-panel-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

html.dark .mega-panel-title {
    color: #f8fafc;
}

.mega-panel-badge {
    background-color: #eff6ff;
    color: #2563eb;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    white-space: nowrap;
}

html.dark .mega-panel-badge {
    background-color: #1e293b;
    color: #60a5fa;
}

.mega-panel-desc {
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 2px;
}

html.dark .mega-panel-desc {
    color: #94a3b8;
}

.btn-view-all-tools {
    font-size: 0.8rem;
    font-weight: 600;
    color: #2563eb;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.45rem 0.95rem;
    border-radius: 9999px;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn-view-all-tools:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

html.dark .btn-view-all-tools {
    background: #1e293b;
    border-color: #334155;
    color: #93c5fd;
}

html.dark .btn-view-all-tools:hover {
    background: #1e3a8a;
    border-color: #3b82f6;
    color: #ffffff;
}

/* Subgroup Grid (3 Balanced Columns on Desktop) */
.mega-subgroups-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
}

.mega-subgroup-box {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.8rem 0.9rem;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.025);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.mega-subgroup-box:hover {
    border-color: #bfdbfe;
    box-shadow: 0 8px 18px -6px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

html.dark .mega-subgroup-box {
    background-color: #1a243b;
    border-color: #27354f;
}

html.dark .mega-subgroup-box:hover {
    border-color: #3b82f6;
}

.mega-subgroup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.48rem;
    padding-bottom: 0.38rem;
    border-bottom: 1px solid #f1f5f9;
    gap: 0.4rem;
}

html.dark .mega-subgroup-header {
    border-color: #24324d;
}

.subgroup-header-left {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.subgroup-icon-box {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mega-subgroup-title {
    font-size: 0.83rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html.dark .mega-subgroup-title {
    color: #f8fafc;
}

.mega-subgroup-count {
    font-size: 0.7rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.12rem 0.45rem;
    border-radius: 9999px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

html.dark .mega-subgroup-count {
    background: #0f172a;
    color: #94a3b8;
}

.mega-tool-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.mega-tool-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.795rem;
    color: #475569;
    padding: 0.24rem 0.38rem;
    border-radius: 6px;
    gap: 0.35rem;
    transition: all 0.12s ease;
}

.mega-tool-link span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html.dark .mega-tool-link {
    color: #cbd5e1;
}

.mega-tool-link .tool-arr {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1;
    transition: transform 0.12s ease, color 0.12s ease;
}

.mega-tool-link:hover {
    color: #2563eb;
    background-color: #f8fafc;
    transform: translateX(2px);
}

html.dark .mega-tool-link:hover {
    color: #60a5fa;
    background-color: #1e293b;
}

.mega-tool-link:hover .tool-arr {
    color: #2563eb;
    transform: translateX(1px);
}

html.dark .mega-tool-link:hover .tool-arr {
    color: #60a5fa;
}

/* 3. Right Promo & Popular Panel */
.mega-panel-promo,
.mega-menu-promo {
    background-color: #f8fafc;
    border-left: 1px solid #e2e8f0;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.72rem;
    overflow-y: auto;
    height: 100%;
    max-height: 100%;
    min-height: 0;
}

html.dark .mega-panel-promo,
html.dark .mega-menu-promo {
    background-color: #0b1120;
    border-color: #1e293b;
}

.mega-panel-promo::-webkit-scrollbar,
.mega-menu-promo::-webkit-scrollbar {
    width: 4px;
}

.mega-panel-promo::-webkit-scrollbar-thumb,
.mega-menu-promo::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.mega-promo-card {
    background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
    border-radius: 16px;
    padding: 0.95rem 1rem;
    border: 1px solid #dbeafe;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

html.dark .mega-promo-card {
    background: linear-gradient(135deg, #1e1b4b 0%, #1e293b 100%);
    border-color: #312e81;
}

.mega-promo-header {
    margin-bottom: 0.55rem;
}

.mega-promo-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

html.dark .mega-promo-title {
    color: #f8fafc;
}

.mega-promo-sub {
    font-size: 0.98rem;
    color: #0f172a;
    line-height: 1.25;
}

html.dark .mega-promo-sub {
    color: #f8fafc;
}

.mega-promo-sub strong {
    color: #2563eb;
}

html.dark .mega-promo-sub strong {
    color: #60a5fa;
}

.mega-promo-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.7rem;
    gap: 0.45rem;
}

.mega-promo-checks {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.34rem;
    font-size: 0.76rem;
    font-weight: 500;
    color: #334155;
}

html.dark .mega-promo-checks {
    color: #cbd5e1;
}

.mega-promo-checks li {
    display: flex;
    align-items: center;
    gap: 0.42rem;
    white-space: nowrap;
}

.mega-promo-checks svg {
    color: #10b981;
    flex-shrink: 0;
}

.mega-promo-graphic {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mega-promo-graphic svg {
    width: 96px;
    height: 82px;
}

.btn-mega-explore {
    display: block;
    width: 100%;
    text-align: center;
    background-color: #2563eb;
    color: #ffffff !important;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.56rem 0.8rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
    transition: background-color 0.15s ease, transform 0.12s ease;
}

.btn-mega-explore:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

.mega-popular-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.78rem 0.9rem;
}

html.dark .mega-popular-section {
    background: #131b2e;
    border-color: #1e293b;
}

.mega-popular-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.48rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

html.dark .mega-popular-title {
    color: #f8fafc;
}

.mega-popular-list {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.mega-popular-tool-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.36rem 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
    transition: all 0.12s ease;
}

html.dark .mega-popular-tool-item {
    color: #cbd5e1;
}

.mega-popular-tool-item:hover {
    background-color: #f1f5f9;
    color: #2563eb;
}

html.dark .mega-popular-tool-item:hover {
    background-color: #1e293b;
    color: #60a5fa;
}

.mega-pop-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mega-pop-icon img {
    width: 16px;
    height: 16px;
}

.mega-pop-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.82rem;
}

.mega-pop-arr {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1;
    transition: transform 0.12s ease, color 0.12s ease;
}

.mega-popular-tool-item:hover .mega-pop-arr {
    color: #2563eb;
    transform: translateX(1px);
}

html.dark .mega-popular-tool-item:hover .mega-pop-arr {
    color: #60a5fa;
}

/* ==========================================
   HOMEPAGE HERO SECTION (Screenshot 1 Exact)
========================================== */
.hero-section {
    padding: 3.5rem 0 3.25rem;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 82% 28%, rgba(217, 70, 239, 0.12) 0%, transparent 45%),
                radial-gradient(circle at 78% 70%, rgba(56, 189, 248, 0.18) 0%, transparent 50%),
                linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
}

html.dark .hero-section {
    background: radial-gradient(circle at 82% 28%, rgba(217, 70, 239, 0.12) 0%, transparent 45%),
                radial-gradient(circle at 78% 70%, rgba(56, 189, 248, 0.14) 0%, transparent 50%),
                #0b1120;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) 420px;
    gap: 3.5rem;
    align-items: center;
    justify-content: space-between;
    max-width: 1260px;
    margin: 0 auto;
}

.hero-content {
    max-width: 620px;
    width: 100%;
}

/* 500+ Free Calculators Pill */
.hero-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #eff6ff;
    color: #2563eb;
    padding: 0.38rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    border: 1px solid #dbeafe;
}

.hero-badge-pill svg {
    color: #f59e0b;
}

html.dark .hero-badge-pill {
    background-color: #1e1b4b;
    color: #93c5fd;
    border-color: #312e81;
}

.hero-title {
    font-size: 3.6rem;
    font-weight: 850;
    letter-spacing: -0.035em;
    line-height: 1.08;
    color: #0f172a;
    margin-bottom: 1.15rem;
}

html.dark .hero-title {
    color: #f8fafc;
}

.hero-title-accent,
.hero-title .text-gradient {
    color: #2563eb;
}

html.dark .hero-title-accent,
html.dark .hero-title .text-gradient {
    color: #38bdf8;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 2rem;
    max-width: 580px;
}

html.dark .hero-subtitle {
    color: #94a3b8;
}

/* Hero Search Bar */
.hero-search-wrapper {
    position: relative;
    max-width: 590px;
    width: 100%;
    margin-bottom: 1.25rem;
}

.hero-search-form {
    position: relative;
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-full);
    padding: 0.35rem 0.45rem 0.35rem 1.35rem;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.07);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
}

html.dark .hero-search-form {
    background-color: #131b2e;
    border-color: #334155;
}

.hero-search-form:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.hero-search-icon {
    color: #94a3b8;
    margin-right: 0.65rem;
    flex-shrink: 0;
}

.hero-search-input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.hero-search-input::placeholder {
    color: #94a3b8;
}

.hero-search-btn {
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.72rem 2rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.hero-search-btn:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

/* Autocomplete Results Overlay */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-height: 380px;
    overflow-y: auto;
    z-index: 90;
    display: none;
}

.search-results-dropdown.active {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-color-subtle);
    transition: background-color 0.1s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: var(--bg-surface-secondary);
}

.search-result-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.search-result-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-category {
    font-size: 0.75rem;
    background-color: #eef2ff;
    color: #2563eb;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    font-weight: 600;
}

/* Popular Pills under Search */
.hero-popular-pills {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.825rem;
    margin-bottom: 2.25rem;
}

.hero-popular-label {
    font-weight: 700;
    color: #0f172a;
}

html.dark .hero-popular-label {
    color: #f8fafc;
}

.hero-pill-link {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 0.32rem 0.85rem;
    border-radius: var(--radius-full);
    color: #475569;
    font-weight: 500;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.12s ease;
}

html.dark .hero-pill-link {
    background-color: #131b2e;
    border-color: #334155;
    color: #94a3b8;
}

.hero-pill-link:hover {
    border-color: #2563eb;
    color: #2563eb;
    background-color: #eff6ff;
}

/* Trust Stats Bar (4 cards in a row) */
.hero-trust-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    max-width: 590px;
    width: 100%;
}

.trust-card {
    background-color: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 14px;
    padding: 0.75rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    min-width: 0;
}

html.dark .trust-card {
    background-color: #131b2e;
    border-color: #1e293b;
}

.trust-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.trust-text-box {
    min-width: 0;
}

.trust-number {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.15;
    color: #0f172a;
    white-space: nowrap;
}

html.dark .trust-number {
    color: #f8fafc;
}

.trust-label {
    font-size: 0.72rem;
    color: #64748b;
    line-height: 1.25;
    white-space: nowrap;
}

html.dark .trust-label {
    color: #94a3b8;
}

/* ==========================================
   Hero Right Side: Floating Quick Calculator Device & 3D Backdrop
========================================== */
.hero-calc-wrapper {
    position: relative;
    width: 420px;
    max-width: 100%;
    margin-left: auto;
}

/* 3D Liquid Gradient Mesh Backdrop */
.hero-calc-fluid-bg {
    position: absolute;
    width: 560px;
    height: 580px;
    top: -50px;
    left: -65px;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.hero-fluid-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 20px 40px rgba(56, 189, 248, 0.28));
}

/* 4 Floating Badges around Calculator */
.hero-float-badge {
    position: absolute;
    z-index: 10;
    background: #ffffff;
    border-radius: 16px;
    padding: 0.45rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    box-shadow: 0 12px 28px -4px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.95);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hero-float-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px -4px rgba(15, 23, 42, 0.16);
}

html.dark .hero-float-badge {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.4);
}

.hero-float-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hero-float-icon.pink {
    background: #fdf2f8;
    color: #ec4899;
}

.hero-float-icon.orange {
    background: #fff7ed;
    color: #f97316;
}

.hero-float-icon.cyan {
    background: #ecfeff;
    color: #06b6d4;
}

.hero-float-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.float-l1,
.float-l2 {
    font-size: 0.75rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}

html.dark .float-l1,
html.dark .float-l2 {
    color: #f8fafc;
}

/* Badge Coordinates matching Screenshot 1 */
.badge-top-left {
    top: -12px;
    left: -20px;
}

.badge-top-right {
    top: 0px;
    right: -25px;
}

.badge-mid-left {
    top: 56%;
    left: -36px;
}

.badge-mid-right {
    top: 58%;
    right: -25px;
}

/* The Device Card */
.hero-quick-calc-card {
    position: relative;
    z-index: 5;
    background-color: #ffffff;
    border-radius: 30px;
    box-shadow: 0 30px 60px -15px rgba(37, 99, 235, 0.18), 0 12px 28px -6px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(226, 232, 240, 0.8);
    padding: 1.65rem 1.5rem 1.5rem;
}

html.dark .hero-quick-calc-card {
    background-color: #131b2e;
    border-color: #1e293b;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.5), 0 0 0 1px #1e293b;
}

.qc-card-title {
    font-weight: 800;
    font-size: 1.1rem;
    color: #0f172a;
    margin-bottom: 0.85rem;
    display: block;
}

html.dark .qc-card-title {
    color: #f8fafc;
}

.qc-tabs-nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.qc-tab-btn {
    border: none;
    background: transparent;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.qc-tab-btn:hover {
    color: #2563eb;
}

.qc-tab-btn.active {
    background-color: #2563eb;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.qc-tab-panel {
    display: none;
}

.qc-tab-panel.active {
    display: block;
}

.qc-display-screen {
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.7rem 1.25rem;
    text-align: right;
    font-size: 2.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1.1rem;
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

html.dark .qc-display-screen {
    background-color: #0f172a;
    border-color: #1e293b;
    color: #f8fafc;
}

.qc-numpad-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
}

.qc-btn {
    height: 48px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    border-radius: 12px;
    font-size: 1.15rem;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.12s ease;
}

html.dark .qc-btn {
    background-color: #1a243b;
    border-color: #27354f;
    color: #f8fafc;
}

.qc-btn:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

html.dark .qc-btn:hover {
    background-color: #22304d;
}

.qc-btn.operator {
    background-color: #f8fafc;
    color: #475569;
    font-size: 1.25rem;
    font-weight: 500;
}

html.dark .qc-btn.operator {
    background-color: #1e293b;
    color: #cbd5e1;
}

.qc-btn.equals {
    background-color: #2563eb;
    color: #ffffff;
    border-color: transparent;
    font-size: 1.35rem;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.qc-btn.equals:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

/* Quick EMI Form */
.qc-form-group {
    margin-bottom: 0.75rem;
}

.qc-form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    display: block;
    margin-bottom: 0.25rem;
}

html.dark .qc-form-label {
    color: #94a3b8;
}

.qc-form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e1;
    background-color: #f8fafc;
    border-radius: 8px;
    font-size: 0.88rem;
    outline: none;
}

html.dark .qc-form-input {
    background-color: #0f172a;
    border-color: #27354f;
    color: #f8fafc;
}

.qc-result-box {
    margin-top: 1rem;
    padding: 0.85rem;
    border-radius: 10px;
    background: #eff6ff;
    text-align: center;
}

html.dark .qc-result-box {
    background: #1e1b4b;
}

.qc-result-label {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
}

html.dark .qc-result-label {
    color: #94a3b8;
}

.qc-result-val {
    font-size: 1.4rem;
    font-weight: 800;
    color: #2563eb;
}

html.dark .qc-result-val {
    color: #38bdf8;
}

/* ==========================================
   EXPLORE BY CATEGORY SECTION (Screenshot 1)
========================================== */
.category-section {
    padding: 3.5rem 0;
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.section-eyebrow {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #6366f1;
    margin-bottom: 0.35rem;
}

.section-title {
    font-size: 2.15rem;
    font-weight: 850;
    letter-spacing: -0.03em;
    color: #0f172a;
}

html.dark .section-title {
    color: #f8fafc;
}

.section-title span {
    color: #2563eb;
}

.btn-view-all {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1.15rem;
    border-radius: var(--radius-full);
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #475569;
    font-size: 0.825rem;
    font-weight: 700;
    transition: all 0.15s ease;
}

html.dark .btn-view-all {
    background-color: #131b2e;
    border-color: #27354f;
    color: #94a3b8;
}

.btn-view-all:hover {
    border-color: #2563eb;
    color: #2563eb;
    background-color: #eff6ff;
}

/* Exact 5 Columns x 4 Rows Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.95rem;
    margin-top: 2rem;
    margin-bottom: 4rem;
}

.category-card {
    background-color: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    padding: 0.95rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

html.dark .category-card {
    background-color: #131b2e;
    border-color: #1e293b;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    border-color: #cbd5e1;
}

.category-card-icon,
.category-card-svg-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.category-card-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: #0f172a;
    line-height: 1.25;
}

html.dark .category-card-name {
    color: #f8fafc;
}

.category-card-count {
    font-size: 0.74rem;
    color: #94a3b8;
    margin-top: 2px;
}

/* ==========================================
   SMART CALCULATORS FEATURE BANNER (Screenshot 1)
========================================== */
.promo-banner-section {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 50%, #f3e8ff 100%);
    border: 1px solid #dbeafe;
    border-radius: 28px;
    padding: 2.75rem 3rem;
    margin-bottom: 4.5rem;
    display: grid;
    grid-template-columns: 320px 1fr 240px;
    gap: 2.5rem;
    align-items: center;
}

html.dark .promo-banner-section {
    background: linear-gradient(135deg, #131b2e 0%, #1e1b4b 60%, #0f172a 100%);
    border-color: #27354f;
}

/* Dashboard Mockup Illustration on Left */
.banner-mockup-container {
    position: relative;
    max-width: 320px;
}

.banner-mockup-fluid-bg {
    position: absolute;
    width: 130%;
    height: 130%;
    top: -15%;
    left: -15%;
    background: radial-gradient(circle at 35% 35%, rgba(217, 70, 239, 0.3) 0%, transparent 60%),
                radial-gradient(circle at 65% 65%, rgba(56, 189, 248, 0.38) 0%, transparent 60%);
    filter: blur(35px);
    z-index: 1;
    pointer-events: none;
    border-radius: 50%;
}

.banner-mockup-wrapper {
    background: #ffffff;
    border-radius: 20px;
    padding: 1.25rem;
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 2;
    border: 1px solid #e2e8f0;
}

html.dark .banner-mockup-wrapper {
    background: #1a243b;
    border-color: #27354f;
}

.mockup-header-dots {
    display: flex;
    gap: 5px;
    margin-bottom: 1rem;
}

.mockup-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.mockup-inner-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 0.85rem;
    align-items: center;
}

.mini-numpad-box {
    background: #f8fafc;
    border-radius: 12px;
    padding: 0.65rem;
    border: 1px solid #e2e8f0;
}

html.dark .mini-numpad-box {
    background: #0f172a;
    border-color: #1e293b;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.mini-key {
    background: #ffffff;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: #475569;
    font-weight: 700;
}

html.dark .mini-key {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

.promo-banner-badge {
    display: inline-block;
    background-color: #dbeafe;
    color: #1e40af;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    margin-bottom: 0.85rem;
    letter-spacing: 0.05em;
}

html.dark .promo-banner-badge {
    background-color: #1e1b4b;
    color: #93c5fd;
}

.promo-banner-title {
    font-size: 2.15rem;
    font-weight: 850;
    line-height: 1.18;
    color: #0f172a;
    margin-bottom: 0.75rem;
}

html.dark .promo-banner-title {
    color: #f8fafc;
}

.promo-banner-title span {
    color: #2563eb;
}

.promo-banner-text {
    font-size: 0.95rem;
    color: #64748b;
    margin-bottom: 1.5rem;
    line-height: 1.55;
}

html.dark .promo-banner-text {
    color: #94a3b8;
}

.btn-explore-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #2563eb;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.7rem 1.65rem;
    border-radius: var(--radius-full);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-explore-pill:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

.promo-checklist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.promo-check-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
}

html.dark .promo-check-item {
    color: #f8fafc;
}

.promo-check-item svg {
    color: #0284c7;
    flex-shrink: 0;
}

/* ==========================================
   MOST USED CALCULATORS (Screenshot 1)
========================================== */
.popular-section {
    padding: 1rem 0 3.5rem;
}

.popular-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.15rem;
    margin-top: 1.75rem;
    margin-bottom: 4rem;
}

.popular-tool-card {
    background-color: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 20px;
    padding: 1.4rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 175px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

html.dark .popular-tool-card {
    background-color: #131b2e;
    border-color: #1e293b;
}

.popular-tool-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    border-color: #cbd5e1;
}

.popular-tool-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.popular-tool-title {
    font-size: 0.98rem;
    font-weight: 750;
    color: #0f172a;
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

html.dark .popular-tool-title {
    color: #f8fafc;
}

.popular-tool-desc {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.45;
}

html.dark .popular-tool-desc {
    color: #94a3b8;
}

.popular-arrow-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #eff6ff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    margin-left: auto;
    transition: background-color 0.15s ease, transform 0.12s ease;
}

html.dark .popular-arrow-circle {
    background-color: #1e1b4b;
    color: #60a5fa;
}

.popular-tool-card:hover .popular-arrow-circle {
    background-color: #2563eb;
    color: #ffffff;
    transform: translateX(2px);
}

/* ==========================================
   WHY CHOOSE CALCHUB SECTION
========================================== */
.why-section {
    padding: 3.5rem 0 4rem;
    border-top: 1px solid #f1f5f9;
    background: linear-gradient(180deg, #eef2ff 0%, #eff6ff 50%, #f0f9ff 100%);
}

html.dark .why-section {
    border-color: #1e293b;
    background: linear-gradient(180deg, #0f172a 0%, #131b2e 100%);
}

.why-header {
    text-align: center;
    margin-bottom: 3rem;
}

.why-pill-badge {
    display: inline-block;
    background-color: #eff6ff;
    color: #2563eb;
    padding: 0.3rem 0.95rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

html.dark .why-pill-badge {
    background-color: #1e1b4b;
    color: #93c5fd;
}

.why-title {
    font-size: 2.15rem;
    font-weight: 850;
    letter-spacing: -0.025em;
    color: #0f172a;
}

html.dark .why-title {
    color: #f8fafc;
}

.why-title .color-blue {
    color: #2563eb;
}

.why-title .color-purple {
    color: #7c3aed;
}

.why-subtitle {
    font-size: 0.92rem;
    color: #64748b;
    margin-top: 0.35rem;
}

html.dark .why-subtitle {
    color: #94a3b8;
}

.why-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.why-box {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.why-icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.why-icon-circle.bg-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
}

.why-icon-circle.bg-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.why-icon-circle.bg-pink {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

.why-icon-circle.bg-blue {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
}

.why-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.15rem;
}

html.dark .why-name {
    color: #f8fafc;
}

.why-desc {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.35;
}

html.dark .why-desc {
    color: #94a3b8;
}

/* ==========================================
   FOOTER REDESIGN (Screenshot 2 Exact)
========================================== */
.site-footer-redesign {
    margin-top: auto;
    position: relative;
    background: transparent;
}

/* 1. Newsletter Card Wrap */
.footer-newsletter-wrap {
    padding: 0 0 2rem;
    position: relative;
    z-index: 5;
}

.footer-newsletter-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8faff 50%, #eff6ff 100%);
    border: 1.5px solid #dbeafe;
    border-radius: 24px;
    padding: 2.25rem 3rem;
    box-shadow: 0 20px 40px -15px rgba(37, 99, 235, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    display: grid;
    grid-template-columns: 140px 1.25fr 1.35fr;
    gap: 2.5rem;
    align-items: center;
    position: relative;
    overflow: hidden;
}

html.dark .footer-newsletter-card {
    background: linear-gradient(135deg, #0d1a33 0%, #102142 50%, #15274d 100%);
    border-color: #1e3a6a;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.4);
}

.newsletter-illustration {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.newsletter-airplane {
    position: absolute;
    top: 15px;
    right: 25px;
    pointer-events: none;
}

.newsletter-eyebrow {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #2563eb;
    margin-bottom: 0.35rem;
}

html.dark .newsletter-eyebrow {
    color: #60a5fa;
}

.newsletter-title {
    font-size: 1.5rem;
    font-weight: 850;
    letter-spacing: -0.025em;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 0.4rem;
}

html.dark .newsletter-title {
    color: #f8fafc;
}

.newsletter-desc {
    font-size: 0.88rem;
    color: #64748b;
    line-height: 1.5;
}

html.dark .newsletter-desc {
    color: #94a3b8;
}

.newsletter-form-box {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.newsletter-form {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-full);
    padding: 0.3rem 0.35rem 0.3rem 1.15rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
    transition: all 0.15s ease;
}

html.dark .newsletter-form {
    background: #091326;
    border-color: #273e6b;
}

.newsletter-form:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.newsletter-input-icon {
    color: #64748b;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.newsletter-input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.9rem;
    color: #0f172a;
}

html.dark .newsletter-input {
    color: #f8fafc;
}

.newsletter-btn {
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.65rem 1.45rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.newsletter-btn:hover {
    background-color: #1d4ed8;
}

.newsletter-trust-tags {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
}

html.dark .newsletter-trust-tags {
    color: #94a3b8;
}

.newsletter-trust-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.newsletter-trust-item svg {
    color: #2563eb;
}

/* 2. Main Dark Footer Body */
.footer-main-dark {
    background-color: #060e1f;
    color: #cbd5e1;
    padding: 4.5rem 0 2.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-main-grid {
    display: grid;
    grid-template-columns: 320px repeat(4, 1fr);
    gap: 2.5rem;
    margin-bottom: 3.5rem;
}

/* Column 1: Brand Info, Socials, Stats */
.footer-brand-bio {
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.6;
    margin: 1.15rem 0 1.35rem;
}

.footer-social-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.75rem;
}

.footer-social-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: transform 0.15s ease, opacity 0.15s ease;
    text-decoration: none;
}

.footer-social-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.social-fb { background: #1877f2; }
.social-x { background: #0f172a; border: 1px solid #334155; }
.social-insta { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.social-yt { background: #ff0000; }
.social-pinterest { background: #e60023; }
.social-linkedin { background: #0a66c2; }

.footer-stats-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-top: 1.15rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-stat-icon {
    color: #38bdf8;
    flex-shrink: 0;
}

.footer-stat-val {
    font-size: 0.92rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.1;
}

.footer-stat-lbl {
    font-size: 0.68rem;
    color: #64748b;
    line-height: 1.2;
}

/* Columns 2-5: Nav Columns */
.footer-column-title {
    font-size: 0.92rem;
    font-weight: 750;
    color: #ffffff;
    margin-bottom: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-column-title svg {
    color: #38bdf8;
}

.footer-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.footer-nav-item a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.84rem;
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.12s ease, transform 0.12s ease;
}

.footer-nav-item a:hover {
    color: #ffffff;
    transform: translateX(2px);
}

.footer-nav-chevron {
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    transition: color 0.12s ease;
}

.footer-nav-item a:hover .footer-nav-chevron {
    color: #38bdf8;
}

/* Column 6: CalcHub App Card */
.footer-app-card {
    background: linear-gradient(145deg, #0d1e3d 0%, #151638 60%, #0d1326 100%);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 20px;
    padding: 1.4rem;
    box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
}

.footer-app-left {
    flex: 1;
    z-index: 2;
}

.footer-app-title {
    font-size: 1.25rem;
    font-weight: 850;
    color: #ffffff;
    line-height: 1.15;
}

.footer-app-sub {
    font-size: 0.78rem;
    color: #93c5fd;
    margin-top: 0.25rem;
    margin-bottom: 0.95rem;
}

.footer-app-checks {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 1.15rem;
}

.footer-app-check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #e2e8f0;
}

.footer-app-check svg {
    color: #38bdf8;
    flex-shrink: 0;
}

.footer-app-stores {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.store-badge-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    background: #000000;
    border: 1px solid #334155;
    border-radius: 9px;
    padding: 0.35rem 0.85rem;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.15s ease;
}

.store-badge-btn:hover {
    border-color: #60a5fa;
    background: #0f172a;
}

.store-badge-texts {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.1;
}

.store-badge-sup {
    font-size: 0.58rem;
    color: #94a3b8;
    text-transform: uppercase;
}

.store-badge-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #ffffff;
}

/* 3D Smartphone Mockup in App Card */
.footer-app-phone {
    width: 95px;
    height: 180px;
    background: #090d16;
    border: 2px solid #334155;
    border-radius: 16px;
    padding: 4px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 15px rgba(56, 189, 248, 0.15);
    transform: rotate(3deg) translateY(-5px);
    flex-shrink: 0;
    margin-left: 0.5rem;
    position: relative;
    overflow: hidden;
}

.phone-screen {
    background: #f8fafc;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.phone-top-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 8px;
    margin-bottom: 2px;
}

.phone-notch {
    width: 28px;
    height: 4px;
    background: #0f172a;
    border-radius: 2px;
}

.phone-logo {
    font-size: 8px;
    font-weight: 800;
    color: #0f172a;
    text-align: center;
}

.phone-grid-icons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    padding: 2px;
}

.phone-mini-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    padding: 4px 2px;
    text-align: center;
}

.phone-mini-icon {
    font-size: 9px;
    display: block;
    line-height: 1;
}

.phone-mini-lbl {
    font-size: 6px;
    font-weight: 700;
    color: #475569;
    margin-top: 2px;
    line-height: 1;
}

/* 3. Popular Searches Row */
.footer-searches-box {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 2rem;
    margin-top: 2.5rem;
}

.footer-searches-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 1.15rem;
}

.footer-searches-title svg {
    color: #38bdf8;
}

.footer-pill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.footer-search-pill {
    background: rgba(15, 27, 49, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.22);
    border-radius: var(--radius-full);
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #93c5fd;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
}

.footer-search-pill:hover {
    background: #1e3a6a;
    border-color: #38bdf8;
    color: #ffffff;
    transform: translateY(-1px);
}

.footer-search-pill .pill-arr {
    color: #60a5fa;
    font-size: 0.72rem;
}

/* 4. Bottom Footer Bar */
.footer-bottom-bar {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 2rem;
    margin-top: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.25rem;
    font-size: 0.825rem;
    color: #64748b;
}

.footer-copy {
    color: #94a3b8;
}

.footer-copy strong {
    color: #ffffff;
}

.footer-bottom-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    list-style: none;
}

.footer-bottom-links a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.12s ease;
}

.footer-bottom-links a:hover {
    color: #ffffff;
}

.footer-bottom-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-lang-btn {
    background: rgba(15, 27, 49, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    padding: 0.35rem 0.95rem;
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: all 0.15s ease;
}

.footer-lang-btn:hover {
    background: #1e293b;
    color: #ffffff;
    border-color: #38bdf8;
}

.footer-scroll-top-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1e3a6a;
    border: 1.5px solid #38bdf8;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 12px rgba(56, 189, 248, 0.25);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(14px) scale(0.9);
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                background-color 0.15s ease,
                border-color 0.15s ease,
                box-shadow 0.15s ease;
}

.footer-scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.footer-scroll-top-btn:hover {
    background: #2563eb;
    border-color: #60a5fa;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.5), 0 0 18px rgba(56, 189, 248, 0.4);
}

.footer-scroll-top-btn:active {
    transform: translateY(0) scale(0.95);
}

/* ==========================================
   SEARCH MODAL
========================================== */
.search-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5rem;
}

.search-modal.active {
    display: flex;
}

.search-modal-box {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    width: min(92vw, 680px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

html.dark .search-modal-box {
    background-color: #131b2e;
    border-color: #27354f;
}

.modal-search-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}

html.dark .modal-search-header {
    border-color: #1e293b;
}

.modal-search-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 1.15rem;
    background: transparent;
    color: var(--text-primary);
    margin-left: 0.75rem;
}

.modal-search-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #94a3b8;
}

.modal-search-results {
    max-height: 420px;
    overflow-y: auto;
    padding: 0.5rem;
}

.search-empty-hint {
    padding: 2.5rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

/* Cookie & Ad Preferences Banner */
.cookie-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 990;
    max-width: 860px;
    margin: 0 auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 18px 40px -12px rgba(15, 23, 42, 0.22);
    padding: 0.9rem 1.2rem;
}

.cookie-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.cookie-banner-text {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--text-secondary);
    flex: 1 1 320px;
}

.cookie-banner-text a {
    color: var(--color-primary);
    font-weight: 700;
    text-decoration: underline;
}

.cookie-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.cookie-btn-secondary,
.cookie-btn-primary {
    padding: 0.48rem 0.95rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.cookie-btn-secondary {
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
}

.cookie-btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}

@media print {
    .cookie-banner,
    .mini-calc-fab,
    .mini-calc-popover {
        display: none !important;
    }
}

/* Floating Site-Wide Mini Quick Calculator */
.mini-calc-fab {
    position: fixed;
    left: 1.25rem;
    bottom: 1.25rem;
    z-index: 940;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--color-primary);
    box-shadow: 0 10px 26px -6px rgba(15, 23, 42, 0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.mini-calc-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -6px rgba(37, 99, 235, 0.3);
}

.mini-calc-popover {
    position: fixed;
    left: 1.25rem;
    bottom: 4.75rem;
    z-index: 950;
    width: 248px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 0.85rem;
    box-shadow: 0 22px 45px -12px rgba(15, 23, 42, 0.28);
}

.mini-calc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.55rem;
}

.mini-calc-close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.mini-calc-display {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 800;
    text-align: right;
    margin-bottom: 0.6rem;
}

.mini-calc-keys {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.38rem;
}

.mini-calc-keys button {
    position: relative;
    overflow: hidden;
    padding: 0.55rem 0;
    border-radius: 10px;
    border: 1px solid var(--border-color-subtle);
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.mini-calc-keys button::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid transparent;
    pointer-events: none;
    opacity: 0;
}

.mini-calc-keys button:active,
.mini-calc-keys button.mc-key-active {
    transform: scale(0.92);
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
    animation: mcCornerPulse 360ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.mini-calc-keys button.mc-key-active::after {
    border-color: rgba(37, 99, 235, 0.75);
    animation: mcBorderCorner 360ms ease-out forwards;
}

.mini-calc-keys button.mc-op {
    color: var(--color-primary);
}

.mini-calc-keys button.mc-eq {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}

.mini-calc-keys button.mc-eq:active,
.mini-calc-keys button.mc-eq.mc-key-active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

.mini-calc-keys button.mc-eq.mc-key-active::after {
    border-color: rgba(255, 255, 255, 0.85);
}

.mc-ripple {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.38) 0%, rgba(37, 99, 235, 0.12) 70%, transparent 100%);
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    animation: mcRippleExpand 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.mini-calc-keys button.mc-eq .mc-ripple {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.15) 70%, transparent 100%);
}

@keyframes mcRippleExpand {
    0% {
        transform: translate(-50%, -50%) scale(0.2);
        opacity: 0.95;
    }
    100% {
        transform: translate(-50%, -50%) scale(5.2);
        opacity: 0;
    }
}

@keyframes mcCornerPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5);
    }
    100% {
        box-shadow: 0 0 0 6px rgba(37, 99, 235, 0);
    }
}

@keyframes mcBorderCorner {
    0% {
        opacity: 1;
        transform: scale(0.86);
    }
    100% {
        opacity: 0;
        transform: scale(1.04);
    }
}
