/* ==========================================================================
   Antigravity Design System - Layout Styles (Root, Sidebar, Navbar, Footer)
   Sama Persis Kesra (F:\kesra\public\app.css)
   ========================================================================== */

:root {
    --bg-body: #EEF2F6;
    --bg-sidebar: #0E3B3E;
    --bg-sidebar-hover: #14494D;
    --bg-sidebar-active: #1D5B60;
    --sidebar-thumb: #18585C;
    --sidebar-thumb-hover: #22787E;
    --color-primary-teal: #0F766E;
    --card-bg: #FFFFFF;
    --card-border: #E2E8F0;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-body);
}

.sidebar-theme {
    background-color: var(--bg-sidebar) !important;
}

.dashboard-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
}

/* ==================== GLOBAL SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: #F1F5F9;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* ==================== SIDEBAR SCROLLBAR ==================== */
#sidebar ::-webkit-scrollbar {
    width: 4px;
}

#sidebar ::-webkit-scrollbar-track {
    background: var(--bg-sidebar);
}

#sidebar ::-webkit-scrollbar-thumb {
    background: var(--sidebar-thumb);
    border-radius: 9999px;
}

#sidebar ::-webkit-scrollbar-thumb:hover {
    background: var(--sidebar-thumb-hover);
}

#sidebar nav {
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-thumb) var(--bg-sidebar);
}

/* ==================== PORTAL UNIT SELECT ==================== */
.rsd-unit-select {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 0 2rem 0 0.75rem;
    border: 1px solid #E2E8F0;
    border-radius: 0.5rem;
    background-color: #F8FAFC;
    color: #334155;
    font-size: 0.75rem;
    line-height: 1.25rem;
    cursor: pointer;
}

.rsd-unit-select:focus {
    outline: 2px solid rgba(13, 148, 136, 0.2);
    border-color: #0D9488;
}

/* ==================== SKELETON SHIMMER ANIMATION ==================== */
@keyframes skeletonShimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.shimmer-placeholder {
    position: relative;
    overflow: hidden;
    background-color: #E2E8F0;
}

.shimmer-placeholder::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.4) 20%,
        rgba(255, 255, 255, 0.7) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: skeletonShimmer 1.5s infinite ease-in-out;
    content: '';
}

/* ==========================================================================
   MODERN ICON RAIL SIDEBAR (Wayline / Command UI Reference)
   ========================================================================== */
.rail-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    width: 56px;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px 12px;
    border-right: 1px solid #e9ebed;
    background: #fcfcfc;
    transition: width .22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .22s ease, background-color .15s ease, transform .22s ease;
    overflow-x: hidden;
    overflow-y: auto;
}

.rail-sidebar::-webkit-scrollbar {
    width: 3px;
}
.rail-sidebar::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 9999px;
}

/* Brand Logo */
.rail-logo {
    display: flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    transition: width .22s ease, padding .22s ease;
    overflow: hidden;
}

.rail-logo-badge {
    display: flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    place-items: center;
    flex-shrink: 0;
    border-radius: 9px;
    background: #ffffff;
    border: 1px solid #e2e4e7;
    box-shadow: 0 1px 4px rgba(20, 25, 30, 0.05);
    overflow: hidden;
    padding: 2px;
}

.rail-logo-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.rail-logo-text {
    display: none;
    overflow: hidden;
    white-space: nowrap;
    text-align: left;
}

.rail-logo-title {
    font-size: 13px;
    font-weight: 800;
    color: #17191d;
    line-height: 1.1;
    letter-spacing: -0.3px;
}

.rail-logo-title span {
    color: #e96837;
}

.rail-logo-sub {
    font-size: 9px;
    color: #858b92;
    font-weight: 600;
    margin-top: 1px;
}

/* Spacer */
.rail-spacer {
    flex: 1;
}

/* Sections & Dividers */
.rail-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
}

.rail-section-title {
    display: none;
    width: 100%;
    padding: 6px 12px 2px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9aa1a9;
    white-space: nowrap;
}

.rail-divider {
    width: 26px;
    height: 1px;
    background: #e9ebed;
    margin: 6px 0;
    transition: width .22s ease;
}

/* Action Buttons / Links */
.rail-button {
    position: relative;
    display: flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #777e86;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s ease, color .15s ease, width .22s ease, padding .22s ease;
    white-space: nowrap;
}

.rail-button:hover {
    background: #fff0e8;
    color: #e96837;
}

.rail-button.active {
    background: #191b1e;
    color: #ffffff;
}

.rail-button.active:hover {
    background: #191b1e;
    color: #ffffff;
}

.rail-button.active::after {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 3px 0 0 3px;
    background: #e96837;
    content: "";
}

.rail-button svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    order: 0;
}

.rail-button i {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    order: 0;
}

.rail-label {
    display: none;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    text-align: left;
    order: 1;
    letter-spacing: -0.2px;
}

.rail-button:hover:not(.active) .rail-label {
    color: #e96837;
    font-weight: 700;
}

.rail-button.active .rail-label {
    color: #ffffff;
    font-weight: 700;
}

/* Badge for notifications / active cases */
.rail-badge {
    display: none;
    margin-left: auto;
    padding: 2px 7px;
    border-radius: 9999px;
    background: #e96837;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    order: 2;
    box-shadow: 0 1px 3px rgba(233, 104, 55, 0.3);
}

.rail-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e96837;
    box-shadow: 0 0 0 2px #ffffff;
}

/* User Profile Row at Bottom */
.rail-user {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 4px;
    border-radius: 9px;
    text-decoration: none;
    color: inherit;
    transition: background-color .15s ease;
}

.rail-user:hover {
    background-color: #f4f5f6;
}

.rail-avatar {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: linear-gradient(140deg, #ddc2ae, #8b705c);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.rail-user-details {
    display: none;
    overflow: hidden;
    white-space: nowrap;
    text-align: left;
}

.rail-user-name {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-size: 12px;
    font-weight: 800;
    color: #17191d;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 125px;
}

.rail-user-role {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-size: 10px;
    color: #858b92;
    font-weight: 700;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 125px;
}

/* Expand on desktop hover/focus */
@media (min-width: 1280px) {
    .rail-sidebar:hover,
    .rail-sidebar:focus-within {
        width: 215px !important;
        align-items: stretch;
        box-shadow: 6px 0 24px rgba(20, 25, 30, .09);
        background: #ffffff;
        padding: 12px 10px;
    }
    .rail-sidebar:hover .rail-logo,
    .rail-sidebar:focus-within .rail-logo {
        width: 100%;
        background: transparent;
        justify-content: flex-start;
        padding: 0 4px;
    }
    .rail-sidebar:hover .rail-logo-text,
    .rail-sidebar:focus-within .rail-logo-text {
        display: block;
    }
    .rail-sidebar:hover .rail-section,
    .rail-sidebar:focus-within .rail-section {
        align-items: stretch;
    }
    .rail-sidebar:hover .rail-section-title,
    .rail-sidebar:focus-within .rail-section-title {
        display: block;
    }
    .rail-sidebar:hover .rail-divider,
    .rail-sidebar:focus-within .rail-divider {
        width: 100%;
    }
    .rail-sidebar:hover .rail-button,
    .rail-sidebar:focus-within .rail-button {
        width: 100%;
        justify-content: flex-start;
        padding: 0 10px;
    }
    .rail-sidebar:hover .rail-label,
    .rail-sidebar:focus-within .rail-label {
        display: block;
    }
    .rail-sidebar:hover .rail-badge,
    .rail-sidebar:focus-within .rail-badge {
        display: inline-block;
    }
    .rail-sidebar:hover .rail-dot,
    .rail-sidebar:focus-within .rail-dot {
        display: none;
    }
    .rail-sidebar:hover .rail-user-details,
    .rail-sidebar:focus-within .rail-user-details {
        display: block;
    }
}

/* Mobile Drawer Behavior */
@media (max-width: 1279px) {
    .rail-sidebar {
        width: 225px !important;
        align-items: stretch;
        padding: 14px 12px;
        background: #ffffff;
        box-shadow: 6px 0 28px rgba(0,0,0,0.18);
    }
    .rail-sidebar .rail-logo {
        width: 100%;
        background: transparent;
        justify-content: flex-start;
        padding: 0 4px;
    }
    .rail-sidebar .rail-logo-text { display: block; }
    .rail-sidebar .rail-section { align-items: stretch; }
    .rail-sidebar .rail-section-title { display: block; }
    .rail-sidebar .rail-divider { width: 100%; }
    .rail-sidebar .rail-button { width: 100%; justify-content: flex-start; padding: 0 10px; }
    .rail-sidebar .rail-label { display: block; }
    .rail-sidebar .rail-badge { display: inline-block; }
    .rail-sidebar .rail-dot { display: none; }
    .rail-sidebar .rail-user-details { display: block; }
}
