/* ─── Freesoon Backend — custom styles ─────────────────────────────────────── */

:root {
    --fs-navbar-height: 56px;
    --fs-sidebar-width: 256px;
    --fs-navbar-bg:     #1a1a2e;
    --fs-sidebar-bg:    #ffffff;
    --fs-content-bg:    #f0f2f5;
    --fs-accent:        #0d6efd;
    --fs-sidebar-link:  #495057;
    --fs-sidebar-hover-bg: #f1f3f5;
    --fs-sidebar-active-bg: rgba(13, 110, 253, 0.08);
}

/* ── Body ───────────────────────────────────────────────────────────────────── */
body.fs-backend {
    background: var(--fs-content-bg);
    font-size: .9rem;
}

/* ── Navbar ─────────────────────────────────────────────────────────────────── */
.fs-navbar {
    background: var(--fs-navbar-bg) !important;
    height: var(--fs-navbar-height);
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    z-index: 1040;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.fs-sidebar {
    position: fixed;
    top: var(--fs-navbar-height);
    left: 0;
    width: var(--fs-sidebar-width);
    height: calc(100vh - var(--fs-navbar-height));
    background: var(--fs-sidebar-bg);
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1030;
    transition: transform .25s ease;
}

/* Sidebar scrollbar */
.fs-sidebar::-webkit-scrollbar { width: 4px; }
.fs-sidebar::-webkit-scrollbar-track { background: transparent; }
.fs-sidebar::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 2px; }

.fs-sidebar-nav {
    list-style: none;
    padding: .5rem 0;
    margin: 0;
}

.fs-sidebar-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem 1.25rem;
    color: var(--fs-sidebar-link);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
    white-space: nowrap;
    overflow: hidden;
    font-size: .875rem;
}

.fs-sidebar-link i {
    font-size: 1rem;
    flex-shrink: 0;
    width: 1.1rem;
    text-align: center;
}

.fs-sidebar-link:hover {
    background: var(--fs-sidebar-hover-bg);
    color: var(--fs-accent);
}

.fs-sidebar-link.active {
    background: var(--fs-sidebar-active-bg);
    color: var(--fs-accent);
    border-left-color: var(--fs-accent);
    font-weight: 500;
}

/* Sidebar group */
.fs-sidebar-group {
    margin-top: .5rem;
}

.fs-sidebar-group-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .6rem 1.25rem .4rem;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #adb5bd;
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    text-align: left;
    transition: color .15s;
    user-select: none;
}

.fs-sidebar-group-label:hover {
    color: #6c757d;
}

.fs-sidebar-group-label i {
    font-size: .8rem;
}

.fs-sidebar-group-chevron {
    margin-left: auto;
    transition: transform .2s ease;
}

.fs-sidebar-group.open .fs-sidebar-group-chevron {
    transform: rotate(180deg);
}

/* Accordion collapse via CSS grid (no JS height calculation needed) */
.fs-sidebar-subnav-wrap {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .2s ease;
}

.fs-sidebar-group.open .fs-sidebar-subnav-wrap {
    grid-template-rows: 1fr;
}

.fs-sidebar-subnav {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

/* Sidebar divider */
.fs-sidebar-divider {
    height: 1px;
    background: #e9ecef;
    margin: .5rem 1rem;
}

/* ── Main content ───────────────────────────────────────────────────────────── */
.fs-main {
    margin-left: var(--fs-sidebar-width);
    margin-top: var(--fs-navbar-height);
    min-height: calc(100vh - var(--fs-navbar-height));
    padding: 1.75rem;
}

/* ── Page header ────────────────────────────────────────────────────────────── */
.fs-page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.fs-page-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
}

/* ── DataGrid ───────────────────────────────────────────────────────────────── */
.fs-datagrid table th,
.fs-datagrid table td {
    padding-left:  calc(.25rem + 4px);
    padding-right: calc(.25rem + 4px);
}

.fs-datagrid table th + th,
.fs-datagrid table td + td {
    border-left: 1px solid var(--bs-border-color-translucent);
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.fs-stat-card {
    border: none;
    border-radius: .5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ── Login page ─────────────────────────────────────────────────────────────── */
body.fs-login {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

/* Card: side-by-side on desktop */
.fs-login-card {
    width: 100%;
    max-width: 860px;
    border: none;
    border-radius: .75rem;
    box-shadow: 0 12px 40px rgba(0,0,0,.45);
    overflow: hidden;
    display: flex;
    flex-direction: row;
}

/* Left panel — 40% — image/cover */
.fs-login-cover {
    flex: 0 0 40%;
    background-image: var(--fs-cover-img);
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
    min-height: 420px;
}

/* Subtle dark gradient at bottom for visual grounding */
.fs-login-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 55%,
        rgba(0,0,0,.35) 100%
    );
    pointer-events: none;
}

/* Right panel — 60% — form */
.fs-login-form-panel {
    flex: 1;
    background: #fff;
    padding: 3rem 2.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ── Login — mobile (<= 767px): stack vertically ───────────────────────────── */
@media (max-width: 767.98px) {
    body.fs-login {
        padding: 1rem;
        align-items: flex-start; /* allow scrolling if needed */
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    .fs-login-card {
        flex-direction: column;
        max-width: 480px;
        margin: 0 auto;
    }

    /* Cover becomes a compact banner at the top */
    .fs-login-cover {
        flex: 0 0 auto;
        height: 140px;
        min-height: 0;
        background-image: var(--fs-cover-img-mobile);
        background-position: center 40%;
    }

    .fs-login-form-panel {
        padding: 2rem 1.75rem;
    }
}

/* ── Responsive — mobile sidebar ───────────────────────────────────────────── */
@media (max-width: 1199.98px) {
    .fs-sidebar {
        transform: translateX(-100%);
    }

    .fs-sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 16px rgba(0,0,0,.15);
    }

    .fs-main {
        margin-left: 0;
    }

    .fs-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1025;
    }

    .fs-sidebar-backdrop.show {
        display: block;
    }
}
