/* ================================================================
   NHIT Theme — AdminLTE skin-blue mapped onto Filament v3
   v8.0 — Faithful to exam.nhit.in AdminLTE design system.
   
   Palette (from AdminLTE skin-blue):
     Header navbar:  #3c8dbc  (primary blue)
     Logo bg:        #367fa9  (darker blue)
     Sidebar:        #222d32  (dark charcoal)
     Sidebar hover:  #1e282c
     Sidebar text:   #b8c7ce
     Sidebar header: #4b646f / bg #1a2226
     Active border:  #3c8dbc
     Body bg:        #ecf0f5
     Form border:    #d2d6de
     Form focus:     #3c8dbc
     Box shadow:     0 1px 1px rgba(0,0,0,0.1)
     Box top accent: 3px solid #d2d6de (or colored)
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;600;700&display=swap');

:root {
    --nhit-primary: #3c8dbc;
    --nhit-primary-dark: #367fa9;
    --nhit-info: #00c0ef;
    --nhit-success: #00a65a;
    --nhit-warning: #f39c12;
    --nhit-danger: #dd4b39;
    --nhit-sidebar-bg: #222d32;
    --nhit-sidebar-hover: #1e282c;
    --nhit-sidebar-text: #b8c7ce;
    --nhit-body-bg: #ecf0f5;
    --nhit-border: #d2d6de;
    --nhit-text: #333;
    --nhit-text-muted: #777;
    --nhit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

html {
    color-scheme: light !important;
}

/* ================================================================
   BODY / TYPOGRAPHY
   ================================================================ */
body {
    font-family: 'Source Sans 3', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    font-weight: 400 !important;
    background-color: var(--nhit-body-bg) !important;
    color: var(--nhit-text) !important;
}

/* ================================================================
   MAIN CONTENT AREA
   ================================================================ */
.fi-main {
    background-color: var(--nhit-body-bg) !important;
}

/* ================================================================
   TOP HEADER / NAVBAR — skin-blue: #3c8dbc
   ================================================================ */
.fi-topbar,
.fi-topbar > nav {
    background-color: var(--nhit-primary) !important;
    border-bottom: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) !important;
}

.fi-topbar,
.fi-topbar button,
.fi-topbar a,
.fi-topbar svg {
    color: #fff !important;
}

.fi-topbar button:hover,
.fi-topbar a:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

/* Prominent Mobile Hamburger / Sidebar Toggle Button */
.fi-topbar-open-sidebar-btn,
.fi-topbar-close-sidebar-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 2.5rem !important;
    height: 2.5rem !important;
    min-width: 2.5rem !important;
    border-radius: 0.625rem !important;
    background-color: rgba(255, 255, 255, 0.18) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    transition: all 0.15s ease-in-out !important;
}

.fi-topbar-open-sidebar-btn:hover,
.fi-topbar-close-sidebar-btn:hover,
.fi-topbar-open-sidebar-btn:focus,
.fi-topbar-close-sidebar-btn:focus {
    background-color: rgba(255, 255, 255, 0.32) !important;
    color: #ffffff !important;
    outline: none !important;
}

.fi-topbar-open-sidebar-btn svg,
.fi-topbar-close-sidebar-btn svg {
    width: 1.5rem !important;
    height: 1.5rem !important;
    color: #ffffff !important;
    stroke: #ffffff !important;
    stroke-width: 2.2 !important;
}

@media (min-width: 1024px) {
    .fi-topbar-open-sidebar-btn.lg\:hidden,
    .fi-topbar-close-sidebar-btn.lg\:hidden {
        display: none !important;
    }
}

/* ================================================================
   LOGO / BRAND — skin-blue: #367fa9
   ================================================================ */
.fi-sidebar-header,
.fi-topbar .fi-logo {
    background-color: var(--nhit-primary-dark) !important;
}

.fi-logo {
    color: #fff !important;
    font-weight: 700 !important;
    font-size: 1.25rem !important;
}

/* ================================================================
   LEFT SIDEBAR — Fancy Toggle Sidebar (djdabe/tonkec CodePen look)
   Growing colored left-border on hover.
   ================================================================ */
.fi-sidebar {
    background-color: #1a1a1a !important;
    border-right: none !important;
}

/* Sidebar brand header gradient */
.fi-sidebar-header {
    background: #212531 !important;
    background: linear-gradient(to right bottom, #2f3441 50%, #212531 50%) !important;
    border-bottom: 1px solid rgba(255,255,255,0.05) !important;
}

/* Sidebar group section labels */
.fi-sidebar-group-label {
    color: #8aa4af !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 0.65rem 1rem 0.25rem 1rem !important;
    background-color: #111111 !important;
}

/* ---- Nav item LI & Filament v3 items: the growing-border host ---- */
.nhit-nav-item,
.fi-sidebar-item {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden; /* clip the ::before pseudo-element */
}

/* The colorful expanding background strip */
.nhit-nav-item::before,
.fi-sidebar-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 3px;
    background-color: #ec1b5a; /* default — overridden per nth-child */
    transition: width 0.2s ease-in;
    z-index: 0;
}

/* Rainbow color-cycle for each successive menu item */
.nhit-nav-item:nth-child(5n+1)::before, .fi-sidebar-item:nth-child(5n+1)::before { background-color: #ec1b5a; }
.nhit-nav-item:nth-child(5n+2)::before, .fi-sidebar-item:nth-child(5n+2)::before { background-color: #79aefe; }
.nhit-nav-item:nth-child(5n+3)::before, .fi-sidebar-item:nth-child(5n+3)::before { background-color: #314190; }
.nhit-nav-item:nth-child(5n+4)::before, .fi-sidebar-item:nth-child(5n+4)::before { background-color: #279636; }
.nhit-nav-item:nth-child(5n+5)::before, .fi-sidebar-item:nth-child(5n+5)::before { background-color: #7d5d81; }

/* On hover or when active: grow the strip to fill 100% */
.nhit-nav-item:hover::before,
.fi-sidebar-item:hover::before,
.nhit-nav-item-active::before,
.fi-sidebar-item-active::before {
    width: 100%;
    transition: width 0.2s ease-in;
}

/* ---- Nav anchor: sits above the pseudo-element ---- */
.nhit-nav-link,
.fi-sidebar-item-button {
    position: relative;
    z-index: 1;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    color: #ddd !important;
    text-decoration: none !important;
    padding: 10px 15px 10px 20px !important;
    background-color: transparent !important;
    border-radius: 0 !important;
    width: 100%;
    transition: color 0.15s ease;
}

.nhit-nav-link:hover,
.fi-sidebar-item-button:hover,
.nhit-nav-item-active .nhit-nav-link,
.fi-sidebar-item-active .fi-sidebar-item-button {
    color: #ffffff !important;
    background-color: transparent !important;
}

/* ---- Icon ---- */
.nhit-nav-icon,
.fi-sidebar-item-icon {
    color: #b8c7ce !important;
    transition: color 0.15s ease;
    flex-shrink: 0;
    width: 1.25rem !important;
    height: 1.25rem !important;
}

.nhit-nav-item:hover .nhit-nav-icon,
.fi-sidebar-item:hover .fi-sidebar-item-icon,
.nhit-nav-item-active .nhit-nav-icon,
.fi-sidebar-item-active .fi-sidebar-item-icon {
    color: #ffffff !important;
}

/* ---- Label text ---- */
.nhit-nav-label,
.fi-sidebar-item-label {
    color: #ddd;
    font-weight: 500;
    font-size: 0.875rem;
    transition: color 0.15s ease;
}

.nhit-nav-item:hover .nhit-nav-label,
.fi-sidebar-item:hover .fi-sidebar-item-label,
.nhit-nav-item-active .nhit-nav-label,
.fi-sidebar-item-active .fi-sidebar-item-label {
    color: #ffffff !important;
    font-weight: 600;
}

/* Collapsed / Shrinked Sidebar adjustments */
.fi-sidebar:not([data-open="true"]):not(.fi-sidebar-open) .nhit-user-panel,
.fi-collapsed .nhit-user-panel,
[data-collapsed="true"] .nhit-user-panel,
.fi-sidebar-collapsed .nhit-user-panel {
    justify-content: center !important;
    padding: 0.75rem 0.25rem !important;
}

.fi-sidebar:not([data-open="true"]):not(.fi-sidebar-open) .nhit-user-info,
.fi-collapsed .nhit-user-info,
[data-collapsed="true"] .nhit-user-info,
.fi-sidebar-collapsed .nhit-user-info {
    display: none !important;
}

/* ================================================================
   SIDEBAR USER PANEL (custom)
   ================================================================ */
.nhit-user-panel {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0.75rem;
    background-color: #1a1a1a !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;   /* prevent panel from forcing sidebar wider */
    min-width: 0;
    white-space: nowrap;
}

.nhit-user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;  /* never shrink the avatar circle */
    border-radius: 50%;
    background: var(--nhit-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.nhit-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;    /* allow text to truncate */
    overflow: hidden;
}

.nhit-user-name {
    font-weight: 600;
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nhit-user-email {
    font-size: 0.72rem;
    color: #8aa4af;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ================================================================
   SECTION CARDS / BOXES — AdminLTE .box style
   White bg, top accent border, subtle shadow
   ================================================================ */
.fi-section {
    background-color: #fff !important;
    border-radius: 3px !important;
    border-top: 3px solid var(--nhit-primary) !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    box-shadow: var(--nhit-box-shadow) !important;
    --tw-ring-shadow: none !important;
    --tw-ring-color: transparent !important;
}

.fi-section-header {
    border-bottom: 1px solid #f4f4f4 !important;
}

.fi-section-header-heading {
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    color: #444 !important;
}

.fi-section-header-description {
    color: var(--nhit-text-muted) !important;
}

/* ================================================================
   FORM INPUTS — AdminLTE style
   border-radius: 0, border: #d2d6de, focus: #3c8dbc
   ================================================================ */
.fi-input-wrp {
    background-color: #fff !important;
    border: 1px solid var(--nhit-border) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.fi-input-wrp:focus-within {
    border-color: var(--nhit-primary) !important;
    box-shadow: none !important;
}

/* ================================================================
   PAGE HEADER
   ================================================================ */
.fi-header-heading {
    font-size: 1.5rem !important;
    font-weight: 400 !important;
    color: var(--nhit-text) !important;
}

.fi-header-subheading {
    font-size: 0.9rem !important;
    color: var(--nhit-text-muted) !important;
}

/* ================================================================
   TABLES — AdminLTE clean table style
   ================================================================ */
.fi-ta-ctn {
    background-color: #fff !important;
    border-radius: 3px !important;
    box-shadow: var(--nhit-box-shadow) !important;
    border: none !important;
}

/* ================================================================
   DASHBOARD STAT BOXES — AdminLTE .small-box style
   ================================================================ */
.nhit-stat-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .nhit-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .nhit-stat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.nhit-stat-box {
    position: relative;
    display: block;
    border-radius: 1.25rem !important;
    color: #fff;
    overflow: hidden;
    margin-bottom: 0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.nhit-stat-box:hover {
    transform: translateY(-4px) scale(1.02) !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    text-decoration: none;
    color: #fff !important;
}

.nhit-stat-box-orange {
    background: linear-gradient(135deg, #ff9900, #ff5500) !important;
}

.nhit-stat-box-green {
    background: linear-gradient(135deg, #11998e, #38ef7d) !important;
}

.nhit-stat-box-blue {
    background: linear-gradient(135deg, #0052d4, #4364f7, #6fb1fc) !important;
}

.nhit-stat-box-red {
    background: linear-gradient(135deg, #ff416c, #ff4b2b) !important;
}

.nhit-stat-box-pink {
    background: linear-gradient(135deg, #ec008c, #fc6767) !important;
}

.nhit-stat-box-cyan {
    background: linear-gradient(135deg, #00c6ff, #0072ff) !important;
}

.nhit-stat-box-purple {
    background: linear-gradient(135deg, #654ea3, #eaafc8) !important;
}

.nhit-stat-box-teal {
    background: linear-gradient(135deg, #3ca55c, #b5ac49) !important;
}

.nhit-stat-inner {
    padding: 1.25rem;
    position: relative;
    z-index: 5;
}

.nhit-stat-number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin: 0 0 8px 0;
    white-space: nowrap;
}

.nhit-stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0.95;
}

.nhit-stat-icon {
    position: absolute;
    top: -10px;
    right: 10px;
    font-size: 90px;
    color: rgba(0, 0, 0, 0.15);
    z-index: 0;
    pointer-events: none;
    transition: all 0.3s linear;
}

.nhit-stat-box:hover .nhit-stat-icon {
    font-size: 95px;
}

.nhit-stat-footer {
    position: relative;
    text-align: center;
    padding: 6px 0;
    color: #ffffff !important;
    font-weight: 700 !important;
    display: block;
    z-index: 10;
    background: rgba(0, 0, 0, 0.25) !important;
    text-decoration: none;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nhit-stat-footer:hover {
    color: #ffffff !important;
    background: rgba(0, 0, 0, 0.35) !important;
}

/* ================================================================
   TRIX / RICH EDITOR & QUESTION IMAGE RESIZING & ADJUSTMENT
   ================================================================ */
trix-editor img,
.trix-content img,
.attachment img,
.attachment--preview img,
figure img,
.mathjax-content img {
    max-width: 100% !important;
    max-height: 500px !important;
    height: auto !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    display: inline-block !important;
    object-fit: contain !important;
    vertical-align: middle !important;
    margin: 0.5rem 0 !important;
}

trix-editor figure,
trix-editor .attachment,
.trix-content figure,
.trix-content .attachment,
.attachment--preview {
    max-width: 100% !important;
    margin: 0.75rem auto !important;
    text-align: center !important;
}

/* Hover outline for easy identification & adjustment inside editor */
trix-editor .attachment--preview:hover img,
trix-editor figure:hover img {
    outline: 2px solid var(--nhit-primary, #3c8dbc) !important;
    outline-offset: 3px !important;
    cursor: pointer !important;
}

/* Hide Trix attachment metadata (Add a caption..., filename, filesize, Remove button) in rendered question views */
.trix-content:not(trix-editor) figcaption,
.trix-content:not(trix-editor) .attachment__caption,
.trix-content:not(trix-editor) .attachment__name,
.trix-content:not(trix-editor) .attachment__size,
.trix-content:not(trix-editor) .attachment__toolbar,
.trix-content:not(trix-editor) .trix-button--remove,
.mathjax-content figcaption,
.mathjax-content .attachment__caption,
.mathjax-content .attachment__name,
.mathjax-content .attachment__size,
.mathjax-content .trix-button--remove {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Image alignment utility classes */
figure.align-left, .trix-content figure.align-left {
    float: left !important;
    margin-right: 1.25rem !important;
    margin-bottom: 0.75rem !important;
}

figure.align-right, .trix-content figure.align-right {
    float: right !important;
    margin-left: 1.25rem !important;
    margin-bottom: 0.75rem !important;
}

figure.align-center, .trix-content figure.align-center {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
}

/* Disable image link redirection to prevent tab violations & accidental page navigation */
figure a,
.attachment a,
.trix-content a:has(img),
.mathjax-content a:has(img) {
    pointer-events: none !important;
    cursor: default !important;
}

/* Allow interactive resizing & selection on image attachments inside Trix Editor */
trix-editor figure.attachment--preview,
trix-editor .attachment {
    resize: both !important;
    overflow: auto !important;
    min-width: 120px !important;
    max-width: 100% !important;
    display: inline-block !important;
    border: 2px dashed transparent;
    transition: border-color 0.2s;
}

trix-editor figure.attachment--preview:hover,
trix-editor figure.attachment--preview:focus-within {
    border-color: #38bdf8 !important;
}