/* IBS Modern Light Theme — overrides on top of YNEX/Bootstrap */

:root {
    --primary-rgb: 79, 110, 247;
    --secondary-rgb: 99, 179, 237;
    --body-bg-rgb: 244, 247, 250;
    --default-border: #e8ecf3;
    --bootstrap-card-border: #e8ecf3;
    --input-border: #dce3ef;
    --list-hover-focus-bg: #f0f4fb;
    --text-muted: #6b7a90;
    --ibs-card-radius: 12px;
    --ibs-input-radius: 8px;
    --ibs-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
    --ibs-shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);

    /* Cairo everywhere — override YNEX + Bootstrap font tokens */
    --default-font-family: "Cairo", sans-serif;
    --bs-font-sans-serif: "Cairo", sans-serif;
    --bs-body-font-family: "Cairo", sans-serif;
}

/* Project-wide Cairo typography (text UI; icon fonts keep their own families) */
html {
    font-family: "Cairo", sans-serif;
}

body,
button,
input,
optgroup,
select,
textarea,
.form-control,
.form-select,
.btn,
.dropdown-menu,
.dropdown-item,
.modal-content,
.modal-title,
.table,
.card,
.card-title,
.card-body,
.alert,
.badge,
.breadcrumb,
.breadcrumb-item,
.pagination,
.page-link,
.nav,
.list-group-item,
.tooltip,
.popover,
.popover-body,
.popover-header,
.page-title,
.page-header-breadcrumb,
.authentication,
.app-header,
.app-sidebar,
.main-content,
.footer,
.swal2-popup,
.swal2-title,
.swal2-html-container,
.swal2-input,
.swal2-actions button,
#blazor-error-ui,
.validation-message,
.ibs-filter-field,
.ibs-filter-title,
.ibs-badge,
.ibs-empty-state,
.ibs-loading-state,
.select2-container,
.fc {
    font-family: "Cairo", sans-serif;
}

html, body {
    background-color: rgb(var(--body-bg-rgb));
}

/* Cards */
.custom-card {
    border-radius: var(--ibs-card-radius) !important;
    border-color: var(--default-border) !important;
    box-shadow: var(--ibs-shadow-sm);
}

.custom-card .card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--default-border);
    padding: 1.25rem 1.5rem;
}

.custom-card .card-body {
    padding: 1.25rem 1.5rem;
}

/* Forms */
.form-control,
.form-select {
    border-radius: var(--ibs-input-radius);
    border-color: var(--input-border);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(var(--primary-rgb), 0.5);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.12);
}

/* Buttons */
.btn {
    border-radius: var(--ibs-input-radius);
    font-weight: 500;
}

.btn-wave {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-wave:hover:not(:disabled) {
    transform: translateY(-1px);
}

/* Page shell */
.ibs-page-shell {
    padding-bottom: 1.5rem;
}

.page-header-breadcrumb {
    margin-bottom: 0.5rem !important;
}

.page-title {
    color: #1e293b;
    letter-spacing: -0.02em;
}

.breadcrumb-item a {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: rgb(var(--primary-rgb));
}

/* Filter grid */
.ibs-filter-section {
    width: 100%;
    margin-bottom: 0.5rem;
}

.ibs-filter-title {
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #334155;
}

.ibs-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    width: 100%;
}

.ibs-filter-field {
    min-width: 0;
}

.ibs-filter-field .form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.35rem;
}

/* Action bar */
.ibs-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    align-items: center;
    width: 100%;
    padding-top: 0.75rem;
    border-top: 1px solid var(--default-border);
    margin-top: 0.75rem;
}

.ibs-btn-fixed {
    min-width: 7.5rem;
}

.ibs-btn-wide {
    min-width: 9.5rem;
}

/* Data tables */
.ibs-data-table-wrap {
    border-radius: var(--ibs-input-radius);
    overflow: hidden;
    border: 1px solid var(--default-border);
}

.ibs-data-table {
    margin-bottom: 0 !important;
}

.ibs-data-table thead th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.8125rem;
    text-align: center;
    vertical-align: middle;
    border-color: var(--default-border);
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
    padding: 0.75rem 0.625rem;
}

.ibs-data-table tbody td {
    text-align: center;
    vertical-align: middle;
    padding: 0.625rem;
    font-size: 0.875rem;
    color: #334155;
    border-color: var(--default-border);
}

.ibs-data-table tbody tr:nth-child(even) {
    background-color: #fafbfd;
}

.ibs-data-table tbody tr:hover {
    background-color: var(--list-hover-focus-bg);
}

.ibs-text-start {
    text-align: start !important;
}

.ibs-text-center {
    text-align: center !important;
}

.ibs-empty-row td {
    padding: 2.5rem 1rem !important;
    color: var(--text-muted);
    background-color: #fafbfd !important;
}

/* Status badges */
.ibs-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.ibs-badge-success {
    background-color: rgba(38, 191, 148, 0.12);
    color: #0d9668;
}

.ibs-badge-danger {
    background-color: rgba(230, 83, 60, 0.12);
    color: #c0392b;
}

.ibs-badge-warning {
    background-color: rgba(245, 184, 73, 0.15);
    color: #b45309;
}

.ibs-badge-info {
    background-color: rgba(var(--primary-rgb), 0.12);
    color: rgb(var(--primary-rgb));
}

.ibs-badge-neutral {
    background-color: #f1f5f9;
    color: #64748b;
}

/* Loading & empty states */
.ibs-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 1rem;
    gap: 1rem;
    color: var(--text-muted);
}

.ibs-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    gap: 0.75rem;
    color: var(--text-muted);
}

.ibs-empty-state i {
    font-size: 2.5rem;
    opacity: 0.4;
}

/* Header */
.app-header {
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    border-bottom: 1px solid var(--default-border);
}

.header-profile-dropdown .dropdown-item {
    border-radius: 6px;
    margin: 0.125rem 0.5rem;
    padding: 0.5rem 0.75rem;
}

.header-profile-dropdown .dropdown-item:hover {
    background-color: var(--list-hover-focus-bg);
}

/* Sidebar */
.app-sidebar .side-menu__item.active,
.app-sidebar .side-menu__item:hover {
    background-color: rgba(var(--primary-rgb), 0.08) !important;
    color: rgb(var(--primary-rgb)) !important;
}

.app-sidebar .side-menu__item.active .side-menu__icon,
.app-sidebar .side-menu__item:hover .side-menu__icon {
    color: rgb(var(--primary-rgb)) !important;
    fill: rgb(var(--primary-rgb)) !important;
}

.app-sidebar .category-name {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 0.75rem 1rem 0.375rem;
}

/* Footer */
.footer {
    border-top: 1px solid var(--default-border);
    background-color: #fff !important;
    font-size: 0.8125rem;
}

/* Auth pages */
.authentication .custom-card {
    box-shadow: var(--ibs-shadow-md);
}

.authentication .auth-logo {
    height: 6rem;
    width: 6rem;
    object-fit: contain;
}

.ibs-validation-message {
    text-align: start;
    margin-top: 0.25rem;
}

.ibs-btn-full {
    width: 100%;
}

/* Modals */
.modal-content {
    border-radius: var(--ibs-card-radius);
    border: 1px solid var(--default-border);
    box-shadow: var(--ibs-shadow-md);
}

.modal-header {
    border-bottom-color: var(--default-border);
    padding: 1rem 1.25rem;
}

.modal-footer {
    border-top-color: var(--default-border);
    padding: 0.875rem 1.25rem;
}

/* Card header layout for data pages */
.ibs-card-header-content {
    width: 100%;
}

/* Pagination */
.ibs-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    justify-content: center;
    padding: 1rem 0 0;
}

.ibs-pagination .page-link {
    border-radius: 6px;
    min-width: 2.25rem;
    text-align: center;
}

/* Wizard steps */
.ibs-wizard-card .card-body {
    padding: 1.5rem;
}

/* Legacy page button classes mapped to theme */
.adduser,
.syncuser,
.activeuser {
    min-width: 9.5rem;
}

.ibs-icon-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: center;
}

.ibs-card-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.ibs-card-section-title .bi {
    font-size: 1.25rem;
}

.ibs-section-info { color: #0dcaf0; }
.ibs-section-network { color: #6610f2; }
.ibs-section-status { color: #26bf94; }
.ibs-section-primary { color: #0b57d0; }
.ibs-section-finance { color: #198754; }
.ibs-section-receipt { color: #712cf9; }

.ibs-form-inset {
    padding-left: 0.625rem;
    padding-right: 0.625rem;
}

.ibs-input-narrow {
    max-width: 12.5rem;
}

.ibs-input-medium {
    max-width: 16rem;
}

.ibs-input-wide {
    max-width: 25rem;
}

.ibs-summary-cell {
    font-size: 1.05rem;
}

.ibs-waiting-message {
    margin-top: 0.625rem;
    margin-bottom: 0.625rem;
    text-align: center;
    color: #d2691e;
}

.ibs-modal-rounded {
    border-radius: 1rem;
    overflow: hidden;
}

.ibs-modal-icon-lg {
    font-size: 4rem;
}

.ibs-qr-spinner {
    width: 3rem;
    height: 3rem;
}

@media (max-width: 768px) {
    .ibs-filter-grid {
        grid-template-columns: 1fr;
    }

    .ibs-action-bar .btn {
        flex: 1 1 auto;
        min-width: calc(50% - 0.5rem);
    }

    .ibs-btn-fixed,
    .ibs-btn-wide {
        min-width: unset;
        width: 100%;
    }
}
