    /* Cache bust: 2026-01-29 - UX Enhancements */
    * {
    box-sizing: border-box;
}

/* Prevent horizontal overflow on mobile */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Enhanced Search Bar */
.search-bar-wrapper {
    flex: 1;
    max-width: 350px;
}

.search-bar-input {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 20px 12px 44px;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.search-bar-input:focus {
    border-color: #4ecdc4;
    box-shadow: 0 4px 20px rgba(78, 205, 196, 0.3);
    background: #fff;
}

.search-bar-input::placeholder {
    color: #6b7280;
    font-weight: 500;
}

.search-bar {
    position: relative;
}

.search-bar::before {
    content: "\f002";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 14px;
    z-index: 1002;
    pointer-events: none;
}

/* Hero Section Styles - Compact Version */
.hero-section {
    background: linear-gradient(135deg, #053b7d 0%, #0a5a9c 100%);
    padding: 20px 20px;
    text-align: center;
    position: relative;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.hero-text {
    text-align: left;
    flex: 1;
    min-width: 250px;
}

.hero-title {
    color: white;
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 5px 0;
}

.hero-subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 0.95rem;
    margin: 0;
}

.hero-stats {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: #4ecdc4;
    font-family: 'Orbitron', monospace;
    line-height: 1;
}

.stat-label {
    color: rgba(255,255,255,0.75);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-cta {
    display: none;
}

.cta-button {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Scroll Reveal Animations */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children animations */
.reveal-stagger > * {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease-out;
}

.reveal-stagger.active > *:nth-child(1) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.reveal-stagger.active > *:nth-child(2) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.reveal-stagger.active > *:nth-child(3) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }
.reveal-stagger.active > *:nth-child(4) { transition-delay: 0.4s; opacity: 1; transform: translateY(0); }

/* Button hover effects */
.button-section button {
    transition: all 0.3s ease;
}

.button-section button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(5, 59, 125, 0.4);
}

/* Calculator card hover enhancements */
.calculator-item {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tab content smooth transitions */
.tab-pane {
    animation: none;
}

.tab-pane.active {
    animation: tabFadeIn 0.4s ease-out;
}

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

/* Pulse animation for CTA */
.cta-button {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4); }
    50% { box-shadow: 0 4px 25px rgba(78, 205, 196, 0.6); }
}

.cta-button:hover {
    animation: none;
}

html {
    height: 100%
}

body {
    display: flex;
    flex-direction: column;
    margin: 0;
    min-height: 100%;
    padding: 0;
    font-family: Arial, sans-serif
}

#homecalc_main {
    border: 2px solid #ddd;
    margin-left: auto;
    margin-right: auto;
    padding: 15px;
    background-color: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 800px;
    box-sizing: border-box;
}

.logo {
    padding: 10px 0;
    width: auto;
    max-width: 350px;
    float: none;
    margin-left: 0;
}

.container {
    flex: 1 0 auto;
    padding: 10px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 3fr 1fr;
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
        "left right"
        "categories right"
        "button button"
        "ad ad" !important;
    grid-gap: 20px;
    max-width: 1600px;
    overflow-x: hidden;
    align-items: start;
}

.ad-section,
.button-section,
.left-section {
    padding: 5px;
    max-width: 100%;
    overflow-x: auto
}

.left-section {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    grid-area: left;
    padding: 20px;
    max-width: 100%;
    overflow-x: auto;
    background-color: #fff;
    border-radius: 5px;
    box-sizing: border-box;
}

.sub-container {
    padding: 15px;
}

.ad-container {
    grid-area: right;
    padding: 15px;
    max-width: 320px;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-right: 0;
    gap: 16px;
}

/* Sidebar Sections */
.sidebar-section {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
}

.sidebar-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-section h3 i {
    color: #053b7d;
    font-size: 14px;
}

/* Share Section */
.share-section {
    padding: 12px;
}

/* Recently Used Section */
.recently-used-section h3 i { color: #6366f1; }

.recently-used-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.recently-used-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f8fafc;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    font-size: 13px;
    transition: all 0.2s ease;
}

.recently-used-item:hover {
    background: #e0f2fe;
    color: #0369a1;
}

.recently-used-item i,
.recently-used-item i.calculator-icon {
    color: #6b7280;
    font-size: 12px;
    width: 16px;
    height: auto;
    min-width: 16px;
    text-align: center;
    background: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    margin-right: 0;
}

/* Quick Tools Section */
.quick-tools-section h3 i { color: #f59e0b; }

.quick-tool {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f3f4f6;
}

.quick-tool:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.quick-tool label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 6px;
}

.quick-tool-inputs {
    display: flex;
    gap: 6px;
    align-items: center;
}

.quick-tool-inputs input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    min-width: 0;
}

.quick-tool-inputs input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.quick-tool-inputs select {
    padding: 8px 6px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    cursor: pointer;
}

.quick-tool-inputs span {
    color: #6b7280;
    font-size: 13px;
}

.quick-tool-result {
    margin-top: 8px;
    padding: 8px 10px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #047857;
    text-align: center;
}

/* Popular Calculators Section */
.popular-calcs-section h3 i { color: #ef4444; }

.popular-calc-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.popular-calc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    font-size: 13px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.popular-calc-item:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
    transform: translateX(4px);
}

.popular-calc-item i {
    color: #053b7d;
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.popular-calc-item:hover i {
    color: #1d4ed8;
}

/* Ad Unit Section */
.ad-unit-section {
    padding: 10px;
    background: #f9fafb;
    text-align: center;
}

/* Removed old full-section styles - replaced with category-cards-section */

.button-section {
    grid-area: button;
    display: flex;
    justify-content: center;
    align-items: center
}

.button-section button {
    padding: 12px 24px;
    font-size: 16px;
    cursor: pointer;
    background-color: #053b7d;
    color: #fff;
    border: none;
    transition: .4s;
    border-radius: 10px;
    min-height: 48px;
}

.button-section button:hover {
    background-color: #298bac
}

.ad-section {
    grid-area: ad;
    display: flex;
    justify-content: center;
    align-items: center
}

/* Modern Footer Styles */
.modern-footer {
    background: linear-gradient(135deg, #053b7d 0%, #0a4a8f 100%);
    color: #fff;
    padding: 0;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 50px 30px 30px;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 50px;
}

.footer-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.footer-brand {
    margin-bottom: 10px;
}

.footer-logo {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.3);
}

.footer-tagline {
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
    margin-top: 5px;
}

.footer-description p {
    color: rgba(255,255,255,0.8);
    line-height: 1.7;
    font-size: 0.95rem;
}

.footer-links-section {
    display: flex;
    gap: 40px;
    justify-content: flex-end;
}

.footer-links-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-links-group h4 {
    color: #4ecdc4;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    font-weight: 700;
}

.footer-links-group a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    padding: 8px 0;
    display: inline-block;
    min-height: 44px;
    line-height: 1.4;
}

.footer-links-group a:hover {
    color: #4ecdc4;
    transform: translateX(3px);
}

.footer-bottom {
    background: rgba(0,0,0,0.2);
    padding: 20px 30px;
    text-align: center;
}

.footer-bottom p {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    margin: 0;
}

.footer-bottom a {
    color: #4ecdc4;
    text-decoration: none;
    padding: 8px 0;
    display: inline-block;
}

.footer-bottom a:hover {
    text-decoration: underline;
}

/* Footer Mobile Styles */
@media (max-width: 768px) {
    .footer-container {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 30px 20px;
    }

    .footer-links-section {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 25px;
    }

    .footer-links-group {
        min-width: 120px;
    }

    .footer-logo {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .footer-links-section {
        flex-direction: column;
        gap: 20px;
    }

    .footer-links-group {
        text-align: center;
    }
}

/* Legacy footer styles for other pages */
footer:not(.modern-footer) {
    background-color: #053b7d;
    padding-left: 300px;
    padding-right: 300px;
    padding-top: 20px;
    padding-bottom: 20px;
    text-align: left;
    color: #fff
}

footer:not(.modern-footer) a {
    color: #fff;
    text-decoration: none
}

footer:not(.modern-footer) a:hover {
    color: #fff
}


.hide {
    transform: translateX(100%)
}

.show {
    transform: translateX(0)
}

#nav-menu {
    display: flex;
    transition: transform .3s ease-in-out;
    transform: translateX(0)
}

.category_icon {
    padding: 20px 0 20px 10px
}

.hl {
    list-style-type: none;
    margin: 0;
    padding: 5px 0 5px 8px;
    background-color: #fff;
    font-size: 16px;
    color: rgba(2, 2, 38, .572)
}

.hl li {
    padding: 0 0 8px 0;
    color: navy
}

.hl li a {
    text-decoration: none;
    color: navy
}

.hl li a:hover {
    text-decoration: none;
    color: navy
}



@media (max-width:800px) {
    .nav-toggle {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        cursor: pointer;
        min-width: 48px;
        min-height: 48px;
        padding: 12px;
        align-items: center;
        justify-content: center;
    }

    .nav-toggle div {
        width: 22px;
        height: 2px;
        background: white;
        border-radius: 1px;
    }

    #nav-menu {
        display: none !important;
        flex-direction: column;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: #1a365d;
        padding: 20px;
        width: 100%;
        height: auto;
        z-index: 1000;
        align-items: stretch;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    #nav-menu.show {
        display: flex !important;
    }
    
    #nav-menu .nav-button {
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: #e2e8f0;
        border-radius: 6px;
        padding: 12px 18px;
        font-weight: 500;
        margin: 5px 0;
        text-align: center;
        transition: all 0.3s ease;
        text-decoration: none;
        display: block;
        font-size: 14px;
    }
    
    #nav-menu .nav-button:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.3);
        color: white;
    }

    .full-section {
        grid-template-columns: 1fr
    }

    .container {
        grid-template-columns: 1fr;
        grid-template-areas: "right" "left" "full" "button" "ad";
        width: 95%;
        margin-left: auto;
        margin-right: auto;
        margin-top: 20px; /* Add space below header */
    }
    
    /* Ensure proper stacking on mobile */
    body {
        padding-top: 0;
    }
    
    header {
        position: relative;
        z-index: 1001;
    }

    .logo {
        margin-left: 0
    }

    #homecalc_main {
        width: 100%;
        margin-left: auto;
        margin-right: auto;
        padding: 5px;
        box-sizing: border-box
    }

    .btn,
    .btn-blue,
    .btn-num {
        width: calc((100% - (6 * 1.5%))/ 5);
        height: 45px;
        margin: 1.5%
    }

    #input-box {
        width: 100%
    }

    footer {
        background-color: #053b7d;
        padding-left: 5px;
        padding-right: 5px;
        padding-top: 20px;
        padding-bottom: 20px;
        text-align: left;
        color: #fff
    }

    #main {
        border: 1px solid #ddd;
        margin: 0 auto;
        padding: 15px 10px;
        width: 90%;
        box-sizing: border-box
    }

    #input-box {
        padding: 0;
        text-align: right;
        width: 100%;
        height: 33px;
        font-weight: 700
    }

    .btn {
        height: 25.5px;
        width: calc((100% - (6 * 1.5%))/ 5);
        background-color: #d3d3d3;
        border: none;
        color: #445;
        text-align: center;
        text-decoration: none;
        display: inline-block;
        font-size: 14px;
        font-weight: 700;
        margin: 1.5%;
        cursor: pointer
    }

    .btn:hover {
        box-shadow: inset 0 0 0 .75px #b3b3b3;
        color: #333
    }

    .btn-blue {
        color: #fff;
        font-weight: 700;
        background-color: #4788ee
    }

    .btn-blue:hover {
        box-shadow: inset 0 0 0 .75px #4d4dff;
        color: #fff;
        background-color: #4788ff
    }

    .btn-num {
        background-color: #f3f3f3
    }

    /* Mobile Hero Section */
    .hero-section {
        padding: 30px 15px;
    }

    .hero-title {
        font-size: 1.6rem;
        margin-bottom: 10px;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .hero-stats {
        gap: 20px;
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .cta-button {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

    /* Mobile Tab Buttons - Horizontal Scroll */
    .tab-buttons {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        flex-wrap: nowrap;
    }

    .tab-buttons::-webkit-scrollbar {
        display: none;
    }

    .tab-button {
        flex: 0 0 auto;
        min-width: 120px;
        padding: 12px 15px;
        font-size: 13px;
    }

    .tab-button img {
        display: none;
    }

    .tab-content {
        padding: 15px;
    }

    .calculator-grid-tab {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .calculator-item {
        padding: 14px 12px;
        font-size: 14px;
    }

    /* Mobile Footer */
    footer {
        padding: 20px 15px;
        font-size: 14px;
        line-height: 1.6;
    }

    .footer-links {
        flex-direction: column;
        gap: 10px;
    }

    /* Hide ad container on small mobile */
    .ad-container {
        display: none;
    }

    /* Better touch targets */
    .nav-button {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .hero-title {
        font-size: 1.4rem;
    }

    .hero-stats {
        gap: 15px;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .tab-button {
        min-width: 100px;
        padding: 10px 12px;
        font-size: 12px;
    }

    .category-tabs-section {
        padding: 15px 10px !important;
    }

    .category-tabs-section h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }
}

/* ========================================
   SPECTACULAR SCIENTIFIC CALCULATOR
   ======================================== */

/* Calculator Container - Premium Glass Effect */
.calculator-grid {
    display: grid;
    max-width: 720px;
    width: 100%;
    grid-template-columns: repeat(8, 1fr);
    grid-gap: 8px;
    padding: 24px;
    margin: 0 auto;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 50%, #1e3a5f 100%);
    border-radius: 20px;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

/* Decorative glow effect */
.calculator-grid::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 20%, rgba(78, 205, 196, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* ===== DISPLAY SCREEN - Glowing LCD Effect ===== */
.calculator-grid>input {
    grid-column: span 6;
    height: 65px;
    font-size: 2.2rem;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 500;
    text-align: right;
    padding: 12px 18px;
    margin-bottom: 12px;
    border: 2px solid rgba(78, 205, 196, 0.3);
    color: #4ecdc4;
    border-radius: 12px;
    background: linear-gradient(180deg, #0a192f 0%, #0d2137 100%);
    box-shadow:
        inset 0 4px 15px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(78, 205, 196, 0.15),
        0 2px 0 rgba(255, 255, 255, 0.05);
    box-sizing: border-box;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
    letter-spacing: 1px;
}

/* ===== BUTTON BASE STYLES ===== */
.calculator-grid>button {
    font-size: 1rem;
    font-weight: 600;
    padding: 10px 6px;
    min-height: 46px;
    background: linear-gradient(145deg, #3d5a80 0%, #2c4a6e 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #e8f4f8;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    transition: all 0.12s ease;
    cursor: pointer;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.calculator-grid>button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    filter: brightness(1.1);
}

.calculator-grid>button:active {
    transform: translateY(1px) scale(0.98);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ===== NUMBER BUTTONS - Bright & Clear ===== */
.calculator-grid>button.number {
    background: linear-gradient(145deg, #4a6fa5 0%, #3d5a80 100%);
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.calculator-grid>button.number:hover {
    background: linear-gradient(145deg, #5a8fc5 0%, #4a7fb5 100%);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.4),
        0 0 15px rgba(90, 143, 197, 0.3);
}

/* ===== OPERATOR BUTTONS - Vibrant Orange ===== */
.calculator-grid>button.operator {
    background: linear-gradient(145deg, #ff8c42 0%, #ff6b35 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.calculator-grid>button.operator:hover {
    background: linear-gradient(145deg, #ffa06a 0%, #ff8c42 100%);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(255, 140, 66, 0.4);
}

/* ===== FUNCTION BUTTONS - Teal/Cyan ===== */
.calculator-grid>button.function {
    background: linear-gradient(145deg, #20c997 0%, #12b886 100%);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.calculator-grid>button.function:hover {
    background: linear-gradient(145deg, #38d9a9 0%, #20c997 100%);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.4),
        0 0 15px rgba(32, 201, 151, 0.4);
}

/* ===== CLEAR/DELETE BUTTONS - Red Warning ===== */
.calculator-grid>button.clear {
    background: linear-gradient(145deg, #ff6b6b 0%, #ee5a5a 100%);
    color: #ffffff;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.calculator-grid>button.clear:hover {
    background: linear-gradient(145deg, #ff8787 0%, #ff6b6b 100%);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.4),
        0 0 15px rgba(255, 107, 107, 0.4);
}

/* ===== EQUALS BUTTON - Prominent Blue ===== */
.calculator-grid>button.equals {
    background: linear-gradient(145deg, #4dabf7 0%, #339af0 100%);
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.calculator-grid>button.equals:hover {
    background: linear-gradient(145deg, #74c0fc 0%, #4dabf7 100%);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.4),
        0 0 25px rgba(77, 171, 247, 0.5);
}

/* ===== MEMORY BUTTONS - Purple Accent ===== */
.calculator-grid>button.memory {
    background: linear-gradient(145deg, #9775fa 0%, #845ef7 100%);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
}

.calculator-grid>button.memory:hover {
    background: linear-gradient(145deg, #b197fc 0%, #9775fa 100%);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.4),
        0 0 15px rgba(151, 117, 250, 0.4);
}

/* ===== UTILITY BUTTONS - Subtle Gray ===== */
.calculator-grid>button.utility {
    background: linear-gradient(145deg, #5c6b7a 0%, #4a5568 100%);
    color: #e2e8f0;
    font-size: 0.8rem;
}

.calculator-grid>button.utility:hover {
    background: linear-gradient(145deg, #6b7c8a 0%, #5c6b7a 100%);
}

/* ===== ANGLE MODE SELECTOR ===== */
.angle-mode {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    grid-column: span 2;
    margin-bottom: 8px;
    border-radius: 8px;
}

.angle-mode>span {
    padding: 6px 10px;
    background: linear-gradient(145deg, #5c6b7a 0%, #4a5568 100%);
    color: #e8f4f8;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.angle-mode>select {
    height: 28px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: linear-gradient(145deg, #4a6fa5 0%, #3d5a80 100%);
    color: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
}

/* ===== HISTORY BOX - Enhanced Visibility ===== */
.calculator-grid>.history-box {
    grid-column: span 6;
    overflow-y: auto;
    border: 2px solid rgba(78, 205, 196, 0.2);
    background: linear-gradient(180deg, #0a192f 0%, #0d2137 100%);
    color: #a8dadc;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    height: 50px;
    max-height: 50px;
    margin-top: 10px;
    box-shadow:
        inset 0 3px 10px rgba(0, 0, 0, 0.5),
        0 0 10px rgba(78, 205, 196, 0.1);
    resize: none;
}

/* ===== CLEAR HISTORY BUTTON ===== */
.calculator-grid>#clear-history {
    grid-column: span 2;
    height: 50px;
    min-height: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 10px;
    background: linear-gradient(145deg, #6c757d 0%, #5a6268 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.calculator-grid>#clear-history:hover {
    background: linear-gradient(145deg, #868e96 0%, #6c757d 100%);
}

/* ===== PLACEHOLDER STYLING ===== */
::placeholder {
    font-size: 0.8rem;
    text-align: center;
    color: #4a6fa5;
    opacity: 0.7;
}

/* ===== UX ENHANCEMENTS ===== */

/* Live Preview - shows result as you type */
.calculator-grid>input.has-preview::after {
    content: attr(data-preview);
    position: absolute;
    right: 20px;
    font-size: 0.9rem;
    color: #6b8cae;
    opacity: 0.7;
}

/* Result flash animation */
@keyframes resultFlash {
    0% { background-color: rgba(78, 205, 196, 0.3); }
    100% { background-color: transparent; }
}

.calculator-grid>input.result-flash {
    animation: resultFlash 0.3s ease-out;
}

/* Error shake animation */
@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.calculator-grid>input.error-shake {
    animation: errorShake 0.4s ease-out;
    border-color: #ff6b6b !important;
    color: #ff6b6b !important;
}

/* Button pressed state */
.calculator-grid>button.pressed {
    transform: scale(0.95) !important;
    filter: brightness(0.9);
}

/* Toast notifications */
.calc-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

.calc-toast-info {
    background: linear-gradient(135deg, #4dabf7 0%, #339af0 100%);
    color: white;
}

.calc-toast-error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
}

.calc-toast-warning {
    background: linear-gradient(135deg, #ffd43b 0%, #fab005 100%);
    color: #333;
}

.calc-toast-success {
    background: linear-gradient(135deg, #20c997 0%, #12b886 100%);
    color: white;
}

/* Tooltips for buttons */
.calculator-grid>button[title] {
    position: relative;
}

.calculator-grid>button[title]::after {
    content: attr(title);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

.calculator-grid>button[title]::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.85);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

.calculator-grid>button[title]:hover::after,
.calculator-grid>button[title]:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Keyboard focus indicator */
.calculator-grid>button:focus {
    outline: 2px solid #4ecdc4;
    outline-offset: 2px;
}

.calculator-grid>input:focus {
    outline: none;
    border-color: #4ecdc4;
    box-shadow:
        inset 0 4px 15px rgba(0, 0, 0, 0.6),
        0 0 25px rgba(78, 205, 196, 0.3),
        0 2px 0 rgba(255, 255, 255, 0.05);
}

/* ===== MOBILE CALCULATOR STYLES - COMPREHENSIVE ===== */

/* Tablets */
@media only screen and (max-width: 900px) {
    .calculator-grid {
        max-width: 100%;
        padding: 18px;
        grid-gap: 6px;
    }

    .calculator-grid>button {
        font-size: 0.95rem;
        padding: 8px 5px;
        min-height: 44px;
    }

    .calculator-grid>input {
        font-size: 1.8rem;
        height: 58px;
    }
}

/* Large phones / Small tablets */
@media only screen and (max-width: 768px) {
    .calculator-grid {
        grid-template-columns: repeat(5, 1fr);
        max-width: 100%;
        padding: 15px;
        grid-gap: 5px;
        border-radius: 15px;
        margin: 0 10px;
    }

    .calculator-grid>button {
        font-size: 0.85rem;
        padding: 6px 4px;
        min-height: 46px;
        border-radius: 8px;
    }

    .calculator-grid>button.number {
        font-size: 1.1rem;
    }

    .calculator-grid>button.operator {
        font-size: 1.1rem;
    }

    .calculator-grid>input {
        grid-column: span 5;
        height: 55px;
        font-size: 1.6rem;
        padding: 10px 14px;
        margin-bottom: 8px;
    }

    .calculator-grid>.history-box {
        grid-column: span 4;
        height: 44px;
        font-size: 0.75rem;
        padding: 8px 10px;
    }

    .angle-mode {
        grid-column: span 2;
        gap: 4px;
    }

    .angle-mode>span {
        padding: 5px 8px;
        font-size: 0.65rem;
    }

    .angle-mode>select {
        height: 28px;
        font-size: 0.7rem;
        padding: 3px 6px;
    }

    .calculator-grid>#clear-history {
        grid-column: span 1;
        height: 44px;
        font-size: 0.65rem;
        min-height: 44px;
    }
}

/* Large phones - MOBILE BASIC CALCULATOR */
@media only screen and (max-width: 600px) {
    /* ========================================
       MOBILE CALCULATOR - COMPLETE REDESIGN
       Layout: 4 columns, basic operations only
       Row 1: Display (span 4)
       Row 2: AC  (   )   ÷
       Row 3: 7   8   9   ×
       Row 4: 4   5   6   −
       Row 5: 1   2   3   +
       Row 6: 0 (span 2)  .   =
       ======================================== */

    .calculator-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 320px;
        width: 100%;
        padding: 15px;
        grid-gap: 8px;
        border-radius: 16px;
        margin: 0 auto;
        box-sizing: border-box;
    }

    .calculator-grid::before {
        display: none;
    }

    /* Hide ALL buttons by default */
    .calculator-grid > button,
    .calculator-grid > .angle-mode,
    .calculator-grid > .history-box,
    .calculator-grid > textarea {
        display: none !important;
    }

    /* Display - Row 1 */
    .calculator-grid > input#display {
        display: block !important;
        grid-column: span 4;
        order: 1;
        height: 60px;
        font-size: 1.8rem;
        padding: 10px 15px;
        margin-bottom: 10px;
        border-radius: 10px;
    }

    /* === ROW 2: AC ( ) ÷ === */
    #clear {
        display: flex !important;
        order: 2;
        font-size: 1rem;
    }
    #openParentheses {
        display: flex !important;
        order: 3;
        font-size: 1.2rem;
    }
    #closeParentheses {
        display: flex !important;
        order: 4;
        font-size: 1.2rem;
    }
    #divide {
        display: flex !important;
        order: 5;
        font-size: 1.3rem;
    }

    /* === ROW 3: 7 8 9 × === */
    #seven {
        display: flex !important;
        order: 6;
    }
    #eight {
        display: flex !important;
        order: 7;
    }
    #nine {
        display: flex !important;
        order: 8;
    }
    #multiply {
        display: flex !important;
        order: 9;
        font-size: 1.3rem;
    }

    /* === ROW 4: 4 5 6 − === */
    #four {
        display: flex !important;
        order: 10;
    }
    #five {
        display: flex !important;
        order: 11;
    }
    #six {
        display: flex !important;
        order: 12;
    }
    #subtract {
        display: flex !important;
        order: 13;
        font-size: 1.3rem;
    }

    /* === ROW 5: 1 2 3 + === */
    #one {
        display: flex !important;
        order: 14;
    }
    #two {
        display: flex !important;
        order: 15;
    }
    #three {
        display: flex !important;
        order: 16;
    }
    #add {
        display: flex !important;
        order: 17;
        font-size: 1.3rem;
    }

    /* === ROW 6: 0 (wide) . = === */
    #zero {
        display: flex !important;
        order: 18;
        grid-column: span 2;
    }
    #decimal {
        display: flex !important;
        order: 19;
    }
    #equals {
        display: flex !important;
        order: 20;
        font-size: 1.4rem;
    }

    /* Also show DEL button for convenience */
    #delete {
        display: none !important; /* Hidden for cleaner look - use AC instead */
    }

    /* Button styling for mobile */
    .calculator-grid > button {
        min-height: 55px;
        border-radius: 10px;
        font-weight: 600;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        align-items: center;
        justify-content: center;
    }

    /* Number buttons - larger text */
    #seven, #eight, #nine, #four, #five, #six,
    #one, #two, #three, #zero, #decimal {
        font-size: 1.4rem !important;
        font-weight: 700 !important;
    }

    /* Hide tooltips on touch devices */
    .calculator-grid > button[title]::after,
    .calculator-grid > button[title]::before {
        display: none;
    }
}

/* Small phones - adjust sizes */
@media only screen and (max-width: 480px) {
    .calculator-grid {
        max-width: 290px;
        padding: 12px;
        grid-gap: 6px;
    }

    .calculator-grid > button {
        min-height: 50px;
    }

    .calculator-grid > input#display {
        height: 55px;
        font-size: 1.6rem;
    }

    #seven, #eight, #nine, #four, #five, #six,
    #one, #two, #three, #zero, #decimal {
        font-size: 1.3rem !important;
    }
}

/* Very small phones (iPhone SE, etc.) */
@media only screen and (max-width: 375px) {
    .calculator-grid {
        max-width: 260px;
        padding: 10px;
        grid-gap: 5px;
    }

    .calculator-grid > button {
        min-height: 46px;
    }

    .calculator-grid > input#display {
        height: 50px;
        font-size: 1.4rem;
    }

    #seven, #eight, #nine, #four, #five, #six,
    #one, #two, #three, #zero, #decimal {
        font-size: 1.2rem !important;
    }

    #divide, #multiply, #subtract, #add, #equals {
        font-size: 1.1rem !important;
    }
}

/* Extra small phones */
@media only screen and (max-width: 320px) {
    .calculator-grid {
        max-width: 240px;
        padding: 8px;
        grid-gap: 4px;
    }

    .calculator-grid > button {
        min-height: 42px;
    }

    .calculator-grid > input#display {
        height: 45px;
        font-size: 1.2rem;
    }

    #seven, #eight, #nine, #four, #five, #six,
    #one, #two, #three, #zero, #decimal {
        font-size: 1.1rem !important;
    }
}

/* Landscape mode on phones - use compact 4-column layout */
@media only screen and (max-height: 500px) and (orientation: landscape) {
    .calculator-grid {
        max-width: 400px;
        grid-template-columns: repeat(4, 1fr);
        padding: 8px;
        grid-gap: 4px;
    }

    .calculator-grid>button {
        min-height: 32px;
        font-size: 0.8rem;
    }

    .calculator-grid>input {
        grid-column: span 4;
        height: 36px;
        font-size: 1.1rem;
    }
}

/* Category Tabs Styles - Override subpages.css */
.container .category-tabs-section {
    grid-area: categories !important;
    padding: 25px;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: block !important;
    border: 2px solid #e8e8e8 !important;
    height: auto !important;
    margin-top: 0 !important;
    overflow: visible !important;
}

    .category-tabs-section h2 {
        text-align: center;
        color: #053b7d;
        font-size: 28px;
        margin-bottom: 30px;
        font-weight: bold;
    }

    .tabs-container {
        background: #fff;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 20px rgba(0,0,0,0.12);
        border: 1px solid #d1d5db;
    }

    .tab-buttons {
        display: flex;
        background: linear-gradient(135deg, #f1f3f4 0%, #f8f9fa 100%);
        border-bottom: 2px solid #d1d5db;
    }

    .tab-button {
        flex: 1;
        padding: 16px 20px;
        background: none;
        border: none;
        cursor: pointer;
        font-size: 16px;
        font-weight: 600;
        color: #4a5568;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        position: relative;
        border-right: 1px solid #e2e8f0;
    }

    .tab-button:hover {
        background: rgba(5, 59, 125, 0.08);
        color: #053b7d;
    }

    .tab-button.active {
        background: linear-gradient(135deg, #053b7d 0%, #0f4c75 100%);
        color: white;
        box-shadow: 0 2px 8px rgba(5, 59, 125, 0.4);
        font-weight: 700;
    }

    .tab-button.active::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        right: 0;
        height: 2px;
        background: #053b7d;
    }

    .tab-button img {
        border-radius: 4px;
        transition: transform 0.2s ease;
    }

    .tab-button:hover img {
        transform: scale(1.1);
    }

    .tab-content {
        padding: 30px;
        min-height: 400px;
    }

    .tab-pane {
        display: none;
    }

    .tab-pane.active {
        display: block;
        animation: fadeIn 0.3s ease;
    }

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

    .calculator-grid-tab {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 12px;
        margin-top: 20px;
    }

    .calculator-item {
        display: flex;
        align-items: center;
        padding: 12px 16px;
        background: #ffffff;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        color: #495057;
        text-decoration: none;
        font-size: 14px;
        font-weight: 500;
        transition: all 0.2s ease;
        text-align: left;
        position: relative;
        overflow: hidden;
    }

    .calculator-item::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: linear-gradient(135deg, #053b7d, #298bac);
        transition: all 0.2s ease;
    }

    .calculator-item .calculator-icon {
        margin-right: 12px;
        font-size: 18px;
        color: #053b7d;
        min-width: 20px;
        text-align: center;
    }

    .calculator-item:hover {
        background: #f8f9fa;
        color: #053b7d;
        border-color: #053b7d;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 59, 125, 0.15);
    }

    .calculator-item:hover::before {
        width: 6px;
        background: linear-gradient(135deg, #053b7d, #298bac);
    }

    .calculator-item:hover .calculator-icon {
        color: #053b7d;
        transform: scale(1.1);
    }

    .calculator-item.view-all {
        background: linear-gradient(135deg, #053b7d, #298bac);
        color: white;
        border-color: #053b7d;
        font-weight: 600;
        grid-column: 1 / -1;
        margin-top: 10px;
    }

    .calculator-item.view-all:hover {
        background: linear-gradient(135deg, #042a5e, #1f6b8a);
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(5, 59, 125, 0.3);
    }
    


    /* Responsive Design */
    @media (max-width: 768px) {
        .category-cards-grid {
            grid-template-columns: 1fr;
            gap: 20px;
        }
        
        .category-card {
            padding: 20px;
        }
        
        .category-cards-section h2 {
            font-size: 24px;
        }
    }

    @media (max-width: 480px) {
        .category-card {
            padding: 15px;
        }
        
        .category-preview {
            gap: 6px;
        }
        
        .preview-item {
            font-size: 12px;
            padding: 4px 10px;
        }
    }
    
    /* New Logo Styling */
    .logo-container {
        display: flex;
        align-items: center;
        gap: 12px;
        text-decoration: none;
        transition: transform 0.2s ease;
        height: 60px; /* Match header height */
        padding: 10px 0; /* Add padding to center vertically */
    }


    /* Calculator Icon */
    .calculator-icon {
        width: 32px;
        height: 40px;
        background: white;
        border-radius: 4px;
        padding: 3px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        position: relative;
    }

    .calc-screen {
        background: #1a1a1a;
        color: #00ff00;
        font-family: 'Courier New', monospace;
        font-size: 8px;
        font-weight: bold;
        text-align: right;
        padding: 2px 4px;
        border-radius: 2px;
        margin-bottom: 2px;
        height: 10px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    .calc-buttons {
        display: flex;
        flex-direction: column;
        gap: 1px;
    }

    .calc-row {
        display: flex;
        gap: 1px;
    }

    .calc-btn {
        width: 5px;
        height: 5px;
        background: #f0f0f0;
        border-radius: 1px;
        border: 0.5px solid #ddd;
    }

    .calc-btn:nth-child(1) { background: #ff6b6b; }
    .calc-btn:nth-child(2) { background: #4ecdc4; }
    .calc-btn:nth-child(3) { background: #45b7d1; }
    .calc-btn:nth-child(4) { background: #96ceb4; }

    /* Logo Text */
    .logo-text {
        color: white;
        font-size: 26px;
        font-weight: 900;
        font-family: 'Orbitron', monospace;
        letter-spacing: 1px;
        text-shadow: 0 0 10px rgba(0, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.5);
        line-height: 1; /* Prevent text from affecting height */
    }
    
    /* Fix header content alignment */
    .header-content {
        height: 60px;
        align-items: center;
    }
    
    /* Ensure nav elements stay properly positioned */
    .search-bar-wrapper {
        height: 60px;
        display: flex;
        align-items: center;
    }
    
    /* Desktop nav menu styling - only apply on larger screens */
    @media (min-width: 801px) {
        #nav-menu {
            height: 60px;
            display: flex;
            align-items: center;
        }

        /* Hide hamburger menu on desktop */
        .nav-toggle {
            display: none;
        }
    }
    
