/* Custom styles to match Yii2 components with Velzon template */

/* GridView Styles */
.grid-view {
    max-width: 100%;
    margin-bottom: 1rem;
}

.grid-view .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.grid-view table.table {
    margin-bottom: 0 !important;
    width: 100%;
}

.grid-view table.table thead th {
    background-color: var(--vz-primary) !important;
    border-bottom: 1px solid #e9ebec;
    color: #fff !important;
    text-transform: uppercase;
    font-size: 13px;
    font-weight: 600;
    position: relative;
    vertical-align: middle;
}

.grid-view table.table thead th a,
.grid-view table.table thead th {
    color: #fff !important;
}

.grid-view table.table thead th a {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Sorting Icons */
.grid-view table.table thead th.sortable a {
    position: relative;
    padding-right: 20px !important;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    min-height: 1.2rem;
}

.grid-view table.table thead th.sortable a:before,
.grid-view table.table thead th.sortable a:after {
    position: absolute;
    right: 0;
    font-size: 0.8rem;
    font-family: "Material Design Icons";
    opacity: 0.3;
    color: #fff !important;
    line-height: 1;
}

.grid-view table.table thead th.sortable a:before {
    content: "\f0360";
    top: 3px;
}

.grid-view table.table thead th.sortable a:after {
    content: "\f035d";
    top: 11px;
}

.grid-view table.table thead th.asc a:before {
    opacity: 1;
}

.grid-view table.table thead th.desc a:after {
    opacity: 1;
}

.grid-view .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(64, 81, 137, 0.02);
}

.grid-view .table-bordered td, .grid-view .table-bordered th {
    border: 1px solid #e9ebec;
}

.grid-view .pagination {
    justify-content: flex-end;
    margin-top: 20px;
}

.grid-view .pagination > li > a, .grid-view .pagination > li > span {
    border-radius: 4px;
    margin: 0 2px;
    color: #405189;
    border: 1px solid #e9ebec;
}

.grid-view .pagination > .active > a, .grid-view .pagination > .active > span {
    background-color: #405189;
    border-color: #405189;
    color: #fff;
}

/* DetailView Styles */
.detail-view.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(64, 81, 137, 0.02);
}

.detail-view th {
    width: 25%;
    color: #878a99;
    font-weight: 600;
    background-color: #f3f6f9;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #343a40;
}

/* Ensure spacing for submit buttons and search buttons in forms */
.form-group:last-child,
.form-group:has(button[type="submit"]),
.form-group:has(.btn-primary),
.form-group:has(.btn-success) {
    margin-top: 1rem;
}

/* Checkbox and Radio styling improvements */
.form-check {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.form-check-input {
    margin-top: 0;
    margin-right: 0.5rem;
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    margin-bottom: 0;
}

/* Advanced search form specific spacing */
.search-form {
    margin-top: 15px;
    margin-bottom: 15px;
}

.search-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.search-button i {
    transition: transform 0.3s ease;
    font-size: 1.1rem;
}

.search-button.active i {
    transform: rotate(180deg);
}

.help-block-error {
    color: #f06548;
    font-size: 12px;
    margin-top: 4px;
}

/* Card overrides for index pages - Removing custom card styles as we now use standard Velzon card classes */
.user-index, .role-index, .action-index, .permission-index, .system-log-index, .system-usage-log-index,
.user-create, .role-create, .action-create, .permission-create,
.user-update, .role-update, .action-update, .permission-update,
.user-view, .role-view, .action-view, .permission-view, .system-usage-log-view {
    /* Styles removed to avoid conflict with .card class */
}

/* Breadcrumb overrides */
.breadcrumb-item + .breadcrumb-item::before {
    content: "\F0142"; /* ri-arrow-right-s-line from remixicon if available, otherwise standard */
    font-family: 'remixicon' !important;
    vertical-align: middle;
}

[data-layout=horizontal] div.container-fluid,
[data-layout=horizontal] .layout-width
{
    max-width: 100%; !important;
    margin: 0 auto;
}

/* ============================================================
   Horizontal layout mobile menu: ensure dark background and visible text
   when hamburger menu is open (body.menu class added by app.js)
   ============================================================ */
body.menu .navbar-menu {
    background: var(--vz-vertical-menu-bg) !important;
    top: 70px !important;
    margin-top: 0 !important;
}

body.menu .navbar-menu .navbar-nav .nav-link {
    color: var(--vz-vertical-menu-item-color) !important;
}

body.menu .navbar-menu .navbar-nav .nav-link:hover,
body.menu .navbar-menu .navbar-nav .nav-link.active {
    color: var(--vz-vertical-menu-item-active-color) !important;
}

body.menu .navbar-menu .navbar-nav .nav-sm .nav-link {
    color: var(--vz-vertical-menu-sub-item-color) !important;
}

body.menu .navbar-menu .navbar-nav .nav-sm .nav-link:hover,
body.menu .navbar-menu .navbar-nav .nav-sm .nav-link.active {
    color: var(--vz-vertical-menu-sub-item-active-color) !important;
}

body.menu .navbar-menu .menu-title span {
    color: var(--vz-vertical-menu-title-color) !important;
}

body.menu .menu-dropdown {
    background-color: var(--vz-vertical-menu-bg) !important;
}


/* ============================================================
   Horizontal desktop menu: fix submenu misalignment on window resize/move.
   Force left:0 so the dropdown always aligns to its parent nav-item,
   regardless of window position or scroll state.
   ============================================================ */
@media (min-width: 1024.1px) {
    [data-layout=horizontal] .navbar-nav > .nav-item {
        position: relative;
    }
    [data-layout=horizontal] .navbar-nav > .nav-item > .menu-dropdown {
        position: absolute;
        top: 100%;
        left: 0;
        right: auto;
    }
}

/* ============================================================
   Mobile overrides (max-width: 1024px) — applies when horizontal menu is collapsed
   ============================================================ */
@media (max-width: 1024px) {

    /* 0. Force hamburger button visible (template hides it for horizontal layout) */
    .topnav-hamburger {
        visibility: visible !important;
        display: flex !important;
    }

    /* 1. Replace animated hamburger icon with traditional 3-line icon.
       Disable all rotation — the icon stays static regardless of open/closed state. */
    .topnav-hamburger .hamburger-icon {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: flex-start !important;
        gap: 5px !important;
        width: 22px !important;
        height: 22px !important;
        transform: none !important;
        transition: none !important;
    }

    .topnav-hamburger .hamburger-icon.open {
        transform: none !important;
    }

    .topnav-hamburger .hamburger-icon span {
        display: block !important;
        width: 100% !important;
        height: 2px !important;
        background-color: #fff !important;
        border-radius: 2px !important;
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        position: static !important;
        top: auto !important;
    }

    /* 2. Center the logo in the topbar */
    .navbar-header {
        position: relative !important;
    }

    .navbar-header .navbar-brand-box.horizontal-logo {
        display: block !important;
        position: absolute !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        margin: 0 !important;
        width: auto !important;
        z-index: 2 !important;
    }

    /* 5. Hide the user dropdown container in mobile mode */
    .topbar-user {
        display: none !important;
    }

    /* 4. Remove only horizontal padding from the main content container on mobile, keep top margin */
    .page-content {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .page-content > .container-fluid {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

@media (max-width: 1200px) {
    .topbar-user {
        background-color: transparent !important;
    }
}
