/* Copied from Sga/wwwroot/css/site.css to match styling */
html {
    font-size: 14px;
}

@media (min-width:768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0000.1rem white,0000.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Modern small controls and switch styles (scoped) */
.form-sm .form-control, .form-control-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
}

.badge-compact {
    font-size: 0.75rem;
    padding: 0.25rem 0.45rem;
    border-radius: 0.5rem;
}

/* Dual-list styles */
.dual-list .form-select {
    height: 320px;
    min-height: 200px;
    font-size: 0.9rem;
}

.dual-list .btn {
    min-width: 48px;
}

/* Modern switch */
.switch {
    --switch-width: 40px;
    --switch-height: 22px;
    position: relative;
    display: inline-block;
    width: var(--switch-width);
    height: var(--switch-height);
}

    .switch input {
        display: none;
    }

    .switch .track {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #e9ecef;
        border-radius: 999px;
        transition: background .2s ease;
        box-shadow: inset01px2px rgba(0,0,0,0.06);
    }

    .switch .thumb {
        position: absolute;
        top: 2px;
        left: 2px;
        width: calc(var(--switch-height) -4px);
        height: calc(var(--switch-height) -4px);
        background: #fff;
        border-radius: 50%;
        transition: transform .18s ease, box-shadow .18s ease;
        box-shadow: 02px6px rgba(0,0,0,0.12);
    }

    .switch input:checked + .track {
        background: #0d6efd;
    }

        .switch input:checked + .track .thumb {
            transform: translateX(calc(var(--switch-width) - var(--switch-height)));
        }

    /* small switch variant */
    .switch.switch-sm {
        --switch-width: 34px;
        --switch-height: 18px;
    }

        .switch.switch-sm .thumb {
            box-shadow: 01px4px rgba(0,0,0,0.12);
        }

/* Align label with switch */
.switch-label {
    margin-left: 0.5rem;
    font-size: 0.95rem;
}

/* make checkbox visually hidden but keyboard accessible (fallback) */
.form-check-input.switch-input {
    position: absolute;
    left: -9999px;
}

/* Responsive tweaks */
@media (max-width:576px) {
    .dual-list .form-select {
        height: 220px;
    }
}

/* Modern table/card styles */
.modern-card {
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 02px8px rgba(16,24,40,0.04);
}

    .modern-card .card-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: linear-gradient(180deg, #ffffff, #fbfbfc);
        padding: 1rem1.25rem;
        border-bottom: 1px solid rgba(0,0,0,0.04);
    }

    .modern-card .card-title {
        margin: 0;
        font-weight: 600;
        color: #1f2937;
    }

.modern-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

    .modern-table thead th {
        background: transparent;
        border-bottom: 2px solid rgba(0,0,0,0.06);
        font-weight: 600;
        color: #374151;
        padding: 0.9rem1rem;
    }

    .modern-table tbody td {
        padding: 0.9rem1rem;
        vertical-align: middle;
    }

    .modern-table tbody tr {
        background: #fff;
    }

        .modern-table tbody tr + tr {
            border-top: 1px solid rgba(0,0,0,0.03);
        }

        .modern-table tbody tr:hover {
            background: linear-gradient(90deg, #ffffff, #f8fafc);
        }

/* Avatar placeholder */
.table-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    vertical-align: middle;
    background: linear-gradient(135deg,#eef2ff,#f7f7fb);
    color: #374151;
    font-weight: 700;
}

.table-name {
    display: block;
    font-weight: 600;
    color: #111827;
}

.table-sub {
    display: block;
    font-size: 0.85rem;
    color: #6b7280;
}

/* Status badges */
.badge-status {
    padding: 0.35rem0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    color: #fff;
    display: inline-block;
}

    .badge-status.active {
        background: #10b981;
    }
    /* green */
    .badge-status.pending {
        background: #f59e0b;
    }
    /* amber */
    .badge-status.held {
        background: #06b6d4;
    }
    /* cyan */
    .badge-status.inprogress {
        background: #ef4444;
    }
/* red */

/* Compact badge used for lots */
.badge-compact {
    background: #6b7280;
    color: #fff;
    padding: 0.25rem0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
}

/* Search box with icon */
.search-input {
    display: inline-block;
    position: relative;
}

    .search-input input {
        padding-left: 2rem;
        width: 360px;
    }

    .search-input .search-icon {
        position: absolute;
        left: 0.6rem;
        top: 50%;
        transform: translateY(-50%);
    }

/* Pagination modern */
/*.pagination .page-item .page-link {
    border-radius: 8px;
    margin: 03px;
}

.pagination .page-item.active .page-link {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}*/

/* Buttons rounded */
.btn-primary, .btn-secondary, .btn-info {
    border-radius: 6px;
}

/* adjust avatar and name spacing */
.table-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #1f2937;
    font-weight: 700;
}

/* Card header smaller */
.modern-card .card-header {
    padding: 1rem1.25rem;
}

.modern-card .card-title {
    margin: 0;
    font-weight: 600;
}

/* Lots as subtle pills */
.badge-compact {
    background: #6b7280;
    color: #fff;
    padding: 0.25rem0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
}

/* Status pill */
.badge-status {
    display: inline-block;
    padding: 0.35rem0.75rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.75rem;
    color: #065f46;
    background: #ecfdf5;
}

    .badge-status.pending {
        color: #7c2d12;
        background: #fff7ed;
    }

/* responsive tweaks */
@media (max-width:768px) {
    .owners-table colgroup col:nth-child(3), .owners-table thead th:nth-child(3), .owners-table tbody td:nth-child(3) {
        display: none;
    }
}

/* Modern small switch inline */
.switch {
    --switch-width: 38px;
    --switch-height: 22px;
    position: relative;
    display: inline-block;
    width: var(--switch-width);
    height: var(--switch-height);
}

    .switch input {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
    }

    .switch .track {
        position: absolute;
        inset: 0;
        background: #e6e9ef;
        border-radius: 999px;
        transition: background .18s ease;
    }

    .switch .thumb {
        position: absolute;
        top: 2px;
        left: 2px;
        width: calc(var(--switch-height) -4px);
        height: calc(var(--switch-height) -4px);
        background: #fff;
        border-radius: 50%;
        box-shadow: 02px6px rgba(16,24,40,0.08);
        transition: transform .18s ease;
    }

    .switch input:checked + .track {
        background: #10b981;
    }

        .switch input:checked + .track .thumb {
            transform: translateX(calc(var(--switch-width) - var(--switch-height)));
        }

.switch-sm {
    --switch-width: 32px;
    --switch-height: 18px;
}

/* Keep visual alignment inside action cell */
.owners-table tbody td .switch {
    margin-left: 6px;
}

/* small tweak: action btn sizes */
.btn-action {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
}

    .btn-action i {
        font-size: 16px;
    }
/* Compact modern adjustments */
.modern-card.compact {
    border-radius: 10px;
}

.compact .card-header {
    padding: 0.75rem1rem;
}

.compact .p-2 {
    padding: 0.5rem;
}

.compact-table thead th {
    padding: 0.6rem0.9rem;
}

.compact-table tbody td {
    padding: 0.55rem0.9rem;
}

.entries-info {
    font-size: 0.85rem;
}

/* Page blue background for content sections */
.page-content {
    background: linear-gradient(180deg, #e9f7ff0%, #f7fbff100%);
    min-height: 80vh;
    padding-top: 4rem !important;
    margin-top: 6rem !important;
}

/* Avatar initials (used in owners index) */
.avatar-initial {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #0d6efd;
    color: #fff;
    font-weight: 600;
    font-size: 0.7rem;
}

@media (max-width:576px) {
    .avatar-initial {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
}

/* Ensure small page-size selector width (owners page) */
#pageSizeSel {
    width: 72px;
}

/* Search input adjustments for owners page */
.search-input {
    display: inline-flex;
    align-items: center;
    position: relative;
}

    .search-input input {
        padding-left: 1rem;
        padding-right: 3rem; /* extra space for clear button */
        width: 480px;
    }

    .search-input .search-clear {
        position: absolute;
        right: 8px; /* move to very end */
        width: 28px;
        height: 28px;
        border-radius: 999px;
        display: none;
        padding: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 5;
        font-size: 16px;
        line-height: 28px;
        text-align: center;
    }

    .search-input .search-icon {
        position: absolute;
        right: 44px;
        top: 50%;
        transform: translateY(-50%);
        color: #9aa0ab;
        pointer-events: none;
    }

/* Theme toggle small button styling */
#themeToggleBtn {
    padding: 4px6px;
    font-size: 12px;
}

/* Header / layout fixes for centered logo and centered bold menu */
#page-topbar {
    position: fixed; /* keep header visible */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* Default background color (será sobrescrito por el inline style) */
#page-topbar:not([style*="background-color"]) {
    background-color: #2a3042;
}

/* When dark theme is active, only apply if no inline style is set */
html[data-bs-theme="dark"] #page-topbar:not([style*="background-color"]) {
    background-color: #0f1724; /* dark slate */
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

/* Keep navbar-brand centered but not overlapping when header is fixed */
#page-topbar .navbar-brand-box {
    position: absolute;
    /*transform: translateY(-55%);*/
    z-index: 1060;
    pointer-events: none;
    text-align: center;
}

    #page-topbar .navbar-brand-box .logo img {
        max-height: 84px;
        width: auto;
        display: block;
        margin: 0 auto;
        pointer-events: auto;
    }

/* Reduce overlap on smaller screens */
@media (max-width:768px) {
    .topnav {
        margin-top: 120px; /* allow for wrapped header on small devices */
    }

    #page-topbar .navbar-brand-box {
        position: relative;
        left: auto;
        transform: none;
        margin: 0 auto0.25rem;
        pointer-events: auto;
    }
}

/* If logo image cannot be swapped (missing dark variant) apply invert filter in dark mode as graceful fallback */
html[data-bs-theme="dark"] #page-topbar .navbar-brand-box .logo img[data-fallback-invert="true"] {
    filter: invert(1) hue-rotate(180deg) saturate(120%);
}

/* Fix: ensure topnav dropdown menus always render above page content */
.topnav {
    z-index: 1040 !important;
}

/* Cards de colores PDF: compactas con efecto hover */
.pdf-color-card {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.pdf-color-card:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}
.pdf-color-card .card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.7rem;
}
.pdf-color-card .card-body {
    border-top: none;
}

/* Dashboard KPI cards: icon, title, value, hover effect */
.dashboard-kpi-card {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    border-radius: 10px;
    overflow: hidden;
    height: 100%;
}
.dashboard-kpi-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
    transform: translateY(-3px);
}
.dashboard-kpi-card .kpi-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dashboard-kpi-card .kpi-value {
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.2;
}
.dashboard-kpi-card .kpi-link {
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 500;
}
.dashboard-kpi-card .kpi-link:hover {
    text-decoration: underline;
}

/* Tablas del Balance: encabezados centrados y en negrita */
.table-balance thead th {
    text-align: center !important;
    font-weight: 700 !important;
    vertical-align: middle;
    padding: 0.6rem 0.5rem;
}
.table-balance thead th:first-child {
    text-align: left !important;
}
.table-balance tfoot th,
.table-balance tfoot td {
    font-weight: 700;
}
.table-balance tbody td {
    padding: 0.5rem;
    vertical-align: middle;
}
.table-balance tbody td:first-child {
    text-align: left;
    font-weight: 500;
}
.table-balance .text-end {
    text-align: right !important;
}

/* ----- Menú móvil: ocupa la altura disponible y el scroll es interno ----- */
@media (max-width: 991.98px) {
    /* Altura del menú = viewport menos el header (70px); evita scroll de toda la página */
    .topnav {
        max-height: calc(100dvh - 70px);
        max-height: calc(100vh - 70px);
        overflow: hidden;
        display: flex;
    }

    .topnav .container-fluid {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding: 0;
    }

    .topnav .navbar {
        flex: 1;
        min-height: 0;
        display: flex;
        /*flex-direction: column;*/
        padding: 0.5rem 0.75rem;
    }

    .topnav .navbar > div {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* El contenido del menú (enlaces y dropdowns) hace scroll dentro de este bloque */
    .topnav .navbar-collapse,
    .topnav #topnav-menu-content {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding-right: 0.5rem; /* espacio para no tapar texto con el scrollbar */
    }

    .topnav .navbar-nav {
        padding-bottom: 2rem; /* más espacio al final para que el último ítem no quede cortado */
    }

    /* Menú alineado a la izquierda en móvil */
    .topnav .container-fluid,
    .topnav .navbar,
    .topnav .navbar-collapse,
    .topnav #topnav-menu-content,
    .topnav .navbar-nav {
        justify-content: flex-start;
        text-align: left;
    }

    .topnav .nav-link,
    .topnav .dropdown-toggle {
        justify-content: flex-start;
        text-align: left;
    }
}
