/* IMSP admin panel — Persian RTL, Bootstrap 5 based. */

/*
 * Vazirmatn is bundled locally (wwwroot/fonts) rather than loaded from a CDN so the panel
 * works on an air-gapped network. Only the four weights the UI uses are shipped.
 */
@font-face {
    font-family: "Vazirmatn";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
}

@font-face {
    font-family: "Vazirmatn";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/Vazirmatn-Medium.woff2") format("woff2");
}

@font-face {
    font-family: "Vazirmatn";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/Vazirmatn-SemiBold.woff2") format("woff2");
}

@font-face {
    font-family: "Vazirmatn";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
}

:root {
    --imsp-sidebar-width: 260px;
    --imsp-sidebar-bg: #12263f;
    --imsp-sidebar-fg: #c9d6e5;
    --imsp-sidebar-active: #1c3a5e;
    --imsp-topbar-height: 56px;
    --imsp-radius: 10px;
}

[data-bs-theme="dark"] {
    --imsp-sidebar-bg: #0d1720;
    --imsp-sidebar-fg: #9fb0c2;
    --imsp-sidebar-active: #1a2b3d;
}

body {
    font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
    background: var(--bs-body-bg);
    margin: 0;
}

.imsp-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.imsp-sidebar {
    width: var(--imsp-sidebar-width);
    background: var(--imsp-sidebar-bg);
    color: var(--imsp-sidebar-fg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform .2s ease;
}

.imsp-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1rem 1.1rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    font-size: .95rem;
}

.imsp-nav {
    display: flex;
    flex-direction: column;
    padding: .6rem 0;
    overflow-y: auto;
}

.imsp-nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .62rem 1.1rem;
    color: var(--imsp-sidebar-fg);
    text-decoration: none;
    font-size: .9rem;
    border-inline-start: 3px solid transparent;
    transition: background .15s ease, color .15s ease;
}

.imsp-nav-link:hover,
.imsp-nav-link:focus {
    background: var(--imsp-sidebar-active);
    color: #fff;
}

.imsp-nav-link.active {
    background: var(--imsp-sidebar-active);
    color: #fff;
    border-inline-start-color: var(--imsp-primary);
    font-weight: 600;
}

.imsp-nav-icon {
    width: 1.1rem;
    text-align: center;
    opacity: .85;
}

/* Main area */
.imsp-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.imsp-topbar {
    height: var(--imsp-topbar-height);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    position: sticky;
    top: 0;
    z-index: 20;
}

.imsp-breadcrumb {
    flex: 1;
    font-size: .85rem;
    color: var(--bs-secondary-color);
}

.imsp-topbar-actions {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.imsp-user {
    font-size: .85rem;
    color: var(--bs-secondary-color);
}

.imsp-content {
    padding: 1.5rem;
    flex: 1;
}

/* Cards and stats */
.imsp-page-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.imsp-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.imsp-stat {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--imsp-radius);
    padding: 1rem 1.1rem;
}

.imsp-stat-label {
    font-size: .8rem;
    color: var(--bs-secondary-color);
    margin-bottom: .35rem;
}

.imsp-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
}

.imsp-stat-hint {
    font-size: .75rem;
    color: var(--bs-secondary-color);
    margin-top: .3rem;
}

.imsp-card {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--imsp-radius);
    margin-bottom: 1.25rem;
}

.imsp-card-header {
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--bs-border-color);
    font-weight: 600;
    font-size: .92rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.imsp-card-body {
    padding: 1.1rem;
}

/* Map viewer: give the map as much room as possible */
.imsp-map-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--imsp-topbar-height) - 3rem);
}

.imsp-map-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: .75rem;
}

.imsp-map-canvas {
    flex: 1;
    border-radius: var(--imsp-radius);
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    min-height: 320px;
}

/* Tables */
.imsp-table {
    font-size: .86rem;
}

.imsp-table th {
    font-weight: 600;
    color: var(--bs-secondary-color);
    font-size: .8rem;
    white-space: nowrap;
}

.imsp-badge {
    display: inline-block;
    padding: .18rem .5rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
}

.imsp-badge-success { background: #d1e7dd; color: #0f5132; }
.imsp-badge-warning { background: #fff3cd; color: #664d03; }
.imsp-badge-danger  { background: #f8d7da; color: #842029; }
.imsp-badge-muted   { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }

[data-bs-theme="dark"] .imsp-badge-success { background: #0f5132; color: #d1e7dd; }
[data-bs-theme="dark"] .imsp-badge-warning { background: #664d03; color: #fff3cd; }
[data-bs-theme="dark"] .imsp-badge-danger  { background: #842029; color: #f8d7da; }

/* Progress */
.imsp-progress {
    height: .55rem;
    border-radius: 999px;
    background: var(--bs-secondary-bg);
    overflow: hidden;
}

.imsp-progress-bar {
    height: 100%;
    background: var(--imsp-primary);
    transition: width .3s ease;
}

/* Login */
.imsp-login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #12263f 0%, #1c3a5e 100%);
    padding: 1.5rem;
}

.imsp-login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bs-body-bg);
    border-radius: 14px;
    padding: 2rem;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
}

/* Responsive */
@media (max-width: 991.98px) {
    .imsp-sidebar {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        z-index: 40;
        transform: translateX(100%);
    }

    .imsp-sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0, 0, 0, .4);
    }

    .imsp-content {
        padding: 1rem;
    }
}
