#appHeader3 {
    background: linear-gradient(135deg, #373f6e, #3b447d);
    border-radius: 0px 0px 12px 12px;
    box-shadow: 0px 5px 30px 6px rgba(0, 0, 0, 0.6);
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1030;
}

.fs-8 { font-size: 1.2rem; }
.fs-9 { font-size: 0.7rem; }

#navContent3 { position: relative; }

/* ================= HEADER TYPOGRAPHY FIX ================= */

/* Main title */
.header-title {
    font-family: "Kaisei Tokumin", serif;
    font-size: clamp(1.6rem, 2.4vw, 2.4rem);
    line-height: 1.05;
    white-space: nowrap;
}

/* Subtitle */
.header-subtitle {
    font-family: "Raleway", sans-serif;
    font-size: clamp(0.8rem, 1.1vw, 1.05rem);
    line-height: 1.8;
    letter-spacing: 0.30em;
}

.clock-btn {
    font-family: 'Calibri';
    font-size: 15px;
    cursor: pointer;
    border-radius: 8px;
    background-color: #3551DE;
    border: 1px solid white;
    color: white;
    padding: 0.2rem 0.5rem;
}

.card-calendar {
    display: none;
    z-index: 1050;
    width: 240px;
}

.social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(32px, 3.5vw, 40px);
    height: clamp(32px, 3.5vw, 40px);
    margin-left: clamp(5px, 1vw, 10px);
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: clamp(0.9rem, 1.2vw, 1.2rem);
}

.social-icons a:hover {
    background-color: white;
    color: #3551DE;
    transform: scale(1.1);
}

#roleSwitch button {
    border-radius: 8px;
    transition: all 0.3s ease;
    height: clamp(36px, 4vw, 42px);
    font-size: clamp(0.8rem, 1.2vw, 1rem);
}

#userLoginBtn {
    background: linear-gradient(135deg, #373f6e, #3b447d);
    background-size: 200% 200%;
    background-position: left center;
    color: white;
    transition: all 0.3s ease;
}

#userLoginBtn:hover {
    background-color: white;
    color: #ffffff;
    transform: scale(1.05);
}

#roleSwitch .role-icon {
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
}

#goBackBtn {
    border-radius: 8px;
    transition: all 0.3s ease;
    height: clamp(36px, 4vw, 42px);
    width: clamp(140px, 15vw, 200px);
}
#goBackBtn a {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
}

#goBackBtn:hover {
    background-color: white;
    color: #f02951;
    transform: scale(1.05);
}

/* Existing mobile adjustments */
@media (max-width: 576px) {
    .social-icons a { width: 32px; height: 32px; margin-left: 5px; }
    #roleSwitch button { height: 36px; font-size: 0.85rem; }
    #roleSwitch span { display: none; }
    #roleSwitch .role-icon { font-size: 1.1rem; }
    #goBackBtn { width: 150px; }
}

/* Existing tablet adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .social-icons a { width: 34px; height: 34px; font-size: 1rem; }
}

/* Desktop centering utilizing Flexbox for smooth resizing */
@media (min-width: 992px) {
    #appHeader3 .nav-title {
        position: static;
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        transform: none;
        text-align: center;
        margin: 0 1rem;
    }
}

/* ====================================================================== */
/* NEW: Exact breakpoint fixes you requested – ONLY these devices      */
/* ====================================================================== */

/* Galaxy Z Flip (folded) – 344×882 */
@media only screen and (max-width: 360px) and (max-height: 882px) {
    .nav-title .fs-8 { font-size: 1rem !important; }
    .nav-title .fs-9 { font-size: 0.65rem !important; }
    #roleSwitch button { height: 34px; font-size: 0.8rem; }
    #roleSwitch .role-icon { font-size: 1rem; }
    .social-icons a { width: 30px; height: 30px; margin-left: 4px; }
    #goBackBtn { width: 130px; height: 36px; }
    #goBackBtn .fs-6 { font-size: 0.8rem !important; }
    .navbar-brand {width: 9rem;}
}

/* Galaxy S8+ – 360×740 */
@media only screen and (width: 360px) and (height: 740px) {
    .d-flex.d-md-none .fs-8 { font-size: 1.05rem !important; }
    .d-flex.d-md-none .fs-9 { font-size: 0.68rem !important; }
    #roleSwitch button { height: 36px; }
    .social-icons a { width: 32px; height: 32px; }
    #goBackBtn { width: 140px; }
}

/* Google Nest Hub – 1024×600 (landscape) */
@media only screen and (width: 1024px) and (height: 600px) {
    #appHeader3 .nav-title {
        top: 50%;
        transform: translate(-50%, -50%);
    }
    .nav-title .fs-1 { font-size: 2.2rem !important; }
    .nav-title .fs-6 { font-size: 0.9rem !important; }
    #roleSwitch button { height: 48px; font-size: 1rem; }
    .social-icons a { width: 45px; height: 45px; }
    #title {margin-right: 12rem;}
    #subtitle {margin-right: 12rem;}
    #roleSwitch {width: 14rem; height: 1rem;}
    .roleBtn {font-size: 0.7rem;}
}

@media (max-height: 640px) {
    .header-subtitle {
        display: none;
    }

    .header-title {
        font-size: clamp(1.5rem, 2.2vw, 2rem);
    }
}

.letter-spacing-2 {
    letter-spacing: 2px;
}
