/* Main Layout CSS */

:root {
    --primary-color: #0d9dbc;
    --primary-dark: #0a7a94;
    --sidebar-width: 250px;
    --transition-speed: 0.5s;
    --text-color: #333;
    --border-color: #e0e0e0;
    --light-gray: #f2f2f2;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    font-family: Calibri, "Helvetica Neue", "Lucida Grande", "Segoe UI", Arial, Helvetica, Verdana, sans-serif;
    font-size: .80em;
    color: #696969;
    background-color: #fff;
}

body {
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Enterprise header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 78px;
    padding: 10px 24px 10px 82px;
    background: #fff;
    border-top: 9px solid var(--primary-color);
    border-bottom: 8px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 260px;
}

.app-brand img,
.app-header-logo {
    height: 50px;
    width: 86px;
    object-fit: contain;
}

.app-title {
    color: var(--primary-color);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.1;
}

.app-subtitle {
    color: #555;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.app-user-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px 14px;
    color: #555;
    font-size: 12px;
    line-height: 1.5;
    text-align: right;
}

.app-menu-button {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 8px;
    background: rgba(13, 157, 188, 0.12);
    color: #111;
    font-size: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Standard page header used to normalize migrated Admin/Employee pages */
.standard-page-header {
    width: 100%;
    background: #fff;
}

.standard-page-header .header-rule-top {
    height: 9px;
    width: 100%;
    background: var(--primary-color);
    margin: 0 0 8px;
}

.standard-page-header .header-content {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    width: 100%;
}

.standard-page-header .standard-menu-icon {
    width: 34px;
    height: 44px;
    border: 0;
    background: transparent;
    color: #000;
    font-size: 31px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 34px;
}

.standard-page-header .wanbury-header-logo {
    width: 80px;
    height: 50px;
    object-fit: contain;
    flex: 0 0 80px;
}

.standard-page-header .page-title-panel {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    margin: 0 0 0 4px;
    padding: 0 20px;
    border-radius: 13px;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: Calibri, Arial, sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.15;
    text-transform: uppercase;
}

.standard-page-header .gregor-header-logo {
    width: 100px;
    height: 50px;
    object-fit: contain;
    flex: 0 0 100px;
    margin-left: 8px;
}

.standard-page-header .header-rule-bottom {
    height: 8px;
    width: 100%;
    background: var(--primary-color);
    margin: 4px 0 8px;
    box-shadow: 0 8px 16px rgba(0,0,0,.2), 0 6px 20px rgba(0,0,0,.19);
}

.legacy-header-hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .standard-page-header .page-title-panel {
        font-size: 13px;
        padding: 0 10px;
    }

    .standard-page-header .gregor-header-logo {
        width: 84px;
        flex-basis: 84px;
    }
}

/* Sidebar Navigation */
.app-sidenav {
    height: 100vh;
    width: 0;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    background-color: var(--primary-color);
    overflow-x: hidden;
    overflow-y: auto;
    transition: width var(--transition-speed) ease;
    border-radius: 0 10px 0 0;
    padding-top: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #d7f6ff var(--primary-dark);
}

.app-sidenav.open {
    width: var(--sidebar-width);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
}

/* Webkit Scrollbar */
.app-sidenav::-webkit-scrollbar {
    width: 6px;
    display: block !important;
}

.app-sidenav::-webkit-scrollbar-track {
    background: var(--primary-dark);
    border-radius: 10px;
}

.app-sidenav::-webkit-scrollbar-thumb {
    background: white;
    border-radius: 10px;
    min-height: 40px;
}

.app-sidenav::-webkit-scrollbar-thumb:hover {
    background: #e0f7ff;
}

/* Sidebar Header */
.sidebar-header {
    padding: 18px 8px 12px 20px;
    margin-bottom: 10px;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    position: relative;
}

.sidebar-close {
    position: absolute;
    top: 0;
    right: 6px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.sidebar-user {
    padding-top: 10px;
    font-size: 10px;
    line-height: 2.35;
    font-weight: 700;
    text-transform: uppercase;
}

/* Sidebar Navigation Items */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar-item {
    color: white;
    min-height: 50px;
    padding: 0 8px 0 10px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    transition: background-color 0.3s ease;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--primary-color);
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.2;
}

.sidebar-dropdown {
    justify-content: space-between;
}

.sidebar-item:hover {
    background-color: var(--primary-dark);
    color: #fff;
}

.sidebar-item.active {
    background-color: var(--primary-dark);
    font-weight: 700;
}

.sidebar-item i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Section Header - Special styling for section titles */
.sidebar-section-header {
    background-color: rgba(0, 0, 0, 0.3);
    font-weight: 600;
    font-size: 15px;
    padding: 15px 20px;
    margin-top: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    cursor: default;
}

.sidebar-section-header:hover {
    background-color: rgba(0, 0, 0, 0.3);
    border-left-color: transparent;
}

/* Sidebar Dropdown Items */
.sidebar-dropdown {
    cursor: pointer;
    position: relative;
}

.dropdown-arrow {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: auto;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-dropdown.open .dropdown-arrow,
.dropdown-arrow.rotated {
    transform: rotate(90deg);
}

/* Sidebar Submenu */
.sidebar-submenu {
    display: none;
    flex-direction: column;
    background-color: #118fa8;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
}

.sidebar-submenu.open {
    display: flex;
    max-height: 1000px;
    opacity: 1;
}

.sidebar-subitem {
    color: #fff;
    min-height: 42px;
    padding: 0 18px 0 22px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.25;
    text-transform: uppercase;
}

.sidebar-subitem:hover {
    background-color: var(--primary-dark);
    border-left-color: white;
    color: white;
}

.sidebar-subitem.active {
    background-color: var(--primary-dark);
    border-left-color: white;
    color: white;
    font-weight: 500;
}

.sidebar-subitem i {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* Menu Overlay - Mobile */
.app-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.app-menu-overlay.show {
    display: block;
    opacity: 1;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    left: 20px;
    top: 20px;
    z-index: 9998;
    width: 45px;
    height: 45px;
    padding: 0;
    border-radius: 50%;
    background-color: var(--primary-color) !important;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background-color: var(--primary-dark) !important;
    transform: scale(1.1);
}

/* Refresh Button */
.refresh-button {
    position: fixed;
    bottom: 24px;
    right: 22px;
    z-index: 99998;
    width: 50px;
    height: 50px;
    padding: 0;
    border-radius: 50%;
    background-color: var(--primary-color) !important;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-button:hover {
    background-color: var(--primary-dark) !important;
    transform: rotate(180deg);
}

.refresh-button:active {
    opacity: 0.6;
}

/* Main Content Area */
.main-content {
    transition: margin-left var(--transition-speed) ease;
    margin-left: 0;
    padding: 10px;
    min-height: auto;
    flex: 1 0 auto;
    width: 100%;
}

.main-content.with-sidebar {
    margin-left: var(--sidebar-width);
}

.page-content {
    background-color: white;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    padding-bottom: 32px;
}

/* Alerts */
.alert {
    margin-bottom: 20px;
    border-radius: 4px;
    border: 1px solid;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    border-color: #d4edda;
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    border-color: #f8d7da;
    background-color: #f8d7da;
    color: #721c24;
}

.alert-info {
    border-color: #d1ecf1;
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Disclaimer Section */
.disclaimer-section {
    background-color: #fff;
    color: #000;
    padding: 8px 20px;
    text-align: left;
    font-size: 12px;
    font-family: 'Calibri', 'Arial', sans-serif;
    border-top: 8px solid var(--primary-color);
    width: 100%;
    flex: 0 0 auto;
    position: relative;
    z-index: 5;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    max-height: 120px;
    overflow-y: auto;
}

.disclaimer-content {
    padding: 5px 0;
}

.disclaimer-content strong {
    color: var(--primary-color);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.disclaimer-list {
    margin: 8px 0 0 20px;
    padding-left: 15px;
}

.disclaimer-list li {
    margin: 6px 0;
    line-height: 1.4;
    list-style-type: disc;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 200px;
    }

    .app-header {
        align-items: flex-start;
        padding: 10px 14px 10px 64px;
        gap: 10px;
    }

    .app-brand {
        min-width: 0;
    }

    .app-user-strip {
        display: none;
    }

    .app-header-logo {
        display: none;
    }

    .sidebar-item {
        font-size: 14px;
    }

    .sidebar-subitem {
        font-size: 13px;
    }

    .sidebar-toggle {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .main-content {
        padding: 15px;
    }

    .page-content {
        padding: 15px;
    }

    .refresh-button {
        bottom: 22px;
        right: 15px;
        width: 46px;
        height: 46px;
        font-size: 18px;
    }

    .disclaimer-section {
        font-size: 11px;
        padding: 10px 15px;
    }

    .disclaimer-content strong {
        font-size: 12px;
    }

    .sidebar-header h5 {
        font-size: 16px;
    }

    .sidebar-header small {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    :root {
        --sidebar-width: 150px;
    }

    .app-sidenav {
        padding-top: 50px;
    }

    .sidebar-item {
        padding: 10px 15px;
        font-size: 12px;
    }

    .sidebar-subitem {
        padding: 8px 30px;
        font-size: 11px;
    }

    .sidebar-item i {
        width: 16px;
        font-size: 14px;
    }

    .sidebar-subitem i {
        width: 14px;
        font-size: 12px;
    }

    .sidebar-toggle {
        left: 10px;
        top: 10px;
        width: 38px;
        height: 38px;
        font-size: 14px;
    }

    .refresh-button {
        bottom: 18px;
        right: 10px;
        width: 42px;
        height: 42px;
        font-size: 16px;
    }

    .disclaimer-section {
        max-height: 150px;
        font-size: 10px;
    }

    .disclaimer-list {
        margin: 5px 0 0 15px;
        padding-left: 10px;
    }

    .disclaimer-list li {
        margin: 4px 0;
    }

    .sidebar-header {
        padding: 0 10px;
    }

    .app-brand img {
        display: none;
    }

    .app-title {
        font-size: 16px;
    }

    .app-subtitle {
        font-size: 10px;
    }
}

.sticky-grid-wrapper,
.table-responsive,
.table-scroll-wrapper,
.grid-wrapper,
.gw {
    width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 32px;
    max-height: calc(100vh - 260px);
    overscroll-behavior: contain;
}

.sticky-grid-wrapper table,
.table-responsive table,
.grid-wrapper table,
.gw table {
    border-collapse: collapse;
}

.sticky-grid-wrapper th,
.sticky-grid-wrapper td,
.table-responsive th,
.table-responsive td,
.grid-wrapper th,
.grid-wrapper td,
.gw th,
.gw td {
    vertical-align: middle;
    text-align: center;
    line-height: 1.25;
    word-break: normal;
    overflow-wrap: anywhere;
}

.sticky-grid-wrapper th,
.table-responsive thead th,
.grid-wrapper thead th,
.gw thead th {
    background: var(--primary-color);
    color: #fff;
    font-weight: 700;
    white-space: normal;
}

.filterDdl,
.styled-dropdown,
select {
    max-width: 100%;
}

.chosen-container.filter-chosen-select,
.filter-bar .chosen-container,
.filter-section .chosen-container,
.period-bar .chosen-container,
.sticky-filters .chosen-container,
.filter-panel .chosen-container {
    font-size: 12px;
    max-width: 100%;
    display: inline-block;
    vertical-align: middle;
    text-align: left;
}

.sticky-filters {
    overflow: visible;
    padding: 3px 0;
}

.sticky-filters form,
.sticky-filters table,
.sticky-filters tr,
.sticky-filters td {
    overflow: visible;
}

.sticky-filters table,
.filter-panel table.filter-table {
    width: max-content !important;
    min-width: 100%;
}

.sticky-filters td,
.filter-panel .filter-table td {
    white-space: nowrap !important;
    vertical-align: middle !important;
    padding: 6px 4px !important;
}

.sticky-filters label,
.filter-panel label {
    display: inline-block;
    margin: 0 3px 0 0;
    white-space: nowrap;
}

.sticky-filters .chosen-container,
.filter-panel .chosen-container {
    width: var(--chosen-width, 155px) !important;
}

.sticky-filters #designation_chosen,
.filter-panel #designation_chosen {
    width: 205px !important;
}

.sticky-filters #empCode_chosen,
.filter-panel #empCode_chosen {
    width: 220px !important;
}

.chosen-container-single .chosen-single {
    min-height: 24px;
    height: 26px;
    border-color: #aaa;
    border-radius: 5px;
    background: linear-gradient(#fff, #f3f3f3);
    box-shadow: 0 2px 5px rgba(0,0,0,.18);
    color: #000;
    line-height: 24px;
    padding-left: 7px;
    overflow: hidden;
}

.chosen-container-single .chosen-single div b {
    background-position-y: 2px;
}

.chosen-container .chosen-drop {
    border-color: #aaa;
    box-shadow: 0 4px 8px rgba(0,0,0,.18);
    z-index: 1050;
}

.chosen-container.chosen-with-drop {
    z-index: 1050;
}

.chosen-container-single .chosen-search input[type="text"] {
    min-height: 24px;
    font-size: 12px;
}

.chosen-container .chosen-results li {
    font-size: 12px;
    line-height: 18px;
}

.chosen-container .chosen-results li.highlighted {
    background: #2f66c5;
}

.sticky-filters .action-button,
.filter-panel .action-button,
.filter-bar button,
.filter-section button {
    white-space: nowrap;
}

/* Unified filter panel for migrated Admin and Employee pages */
.sticky-filters,
.filter-panel,
.filter-bar,
.filter-section,
.period-bar,
.fb {
    margin: 0 !important;
    padding: 10px 15px !important;
    background: #fff !important;
    border: 0 !important;
    border-bottom: 1px solid #c9c9c9 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.sticky-filters form,
.filter-panel form,
.filter-bar form,
.filter-section form,
.period-bar form,
.fb form,
.filter-section form > div,
.period-bar {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px 12px !important;
}

.sticky-filters table,
.filter-panel table,
.filter-section table {
    width: 100% !important;
    min-width: 0 !important;
}

.sticky-filters tr,
.filter-panel tr,
.filter-section tr {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px 12px !important;
}

.sticky-filters td,
.filter-panel td,
.filter-section td {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 0 !important;
    white-space: nowrap !important;
}

.sticky-filters label,
.filter-panel label,
.filter-bar label,
.filter-section label,
.period-bar label,
.fb label,
.filter-label {
    width: auto !important;
    min-width: 0 !important;
    margin: 0 4px 0 0 !important;
    color: #555 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 26px !important;
    white-space: nowrap !important;
}

.filterDdl,
.styled-dropdown,
.filter-control,
.filter-bar select,
.filter-section select,
.filter-panel select,
.period-bar select,
.fb select,
.sticky-filters select {
    width: 130px !important;
    height: 26px !important;
    min-height: 26px !important;
    padding: 2px 6px !important;
    border: 1px solid #aaa !important;
    border-radius: 5px !important;
    background: linear-gradient(#fff, #f3f3f3) !important;
    color: #000 !important;
    font-size: 12px !important;
    line-height: 22px !important;
    box-shadow: 0 2px 5px rgba(0,0,0,.18) !important;
}

select[name="designation"],
select#designation,
.designation-ddl,
.sticky-filters #designation,
.filter-panel #designation,
.filter-section #designation {
    width: 205px !important;
}

select[name="empCode"],
select[name="employee"],
select[name="code"],
select#empCode,
select#employee,
.employee-ddl {
    width: 220px !important;
}

.sticky-filters .chosen-container,
.filter-panel .chosen-container,
.filter-bar .chosen-container,
.filter-section .chosen-container,
.period-bar .chosen-container,
.fb .chosen-container {
    width: var(--chosen-width, 130px) !important;
}

.filter-section .chosen-container-single .chosen-single,
.filter-bar .chosen-container-single .chosen-single,
.filter-panel .chosen-container-single .chosen-single,
.period-bar .chosen-container-single .chosen-single,
.sticky-filters .chosen-container-single .chosen-single,
.fb .chosen-container-single .chosen-single {
    height: 26px !important;
    min-height: 26px !important;
    line-height: 24px !important;
    border-color: #aaa !important;
    border-radius: 5px !important;
    background: linear-gradient(#fff, #f3f3f3) !important;
    box-shadow: 0 2px 5px rgba(0,0,0,.18) !important;
}

.action-button,
.styled-button,
.apply,
.clr,
.filter-bar button,
.filter-section button,
.period-bar button,
.fb button,
button[type="submit"].mvc-filter-submit {
    min-width: 70px !important;
    height: 28px !important;
    padding: 0 14px !important;
    border: 2px solid var(--primary-color) !important;
    border-radius: 6px !important;
    background: #fff !important;
    color: #000 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 24px !important;
    cursor: pointer !important;
    box-shadow: 2px 2px 5px rgba(0,0,0,.2) !important;
}

.action-button:hover,
.styled-button:hover,
.apply:hover,
.clr:hover,
.filter-bar button:hover,
.filter-section button:hover,
.period-bar button:hover,
.fb button:hover {
    background: #e9fbff !important;
    color: #000 !important;
}

.export-btn,
.exp,
.filter-bar .export-btn,
.filter-section .export-btn,
button[onclick*="export"],
button[onclick*="Export"] {
    min-width: 120px !important;
    background: #24a148 !important;
    border-color: #24a148 !important;
    color: #fff !important;
    font-weight: 700 !important;
}

.export-btn:hover,
.exp:hover,
button[onclick*="export"]:hover,
button[onclick*="Export"]:hover {
    background: #1f8f3f !important;
    border-color: #1f8f3f !important;
    color: #fff !important;
}

/* Print Styles */
@media print {
    .sidebar-toggle,
    .refresh-button,
    .disclaimer-section,
    .app-sidenav {
        display: none !important;
    }

    body {
        margin-bottom: 0;
    }

    .main-content {
        margin-left: 0;
    }
}
