/*
 * ============================================================================
 * Kasi Mattress Admin
 * ----------------------------------------------------------------------------
 * File: assets/css/topbar.css
 * Module: Admin Topbar
 * Version: 1.0.0
 * ============================================================================
 *
 * PURPOSE
 *
 * Styles the administrator topbar only.
 *
 * RESPONSIBILITIES
 *
 *     - Topbar container
 *     - Brand
 *     - Mobile menu button
 *     - Portal status
 *     - Logged-in administrator
 *     - Logout button
 *
 * DOES NOT STYLE
 *
 *     - Sidebar
 *     - Main content
 *     - Dashboard cards
 *     - Tables
 *     - Forms
 *     - Module pages
 *
 * Global variables and reset rules belong to:
 *
 *     assets/css/admin.css
 *
 * ============================================================================
 */


/* ==========================================================================
   TOPBAR
   ========================================================================== */

.km-admin-topbar {

    position: sticky;
    top: 0;

    z-index: 100;

    width: 100%;
    height: var(--km-topbar-height, 72px);

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 24px;

    padding: 0 28px;

    border-bottom: 1px solid var(--km-border, #E4E9EE);

    background: var(--km-white, #FFFFFF);
}


/* ==========================================================================
   TOPBAR LEFT
   ========================================================================== */

.km-topbar-left {

    min-width: 0;

    display: flex;

    align-items: center;

    gap: 16px;
}


/* ==========================================================================
   MOBILE MENU BUTTON
   ========================================================================== */

.km-mobile-menu-button {

    width: 38px;
    height: 38px;

    display: none;

    align-items: center;
    justify-content: center;

    flex-direction: column;

    gap: 4px;

    flex: 0 0 38px;

    padding: 0;

    border: 1px solid var(--km-border, #E4E9EE);
    border-radius: 8px;

    background: var(--km-white, #FFFFFF);

    color: var(--km-navy, #0F4C81);

    cursor: pointer;

    transition:
        background-color 150ms ease,
        border-color 150ms ease;
}


.km-mobile-menu-button:hover {

    background: #F5F8FA;

    border-color: #CBD7E0;
}


.km-mobile-menu-button:focus-visible {

    outline: 3px solid rgba(15, 76, 129, 0.14);

    outline-offset: 2px;
}


.km-mobile-menu-button span {

    width: 16px;
    height: 2px;

    display: block;

    flex: 0 0 2px;

    border-radius: 2px;

    background: currentColor;
}


/* ==========================================================================
   BRAND
   ========================================================================== */

.km-admin-brand {

    min-width: 0;

    display: flex;

    align-items: center;

    gap: 11px;
}


/* Brand mark */

.km-admin-brand-mark {

    width: 38px;
    height: 38px;

    display: grid;

    place-items: center;

    flex: 0 0 38px;

    border-radius: 9px;

    background: var(--km-navy, #0F4C81);

    color: var(--km-white, #FFFFFF);

    font-family: "Poppins", sans-serif;

    font-size: 12px;
    font-weight: 700;

    line-height: 1;

    user-select: none;
}


/* Brand text */

.km-admin-brand-text {

    min-width: 0;
}


.km-admin-brand-name {

    display: block;

    overflow: hidden;

    color: var(--km-navy, #0F4C81);

    font-family: "Poppins", sans-serif;

    font-size: 15px;
    font-weight: 700;

    line-height: 1.2;

    white-space: nowrap;

    text-overflow: ellipsis;
}


.km-admin-brand-label {

    display: block;

    margin-top: 2px;

    overflow: hidden;

    color: var(--km-muted, #6B7280);

    font-size: 10px;
    font-weight: 500;

    line-height: 1.3;

    white-space: nowrap;

    text-overflow: ellipsis;
}


/* ==========================================================================
   TOPBAR RIGHT
   ========================================================================== */

.km-topbar-right {

    min-width: 0;

    display: flex;

    align-items: center;

    justify-content: flex-end;

    gap: 24px;
}


/* ==========================================================================
   PORTAL STATUS
   ========================================================================== */

.km-topbar-status {

    display: flex;

    align-items: center;

    gap: 7px;

    color: var(--km-muted, #6B7280);

    font-size: 11px;
    font-weight: 500;

    white-space: nowrap;
}


.km-status-dot {

    width: 7px;
    height: 7px;

    display: block;

    flex: 0 0 7px;

    border-radius: 50%;

    background: #31A46C;

    box-shadow:
        0 0 0 3px rgba(49, 164, 108, 0.10);
}


/* ==========================================================================
   LOGGED-IN USER
   ========================================================================== */

.km-topbar-user {

    min-width: 0;

    display: flex;

    align-items: center;

    gap: 10px;
}


/* User avatar */

.km-user-avatar {

    width: 36px;
    height: 36px;

    display: grid;

    place-items: center;

    flex: 0 0 36px;

    border-radius: 50%;

    background: #EAF1F7;

    color: var(--km-navy, #0F4C81);

    font-size: 12px;
    font-weight: 700;

    line-height: 1;

    user-select: none;
}


/* User information */

.km-user-details {

    min-width: 0;

    max-width: 180px;
}


.km-user-details strong,
.km-user-details span {

    display: block;

    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;
}


.km-user-details strong {

    color: var(--km-heading, #172231);

    font-size: 12px;
    font-weight: 600;

    line-height: 1.3;
}


.km-user-details span {

    margin-top: 2px;

    color: var(--km-muted, #6B7280);

    font-size: 10px;
    font-weight: 400;

    line-height: 1.3;
}


/* ==========================================================================
   LOGOUT
   ========================================================================== */

.km-topbar-logout {

    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 34px;

    padding: 7px 0;

    border: 0;

    background: transparent;

    color: var(--km-navy, #0F4C81);

    font: inherit;

    font-size: 12px;
    font-weight: 600;

    line-height: 1.3;

    text-decoration: none;

    white-space: nowrap;

    cursor: pointer;

    transition:
        color 150ms ease;
}


.km-topbar-logout:hover {

    color: var(--km-navy-dark, #0A365B);

    text-decoration: none;
}


.km-topbar-logout:focus-visible {

    outline: 3px solid rgba(15, 76, 129, 0.14);

    outline-offset: 4px;

    border-radius: 4px;
}


/* ==========================================================================
   TOPBAR LINKS
   ========================================================================== */

.km-admin-topbar a {

    color: inherit;

    text-decoration: none;
}


.km-admin-topbar a:hover,
.km-admin-topbar a:focus,
.km-admin-topbar a:active {

    text-decoration: none;
}


/* ==========================================================================
   TABLET
   ========================================================================== */

@media (max-width: 1000px) {

    .km-admin-topbar {

        padding-left: 22px;
        padding-right: 22px;
    }


    .km-topbar-right {

        gap: 18px;
    }


    .km-user-details {

        max-width: 145px;
    }

}


/* ==========================================================================
   MOBILE
   ========================================================================== */

@media (max-width: 800px) {

    .km-admin-topbar {

        height: var(--km-topbar-height, 64px);

        padding-left: 18px;
        padding-right: 18px;

        gap: 14px;
    }


    .km-mobile-menu-button {

        display: flex;
    }


    .km-topbar-status {

        display: none;
    }


    .km-user-details {

        display: none;
    }


    .km-topbar-right {

        gap: 14px;
    }


    .km-topbar-logout {

        display: none;
    }

}


/* ==========================================================================
   SMALL MOBILE
   ========================================================================== */

@media (max-width: 520px) {

    .km-admin-topbar {

        padding-left: 14px;
        padding-right: 14px;
    }


    .km-topbar-left {

        gap: 10px;
    }


    .km-admin-brand {

        gap: 9px;
    }


    .km-admin-brand-mark {

        width: 34px;
        height: 34px;

        flex-basis: 34px;

        border-radius: 8px;

        font-size: 11px;
    }


    .km-admin-brand-name {

        font-size: 14px;
    }


    .km-admin-brand-label {

        display: none;
    }


    .km-topbar-right {

        gap: 8px;
    }


    .km-user-avatar {

        width: 34px;
        height: 34px;

        flex-basis: 34px;
    }

}


/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    .km-mobile-menu-button,
    .km-topbar-logout {

        transition: none;
    }

}