/* ======================================================================
   custom.css  —  JWT Auth layout + Login page styles for ESimSol V2.1
   Breakpoints: mobile ≤767px | tablet 768–1024px | desktop ≥1025px
   ====================================================================== */

/* ── CSS Variables ──────────────────────────────────────────────── */
:root {
    --primary:        #CFB53B;
    --primary-dark:   #a88f2a;
    --primary-light:  #f0e080;
    --sidebar-width:  240px;
    --navbar-height:  60px;
    --transition:     0.25s ease;
    --sidebar-bg:     #1e2a3a;
    --sidebar-text:   #c8d6e5;
    --sidebar-hover:  #243447;
    --sidebar-active: #CFB53B;
    --body-bg:        #f4f6f9;
    --card-radius:    10px;
    --shadow-sm:      0 2px 8px rgba(0,0,0,.08);
    --shadow-md:      0 4px 16px rgba(0,0,0,.12);
}

/* ── Base reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; }

/* ====================================================================
   LOGIN PAGE
   ==================================================================== */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: var(--card-radius);
    padding: 2.5rem 2rem 2rem;
    box-shadow: var(--shadow-md);
    animation: fadeSlideUp .35s ease both;
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0);    }
}

.login-header { text-align: center; margin-bottom: 1.75rem; }
.login-logo {
    height: 64px;
    margin-bottom: .75rem;
    width: 100%; /* keep aspect ratio */
    max-width: 100%; /* prevent overflow */
    object-fit: contain; /* ensure full logo is visible */
    display: block;
}
.login-title  { font-size: 1.4rem; font-weight: 700; color: #1e2a3a; margin: 0; }
.login-subtitle { font-size: .875rem; margin-top: .25rem; }

.btn-login {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border: 1px solid var(--primary-dark);
    padding: 5px 1rem;
    border-radius: 6px;
    transition: background var(--transition), box-shadow var(--transition);
}
.btn-login:hover  { background: var(--primary-dark); color: #fff; }
.btn-login:focus  { box-shadow: 0 0 0 .25rem rgba(207,181,59,.4); }
.btn-login:disabled { opacity: .7; cursor: not-allowed; }

/* ====================================================================
   AUTHENTICATED LAYOUT — navbar
   ==================================================================== */

.auth-navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--navbar-height);
    background: #fff;
    border-bottom: 1px solid #e4e8ed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 1030;
    box-shadow: var(--shadow-sm);
}

.navbar-left  { display: flex; align-items: center; gap: .75rem; }
.navbar-right { display: flex; align-items: center; gap: 1rem; }

.brand-link {
    display: flex; align-items: center;
    text-decoration: none;
    color: #1e2a3a;
    font-weight: 700;
    font-size: 1.1rem;
}
.brand-link:hover { color: var(--primary); }
.brand-name { white-space: nowrap; }

.sidebar-toggle-btn {
    background: none;
    border: none;
    padding: .4rem .6rem;
    border-radius: 6px;
    cursor: pointer;
    color: #555;
    font-size: 1.15rem;
    transition: background var(--transition);
}
.sidebar-toggle-btn:hover { background: #f0f2f5; color: var(--primary); }

.nav-icon {
    position: relative;
    cursor: pointer;
    color: #666;
    font-size: 1.1rem;
    padding: .3rem;
}
.nav-icon:hover { color: var(--primary); }

.badge-dot {
    position: absolute;
    top: 2px; right: 2px;
    width: 8px; height: 8px;
    background: #e74c3c;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* ── User dropdown ───────────────────────────────────────────────── */

.user-dropdown { position: relative; }

.user-avatar {
    display: flex; align-items: center;
    cursor: pointer;
    padding: .35rem .6rem;
    border-radius: 6px;
    color: #333;
    font-size: .9rem;
    transition: background var(--transition);
}
.user-avatar:hover { background: #f0f2f5; }

.dropdown-menu-custom {
    display: none;
    position: absolute;
    right: 0; top: calc(100% + 8px);
    min-width: 220px;
    background: #fff;
    border: 1px solid #e4e8ed;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 1040;
    overflow: hidden;
    animation: fadeSlideUp .2s ease both;
}
.dropdown-menu-custom.open { display: block; }

.dropdown-header {
    padding: .85rem 1rem;
    background: #f8f9fb;
}
.dropdown-divider { margin: 0; border-color: #e4e8ed; }

.dropdown-item-custom {
    display: flex; align-items: center;
    padding: .6rem 1rem;
    color: #333;
    text-decoration: none;
    font-size: .9rem;
    transition: background var(--transition);
}
.dropdown-item-custom:hover { background: #f4f6f9; }
.dropdown-item-custom.text-danger { color: #dc3545 !important; }

/* ====================================================================
   AUTHENTICATED LAYOUT — sidebar
   ==================================================================== */

.auth-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1020;
    transition: transform var(--transition), width var(--transition);
    scrollbar-width: thin;
    scrollbar-color: #2c3e55 var(--sidebar-bg);
}

.auth-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
    background: var(--body-bg);
    transition: margin-left var(--transition);
}

/* Sidebar collapsed (toggled) */
.auth-sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }
.auth-main.collapsed    { margin-left: 0; }

/* ── Sidebar navigation ──────────────────────────────────────────── */

.sidebar-nav { padding: 1rem 0; }

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-item { margin: .1rem 0; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .9rem;
    border-left: 3px solid transparent;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    white-space: nowrap;
}
.sidebar-link i { width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-link:hover  { background: var(--sidebar-hover); color: #fff; }
.sidebar-link.active { background: var(--sidebar-hover); color: var(--sidebar-active); border-left-color: var(--sidebar-active); font-weight: 600; }
.sidebar-link.text-danger-muted { color: #e87878; }
.sidebar-link.text-danger-muted:hover { color: #ff6b6b; background: rgba(220,53,69,.1); }

.sidebar-separator { height: 1px; background: #2c3e55; margin: .5rem 1rem; }

/* ── Sidebar overlay (mobile) ────────────────────────────────────── */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1010;
}
.sidebar-overlay.show { display: block; }

/* ====================================================================
   AUTHENTICATED LAYOUT — main content
   ==================================================================== */

.auth-breadcrumb {
    padding: .6rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e4e8ed;
    font-size: .85rem;
}
.auth-breadcrumb .breadcrumb { margin: 0; }
.auth-breadcrumb a { color: var(--primary); text-decoration: none; }
.auth-breadcrumb a:hover { text-decoration: underline; }

.auth-content {
    padding: 1.5rem;
}

/* ====================================================================
   DASHBOARD COMPONENTS
   ==================================================================== */

/* Welcome card */
.welcome-card {
    background: linear-gradient(135deg, #1e2a3a 0%, #2c3e55 100%);
    color: #fff;
    border-radius: var(--card-radius);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-sm);
}

/* Stat cards */
.stat-card {
    border-radius: var(--card-radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    color: #fff;
}
.stat-icon { font-size: 2rem; opacity: .9; }
.stat-label { font-size: .78rem; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.stat-primary { background: linear-gradient(135deg, #2196f3, #1565c0); }
.stat-success { background: linear-gradient(135deg, #43a047, #1b5e20); }
.stat-warning { background: linear-gradient(135deg, #f9a825, #e65100); }
.stat-info    { background: linear-gradient(135deg, #00acc1, #006064); }

/* Token display */
.token-textarea {
    font-size: .75rem;
    resize: none;
    background: #f8f9fb;
    border-color: #dee2e6;
    word-break: break-all;
}
.token-payload {
    font-family: 'Courier New', monospace;
    font-size: .78rem;
    background: #f8f9fb;
    border-radius: 6px;
    padding: .75rem 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 8rem;
    color: #2c3e55;
}

/* Role badge */
.role-badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: .15rem .55rem;
    border-radius: 50px;
    background: var(--primary);
    color: #fff;
    letter-spacing: .03em;
    text-transform: uppercase;
}

/* ====================================================================
   TOAST NOTIFICATIONS
   ==================================================================== */

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    pointer-events: none;
}

.ics-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: .5rem;
    background: #fff;
    border-radius: 8px;
    padding: .75rem 1rem;
    box-shadow: var(--shadow-md);
    font-size: .9rem;
    min-width: 240px;
    max-width: 360px;
    animation: fadeSlideUp .25s ease both;
    border-left: 4px solid #ccc;
}
.ics-toast-success { border-left-color: #43a047; }
.ics-toast-error   { border-left-color: #e53935; }
.ics-toast-warning { border-left-color: #f9a825; }
.ics-toast-info    { border-left-color: #1e88e5; }

.toast-close-btn {
    background: none; border: none;
    margin-left: auto; padding: 0 .2rem;
    cursor: pointer; color: #999; font-size: .8rem;
}
.toast-close-btn:hover { color: #555; }

/* ====================================================================
   LOADING OVERLAY
   ==================================================================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

/* ====================================================================
   RESPONSIVE
   ==================================================================== */

/* Tablet 768–1024 */
@media (max-width: 1024px) {
    :root { --sidebar-width: 200px; }
}

/* Mobile ≤767 */
@media (max-width: 767px) {
    .auth-sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
    }
    .auth-sidebar.collapsed {
        /* On mobile "collapsed" actually means OPEN (hamburger reveals it) */
        transform: translateX(0);
    }
    .auth-main {
        margin-left: 0 !important;
    }

    .brand-name { display: none; }

    .auth-content { padding: 1rem; }

    .welcome-card { padding: 1rem 1.25rem; }
    .welcome-card .fa-4x { font-size: 2.5rem; }
    .welcome-card h3 { font-size: 1.1rem; }

    .stat-card { padding: 1rem; }
    .stat-value { font-size: 1.05rem; }

    .user-display-name { display: none; }

    .login-card { padding: 1.75rem 1.25rem 1.5rem; }
}



.div_header_v2 {
    background-color: #f1f1f1;
    padding: 10px 20px;
    flex-shrink: 0; /* don't shrink — holds its natural height */
    width: 100%;
    box-sizing: border-box;
    z-index: 1000;
}

.div_footer_v2 {
    background-color: #f1f1f1;
    padding: 0px 20px;
    flex-shrink: 0; /* don't shrink */
    width: 100%;
    box-sizing: border-box;
    font-weight: bold;
    overflow-x: auto; /* footer scrolls internally if needed */
    /* REMOVE position: fixed, bottom: 28px */
}

#btn_SearchBySatusTwo, #btn_SearchBySatus {
    height: 26px;
}

.div_content_v2 {
    flex: 1; /* takes all remaining vertical space */
    overflow: auto;
    min-height: 0; /* critical — allows flex child to shrink below content size */
    padding: 0;
    margin: 0;
}

.div_data_body_v2,
#div_data_body_v2 {
    height: 100%;
}

#KnittingPlanScheduler {
    height: 100%; /* fills div_data_body_v2 fully */
}
.custome_button_v2 {
    height: 26px;
}


.loader_knitting {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 1;
    width: 100px;
    height: 100px;
    margin: -76px 0 0 -76px;
    border: 16px solid #f3f3f3;
    border-radius: 50%;
    border-top: 16px solid #3498db;
    -webkit-animation: spin 2s linear infinite;
    animation: spin 2s linear infinite;
}
.div_modal_content_full_height {
/*    width: 100%;*/
    height: calc(100% - 100px);
    overflow-y: auto;
}

.menuMainCollectionTable{
    width: 100%;
    height: 100%;
}

.container_v2 {
    max-width: 1000px;
    margin: auto;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    height: 100%;
    overflow: auto;
}

.section_v2 {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.field {
    flex: 1 1 200px; /* default: min width 200px */
    display: flex;
    flex-direction: column;
}

    .field label {
        font-size: 15px;
        margin-bottom: 5px;
    }

.button-row {
    display: flex;
    gap: 10px;
}

.btn-half {
    flex: 1;
    padding: 0px 10px;
    font-size: 14px;
    border-radius: 6px;
    white-space: nowrap;
    margin-top: 17px;
}

.field input,
.field select {
    padding: 0px 5px;
    /*font-size: 15px;*/
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
}

.btn-block {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border-radius: 6px;
}

/* Roll-No input + buttons */
.input-with-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background-color: #007bff;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .nav-btn-circle:hover {
        background-color: #0056b3;
    }
/* Fault buttons grid */
.fault-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

    .fault-buttons button {
        padding: 0px;
        font-size: 14px;
        border-radius: 6px;
        border: 1px solid #0077cc;
        background-color: #e0f0ff;
        cursor: pointer;
    }

.remove-btn {
    background-color: red;
    color: white;
    border: none;
    /*padding: 6px 12px;*/
    border-radius: 6px;
    /*font-size: 12px;*/
    cursor: pointer;
    white-space: nowrap;
}

    .remove-btn:hover {
        background-color: #c82333;
    }
/* AG-Grid cells centered */
.ag-theme-balham .ag-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible !important;
}

.fault-btn {
    padding: 15px 40px 15px 20px;
    border: 1px solid #666;
    width: 120px;
    border-radius: 8px;
    background-color: #e6a565; /* replaced dynamically */
    color: #000;
    font-size: 16px;
    cursor: pointer;
    position: relative;
}

.fault-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: red;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
}

.easyui-datebox{
    min-width: 100px !important;
    max-width: 150px !important;
}


#Tempnotification_count {
    padding: 3px 7px 3px 7px;
    background: #cc0000;
    color: #ffffff;
    font-weight: bold;
    border-radius: 9px;
    position: absolute;
    margin-top: -13px;
    font-size: 11px;
    left: 130px;
    top: 24px;
}

.tab-action{
    height: calc(100% - 80px);
}
.action-area{
    height: 60px;
}
.main-entry-table{
    min-width: 1250px;
}


/* ============================================
   GLOBAL AG-GRID OVERFLOW FIX
   Apply to ALL ag-Grid instances in the app
   ============================================ */

/* Force every cell to contain its content instead of spilling out */
.ag-theme-balham .ag-cell,
.ag-theme-alpine .ag-cell,
.ag-cell {
    overflow: hidden !important;
    white-space: normal !important;
    word-break: break-word;
    display: flex;
    align-items: stretch;
    padding: 0px;
    margin: 0px;
}

/* The default cell-value wrapper should fill the cell box completely */
.ag-cell-value,
.ag-cell-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Custom HTML cell renderers (like FormatDetailSchedule output) need their
   own scroll boundary so long content scrolls INSIDE the cell, not outside */
.ag-cell > div.cell-content-wrapper {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: normal;
    box-sizing: border-box;
    padding: 2px;
}

/* Prevent any inline elements (badges, buttons, spans) inside renderers
   from forcing a wider box than the column width */
.ag-cell * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Header text wrapping (useful if headerName strings are long, like yours
   with "MachineName(Capacity) || ShedName") */
.ag-header-cell-label,
.ag-header-cell-text {
    white-space: normal !important;
    overflow: visible;
    line-height: 1.2;
}

/* Custom header button injected via headerComponentParams.headerHtml */
.ag-header-cell input[type="button"] {
    width: 100%;
    white-space: normal;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pinned columns (like your SL column) shouldn't be affected by the
   overflow:hidden flex rule above breaking their centering */
.ag-pinned-left-cols-container .ag-cell {
    align-items: center;
}