/* ===== App Shell Layout ===== */
.fm-app {
    display: flex;
    min-height: 100vh;
}

.fm-main {
    flex: 1;
    margin-left: var(--fm-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.fm-content {
    flex: 1;
    padding: 1.5rem;
    background-color: var(--fm-body-bg);
}

/* ===== Sidebar ===== */
.fm-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--fm-sidebar-width);
    background-color: var(--fm-sidebar-bg);
    color: var(--fm-sidebar-text);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1030;
    transition: width 0.2s ease;
}

.fm-sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

.fm-sidebar-header {
    height: var(--fm-topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.fm-sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.fm-sidebar-nav {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.fm-sidebar-logo {
    flex-shrink: 0;
    height: 80px;
    padding: 0.5rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.fm-sidebar-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.fm-nav-item {
    list-style: none;
}

.fm-nav-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    color: var(--fm-sidebar-text);
    text-decoration: none;
    transition: background-color 0.15s;
    gap: 0.75rem;
}

.fm-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.fm-nav-link.active {
    background-color: var(--fm-sidebar-active);
    color: #fff;
    font-weight: 500;
}

.fm-nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.625rem 1rem;
    background: none;
    border: none;
    color: var(--fm-sidebar-text);
    cursor: pointer;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fm-nav-group-toggle:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.fm-nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fm-nav-submenu .fm-nav-link {
    padding-left: 2.5rem;
    font-size: 0.9rem;
}

/* ===== Top Bar ===== */
.fm-topbar {
    height: var(--fm-topbar-height);
    background-color: var(--fm-topbar-bg);
    color: var(--fm-topbar-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.fm-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.fm-topbar-right {
    display: flex;
    align-items: center;
}

.fm-portal-name {
    font-weight: 600;
    font-size: 1rem;
}

.fm-user-name {
    font-size: 0.9rem;
}

.fm-sidebar-toggle {
    color: var(--fm-topbar-text);
    font-size: 1.25rem;
    padding: 0;
}

/* ===== Login Layout ===== */
.fm-login-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--fm-login-bg, #ffffff);
}

.fm-login-split {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 960px;
    min-height: 520px;
    padding: 2rem;
}

.fm-login-brand {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.fm-login-logo {
    max-width: 280px;
    max-height: 160px;
    object-fit: contain;
}

.fm-login-divider {
    width: 1px;
    align-self: stretch;
    background-color: rgba(0, 0, 0, 0.15);
    margin: 0 2rem;
}

.fm-login-form-panel {
    flex: 1;
    max-width: 380px;
    padding: 1rem 0;
}

.fm-login-welcome {
    font-size: 2rem;
    font-weight: 300;
    color: #333;
    margin-bottom: 0.25rem;
    font-style: italic;
}

.fm-login-subtitle {
    color: #777;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.fm-login-input {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.fm-login-input:focus {
    border-color: var(--fm-login-accent, #9B2D5F);
    box-shadow: 0 0 0 0.2rem rgba(155, 45, 95, 0.15);
}

.fm-login-input::placeholder {
    color: #999;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}

.fm-login-btn {
    background-color: var(--fm-login-accent, #9B2D5F);
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.75rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    transition: background-color 0.15s;
}

.fm-login-btn:hover,
.fm-login-btn:focus {
    background-color: var(--fm-login-accent-dark, #7c2450);
    color: #fff;
}

.fm-login-btn:disabled {
    background-color: var(--fm-login-accent, #9B2D5F);
    color: #fff;
    opacity: 0.8;
    cursor: wait;
}

.fm-login-forgot {
    text-align: center;
    margin-top: 1.25rem;
}

.fm-login-forgot a {
    color: #777;
    text-decoration: none;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.fm-login-forgot a:hover {
    color: var(--fm-login-accent, #9B2D5F);
}

@media (max-width: 767.98px) {
    .fm-login-split {
        flex-direction: column;
        padding: 1rem;
    }

    .fm-login-brand {
        padding: 1rem;
    }

    .fm-login-logo {
        max-width: 180px;
    }

    .fm-login-divider {
        width: 60%;
        height: 1px;
        margin: 1rem auto;
    }

    .fm-login-form-panel {
        width: 100%;
        max-width: 100%;
    }
}

/* ===== Stat Card ===== */
.fm-stat-card {
    border: none;
    box-shadow: var(--fm-card-shadow);
    border-radius: 0.5rem;
}

.fm-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    background-color: rgba(13, 110, 253, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--fm-primary);
}

/* ===== Data Grid ===== */
.cursor-pointer {
    cursor: pointer;
}

/* ===== Loading Overlay ===== */
.fm-loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

/* ===== Responsive ===== */
@media (max-width: 767.98px) {
    .fm-sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .fm-sidebar:not(.collapsed) {
        transform: translateX(0);
    }

    .fm-main {
        margin-left: 0;
    }
}
