/*
 * Additions on top of the template bundle (public/clone/bundle.css).
 * The bundle carries AdminLTE 3.1, Bootstrap 4.6 and the template's shared styles;
 * this file only adds what the Laravel pages need beyond the template's own pages.
 */

/* Navbar user menu and fullscreen button, from the template navbar's <style> blocks. */
.user-menu .nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem;
}

.user-menu .user-image {
    width: 30px;
    height: 30px;
    object-fit: cover;
}

.user-menu .dropdown-menu {
    min-width: 280px;
}

.user-menu .user-header img {
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.user-menu .user-footer .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Sign Out is a POST form inside the equal-width button row. */
.user-menu .user-footer form .btn {
    width: 100%;
}

.gap-1 {
    gap: 10px;
}

.flex-equal > * {
    flex: 1 1 0% !important;
    text-align: center;
}

.nav-fullscreen .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.nav-fullscreen .nav-link i {
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .user-menu .user-image {
        width: 28px;
        height: 28px;
    }
    .user-menu .dropdown-menu {
        min-width: 250px;
        padding: 10px !important;
    }
    .user-menu .user-header img {
        width: 60px;
        height: 60px;
    }
    .user-menu .user-header p {
        font-size: 14px;
    }
    .user-menu .user-footer .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    .nav-fullscreen .nav-link {
        padding: 0.4rem;
    }
    .nav-fullscreen .nav-link i {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .user-menu .user-image {
        width: 24px;
        height: 24px;
    }
    .user-menu .dropdown-menu {
        min-width: 220px;
        padding: 8px !important;
    }
    .user-menu .user-header {
        padding: 10px !important;
    }
    .user-menu .user-header img {
        width: 50px;
        height: 50px;
    }
    .nav-fullscreen .nav-link {
        padding: 0.3rem;
    }
    .nav-fullscreen .nav-link i {
        font-size: 0.9rem;
    }
}

/* Bootstrap 4 has no gap utilities beyond the template's .gap-1. */
.gap-2 {
    gap: 0.5rem;
}
.gap-3 {
    gap: 1rem;
}

/* Sidebar logo keeps its square even when the uploaded logo is not. */
.main-sidebar .user-panel .image img {
    object-fit: contain;
    background: #fff;
}

/* Login */
.login-logo-image {
    display: block;
    max-width: 100%;
    max-height: 72px;
    margin: 0 auto 0.5rem;
}

/* Dashboard */
.welcome-text {
    font-size: 20px;
}

.welcome-text .welcome-user {
    font-size: 24px;
    font-weight: 600;
}

/* Back / Save row under the page title, and the actions of a record view. */
.template-page-actions,
.template-detail-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.template-page-form .row > [class*="col-"] > .form-group:last-child {
    margin-bottom: 1rem;
}

/* Customer create page, from the template's employee create page. */
.customer-create-type .form-check-label {
    white-space: nowrap;
}

.customer-create-default {
    position: absolute;
    top: -20px;
    left: 1.5rem;
    cursor: pointer;
}

.customer-quick-create .nav-pills .nav-link {
    color: #6c757d;
    cursor: pointer;
    transition:
        background 0.3s ease,
        color 0.3s ease;
}

.customer-quick-create .nav-pills .nav-link.active,
.customer-quick-create .nav-pills .nav-link:hover {
    background: #fff;
    color: #4077f2;
    border-radius: 5px;
}

.customer-quick-create .nav-pills .nav-link.active i.fa-circle::before {
    content: "\f058"; /* fa-check-circle */
}

.customer-quick-create .quick-create {
    flex: 1;
}
.customer-quick-create .bs-stepper-line {
    flex: 1 1 100%;
}

@media (max-width: 768px) {
    .customer-quick-create .nav {
        flex-direction: column !important;
        align-items: center !important;
    }
    .customer-quick-create .nav-item {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    .customer-quick-create .bs-stepper-line {
        display: none;
    }
}

.customer-id-card-image {
    display: block;
    width: 80%;
    height: 150px;
    margin: 30px auto 0;
    object-fit: cover;
    cursor: pointer;
}

.customer-id-card-empty {
    display: flex;
    width: 80%;
    margin: 30px auto 0;
    cursor: pointer;
}

.customer-id-card-empty.d-none {
    display: none !important;
}

/* Form sections, from the template's full employee create page. */
.template-form-section {
    width: 100%;
}

.template-page-form .bs-stepper-content > .template-form-section:first-child {
    margin-top: 1rem;
}

.template-form-section-title {
    display: flex;
    align-items: center;
}

.template-form-section > .template-form-content > :first-child {
    margin-top: 0;
}

/* Data lists: entity lists may lead with Action; transaction and report lists place it last. */
.data-list-links .btn.btn-xs,
.data-list-actions .btn.btn-xs {
    padding: 0.125rem 0.25rem;
    font-size: 0.75rem;
    line-height: 1.5;
    border-radius: 0.15rem;
}

.data-list-actions > .dropdown-toggle.btn-xs {
    width: 40px;
}

.data-list-inline-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.data-list-inline-actions .mx-1 {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

.data-list-inline-actions form {
    display: inline-flex;
    margin: 0;
}

th.hero_action {
    width: 4%;
    padding-left: 0 !important;
    padding-right: 0 !important;
    text-align: center !important;
}

th.data-list-links:not(.hero_action) {
    width: 100px;
    text-align: center;
}

th.hero_action.dt-orderable-asc span.dt-column-order,
th.hero_action.dt-orderable-desc span.dt-column-order {
    display: none;
}

.data-list-actions .dropdown-menu {
    min-width: 0;
    white-space: nowrap;
}

.data-list-actions .btn_dropdown form {
    display: inline;
}

@media screen and (max-width: 440px) {
    .data-list-actions .btn_dropdown {
        display: inline-grid;
    }
    .table-responsive.text-nowrap {
        min-height: 350px;
    }
}

/* The per-column "Search" row under the header. */
table.data-list thead tr.filters th {
    padding-left: 1vw !important;
    padding-right: 1vw !important;
    border-bottom: 1px solid gainsboro;
}

table.data-list thead tr.filters input[type="text"] {
    width: 100%;
    min-width: 60px;
    border: 1px solid rgb(235, 235, 235);
    border-radius: 3px;
    font-weight: 400;
}

table.data-list thead tr.filters input[type="text"]:focus {
    outline: none;
}

table.data-list .user-block .username,
table.data-list .user-block .description {
    white-space: nowrap;
}

.data-list-links {
    white-space: nowrap;
}

.data-list-footer .pagination {
    margin-bottom: 0;
}

.template-detail-row {
    cursor: pointer;
}

.template-detail-row:focus-visible {
    outline: 2px solid #007bff;
}

/* Record view: read-only values drawn as template form controls. */
.template-detail-value {
    height: auto;
    min-height: calc(2.25rem + 2px);
    background: #fff;
}

.template-detail-fields {
    display: grid;
    grid-template-columns: 33.333333% minmax(0, 1fr);
    row-gap: 1rem;
    margin: 0;
}

.template-detail-fields > dt {
    padding: 0.375rem 0.75rem 0.375rem 0;
    margin: 0;
    font-weight: 400;
    color: #495057;
}

.template-detail-fields > dd,
.template-detail-panel dd {
    min-height: calc(2.25rem + 2px);
    padding: 0.375rem 0.75rem;
    margin: 0;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    background: #fff;
    overflow-wrap: anywhere;
}

.template-detail-panel {
    margin: 0;
}

.template-detail-panel > div {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 1rem;
}

.template-detail-panel > div:last-child {
    margin-bottom: 0;
}

.template-detail-panel dt {
    width: 33.333333%;
    margin: 0;
    font-weight: 400;
}

.template-detail-panel dd {
    width: 66.666667%;
}

.template-detail-content > :first-child,
.template-form-content > :first-child {
    margin-top: 1rem;
}

@media (max-width: 575.98px) {
    .template-detail-fields {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 0.25rem;
    }

    .template-detail-fields > dt {
        padding-bottom: 0;
    }
}

/* Record profile (x-template-profile), from the template's Employee Profile page. */
.template-profile table.view td {
    width: 50% !important;
    border: 0.7px solid gray !important;
    padding: 0.5rem !important;
}

.template-profile .description-block {
    border: 0.7px solid gray !important;
}

/* Record analysis, from the template's Employee Analysis page (wrapped in .record-analysis). */
.record-analysis {
    --radius: 10px;
}

.record-analysis .filter-card .form-group {
    margin-bottom: 0;
}
.record-analysis .filter-card .card-body {
    padding: 1rem;
}

.record-analysis .meta {
    font-size: 14px;
    color: #888;
}
.record-analysis .title {
    font-size: 16px;
}

.record-analysis .profile-card {
    border: none;
    border-radius: var(--radius) !important;
}

.record-analysis .btn-light-custom {
    background-color: #efeeeeff;
}

.record-analysis .stat-col {
    width: 100%;
    padding-right: 7.5px;
    padding-left: 7.5px;
    box-sizing: border-box;
}

@media (min-width: 650px) {
    .record-analysis .stat-col {
        width: 33.3333%;
    }
}

@media (min-width: 1450px) {
    .record-analysis .stat-col {
        width: 16.6667%;
    }
}

.record-analysis .stat-card {
    border: none;
    border-radius: var(--radius) !important;
    background: #fff;
    height: 100%;
}

.record-analysis .stat-card .card-body {
    padding: 14px 16px;
}

.record-analysis .stat-card .card-footer {
    background-color: #fff;
    border-radius: var(--radius) !important;
}

.record-analysis .stat-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.record-analysis .stat-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}
.record-analysis .stat-sub {
    font-size: 14px;
    color: #aaa;
}
.record-analysis .stat-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
}
.record-analysis .stat-label {
    color: #aaa;
    font-size: 16px;
}
.record-analysis .stat-line {
    font-size: 14px;
}
.record-analysis .view-link {
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
}
.record-analysis .view-link:hover {
    text-decoration: underline;
}

.record-analysis .icon-perf {
    background: linear-gradient(
        180deg,
        #5c65e4 0%,
        rgba(99, 97, 224, 0.6) 100%
    );
    color: #fff;
}
.record-analysis .icon-att {
    background: #4077f2;
    color: #fff;
}
.record-analysis .icon-late {
    background: #ff0000;
    color: #fff;
}
.record-analysis .icon-leave {
    background: #f0b800;
    color: #fff;
}
.record-analysis .icon-ot,
.record-analysis .icon-pay {
    background: #35c870;
    color: #fff;
}

.record-analysis .gradient-text {
    display: inline-block;
    background: linear-gradient(
        180deg,
        #5c65e4 0%,
        rgba(99, 97, 224, 0.6) 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Hover breakdown, from the template's leave-type popover. */
.record-analysis .leave-used-wrap {
    position: relative;
    cursor: pointer;
}

.record-analysis .leave-popover {
    display: none;
    position: absolute;
    left: calc(100% + 12px);
    z-index: 9999;
    min-width: 190px;
    padding: 10px 0 6px;
    border-radius: 10px;
    background: #333;
    color: #fff;
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.14),
        0 2px 6px rgba(0, 0, 0, 0.08);
    pointer-events: none;
}

.record-analysis .leave-popover::after {
    content: "";
    position: absolute;
    top: 12px;
    left: -14px;
    border: 7px solid transparent;
    border-right-color: #333;
}

.record-analysis .leave-used-wrap:hover .leave-popover {
    display: block;
}

.record-analysis .lp-header {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0 14px 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid #f0f0f0;
}

.record-analysis .lp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 14px;
}
.record-analysis .lp-name {
    font-size: 12px;
    max-width: 120px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.record-analysis .lp-used {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.record-analysis .lp-empty {
    font-size: 12px;
    color: #bbb;
    padding: 4px 14px;
}

/* Chart cards */
.record-analysis .analysis-card {
    border: none;
    border-radius: var(--radius) !important;
    background: #fff;
}

.record-analysis .analysis-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius) var(--radius) 0 0;
    background: #5fa6d3;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.record-analysis .analysis-card .card-header .view-full {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}
.record-analysis .analysis-card .card-header .view-full:hover {
    color: #fff;
}
.record-analysis .analysis-card .chart-wrap {
    position: relative;
    height: 220px;
    padding: 10px;
}

/* Org chart list */
.record-analysis .org-wrap {
    padding: 16px;
}

.record-analysis .org-node {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 6px;
    border: 1px solid #e8ecf3;
    border-radius: 8px;
    background: #f8f9fc;
    color: inherit;
    opacity: 0;
    transform: translateX(-24px);
    transition:
        opacity 0.35s ease,
        transform 0.35s ease,
        border-color 0.15s;
}

.record-analysis .org-node.visible {
    opacity: 1;
    transform: translateX(0);
}
.record-analysis a.org-node:hover,
.record-analysis .org-node.active {
    border-color: var(--primary);
    text-decoration: none;
}
.record-analysis .org-node.level-1 {
    margin-left: 24px;
}
.record-analysis .org-node.level-2 {
    margin-left: 48px;
}

.record-analysis .org-node img,
.record-analysis .org-node .org-avatar {
    width: 34px;
    height: 34px;
    border: 2px solid #fff;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.record-analysis .org-node .org-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #5fa6d3;
    color: #fff;
    font-size: 14px;
}

.record-analysis .org-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 1px;
}
.record-analysis .org-role {
    font-size: 12px;
    color: #888;
}

@keyframes record-analysis-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.record-analysis .fade-in {
    opacity: 0;
    animation: record-analysis-fade-in 2s ease-in forwards;
}

/* Role permission matrix, from the template's role page. */
.template-role-module .card-header label {
    color: #26619c;
}

/* Settings */
.setting-image-preview {
    max-width: 220px;
    max-height: 80px;
    padding: 0.25rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    background-color: #f8f9fa;
}

/* The printed invoice drops the admin chrome. */
@media print {
    .template-page-actions,
    .content-header .breadcrumb {
        display: none !important;
    }
}

/* Global links: keep link text clean across AdminLTE/Bootstrap views. */
a,
a:hover,
a:focus,
a:active,
.btn-link,
.btn-link:hover,
.btn-link:focus,
.btn-link:active {
    text-decoration: none !important;
}

/* Header profile: override cloned navbar span hover underline. */
#navbar .user-menu > .nav-link span,
#navbar .user-menu > .nav-link span:hover,
#navbar .user-menu > .nav-link:focus span,
#navbar .user-menu > .nav-link:active span {
    text-decoration: none !important;
}
