/* Estandar visual para botones en todo CGA */
@font-face {
    font-family: 'CGA Inter';
    font-style: normal;
    font-weight: 400;
    src: url('../assets/fonts/inter-regular.woff2') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'CGA Inter';
    font-style: normal;
    font-weight: 700 900;
    src: url('../assets/fonts/inter-bold.woff2') format('woff2');
    font-display: swap;
}

.cga-main-header-bg {
    background-color: #d9eaf0;
}

.cga-main-header-brand {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.cga-main-header-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    min-height: 132px;
    padding: 6px 32px;
}

.cga-main-header-logo {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.cga-main-header-logo img {
    display: block;
    width: auto;
    max-width: min(100%, 600px);
    height: auto;
    max-height: 112px;
    object-fit: contain;
}

.cga-main-header-tagline {
    margin: 0;
    color: #222429;
    font-family: 'CGA Inter', Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.2;
}

.cga-main-header-title {
    color: #041735;
    font-family: 'CGA Inter', Arial, Helvetica, sans-serif;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

@media (max-width: 960px) {
    .cga-main-header-inner {
        min-height: 98px;
        gap: 20px;
        padding-inline: 22px;
    }

    .cga-main-header-logo img {
        max-width: 90px;
        max-height: 90px;
    }

    .cga-main-header-tagline {
        font-size: 12px;
    }

    .cga-main-header-title {
        font-size: clamp(15px, 2.5vw, 22px);
    }
}

@media (max-width: 520px) {
    .cga-main-header-inner {
        min-height: 84px;
    }

    .cga-main-header-logo img {
        max-height: 72px;
    }
}

.cga-page-title {
    align-items: center;
    display: flex;
    gap: 0.45rem;
    justify-content: center;
}

.cga-page-title .cga-page-title-icon {
    flex: 0 0 auto;
    font-size: 0.95em;
    line-height: 1;
}

.btn {
    align-items: center;
    border-radius: 0.375rem;
    display: inline-flex;
    font-weight: 400;
    gap: 0.35rem;
    justify-content: center;
    line-height: 1.2;
    min-height: 38px;
}

button.btn,
a.btn,
.modal .btn,
.modal-footer .btn {
    font-weight: 400 !important;
}

/* Patron global para acciones y desplazamiento en modales. */
.modal-footer {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.modal-footer > * {
    margin: 0 !important;
}

.modal-dialog-scrollable .modal-content > form:not(.modal-content) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.modal-dialog-scrollable .modal-content > form:not(.modal-content) > .modal-header,
.modal-dialog-scrollable .modal-content > form:not(.modal-content) > .modal-footer {
    flex: 0 0 auto;
}

.modal-dialog-scrollable .modal-content > form:not(.modal-content) > .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* Formularios directos cortos: altura natural con limite de ventana. */
.modal-dialog-scrollable.cga-content-fit-modal .modal-content {
	height: auto;
}

.modal-dialog-scrollable.cga-content-fit-modal .modal-content > form:not(.modal-content) {
	flex: 0 1 auto;
	height: auto;
}

.modal-dialog-scrollable.cga-content-fit-modal .modal-content > form:not(.modal-content) > .modal-body {
	flex: 0 1 auto;
}

/* Formularios extensos cargados dentro de un iframe. */
.cga-iframe-form-modal.modal-dialog-scrollable .modal-content {
	height: auto;
	max-height: calc(100vh - (var(--bs-modal-margin, 0.5rem) * 2));
	transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

.cga-iframe-form-modal.cga-modal-measuring .modal-content {
	opacity: 0;
	transform: translateY(-0.75rem) scale(0.985);
	visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.cga-iframe-form-modal.modal-dialog-scrollable .modal-content {
		transition: none;
	}
}

.cga-iframe-form-modal .modal-body {
    display: flex;
	flex: 0 1 auto;
    min-height: 0;
    overflow: hidden;
}

.cga-iframe-form-modal .modal-body > iframe {
    display: block;
	flex: 0 0 auto;
    min-height: 0;
    width: 100%;
}

.cga-iframe-form-modal.cga-modal-tall.modal-dialog-scrollable .modal-content {
	height: calc(100vh - (var(--bs-modal-margin, 0.5rem) * 2));
}

.cga-iframe-form-modal.cga-modal-tall .modal-body {
	flex: 1 1 auto;
}

.cga-iframe-form-modal.cga-modal-tall .modal-body > iframe {
	flex: 1 1 auto;
	height: 100% !important;
}

/* Patron global para visores de documentos y vistas previas. */
.cga-document-modal .modal-content {
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.cga-document-modal .modal-body {
    background: #ffffff;
    box-sizing: border-box;
}

.cga-document-modal .cga-document-frame,
.cga-document-modal iframe {
    display: block;
    max-width: 100%;
}

@media (min-width: 992px) {
    .cga-contract-modal-footer {
        flex-wrap: nowrap;
        gap: 0.4rem;
    }

    .cga-contract-modal-footer .btn {
        flex: 0 1 auto;
        padding-left: 0.65rem;
        padding-right: 0.65rem;
        white-space: nowrap;
    }
}

@media (max-width: 575.98px) {
    .modal-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .modal-footer > .btn,
    .modal-footer > form,
    .modal-footer > form > .btn {
        width: 100%;
    }
}

/* Acciones de formularios cargados dentro de un modal o iframe. */
.cga-modal-actions {
    align-items: center;
    background: #ffffff;
    border-top: 1px solid #dee2e6;
    bottom: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end !important;
    margin-top: 1.5rem !important;
    padding: 0.75rem 0;
    position: sticky;
    z-index: 20;
}

.cga-iframe-actions {
    display: none !important;
}

@media (max-width: 575.98px) {
    .cga-modal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .cga-modal-actions > .btn,
    .cga-modal-actions > a.btn,
    .cga-modal-actions > button.btn {
        width: 100%;
    }
}

/* Fondo unificado para todos los modales del sistema. */
.modal-backdrop {
    background-color: #6c757d !important;
}

.modal-backdrop.show {
    opacity: 0.25 !important;
}

.modal .btn-close,
.modal .btn.btn-close,
.modal-header .btn-close,
.modal-header .btn.btn-close {
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 0.85rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    height: 38px !important;
    min-height: 38px !important;
    min-width: 38px !important;
    opacity: 1;
    padding: 0 !important;
    width: 38px !important;
    filter: none;
}

.modal .btn-close:hover,
.modal .btn.btn-close:hover,
.modal-header .btn-close:hover,
.modal-header .btn.btn-close:hover {
    background-color: transparent;
    border-color: transparent;
    opacity: 1;
}

.modal .btn-close:focus,
.modal .btn.btn-close:focus,
.modal-header .btn-close:focus,
.modal-header .btn.btn-close:focus {
    box-shadow: none;
}

.alert .btn-close,
.alert-dismissible .btn-close {
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 0.85rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    height: 38px;
    min-height: 38px;
    min-width: 38px;
    opacity: 0.55;
    padding: 0;
    position: relative;
    transition: opacity 0.15s ease-in-out;
    width: 38px;
}

.alert .btn-close:hover,
.alert-dismissible .btn-close:hover {
    background-color: transparent;
    border-color: transparent;
    opacity: 1;
}

.alert .btn-close::before,
.alert-dismissible .btn-close::before {
    content: none;
}

.alert-dismissible {
    position: relative;
    padding-right: 3rem;
}

.alert-dismissible .btn-close {
    position: absolute !important;
    right: 0.45rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.alert .btn-close:focus,
.alert-dismissible .btn-close:focus,
.alert .btn-close:active,
.alert-dismissible .btn-close:active {
    background-color: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    opacity: 1 !important;
    outline: none !important;
}

.btn.btn-icon-only {
    min-width: 38px;
    padding: 0.375rem 0.6rem;
}

.btn.btn-icon-only > i {
    margin: 0;
}

.btn.cga-back-button {
    align-items: center;
    display: inline-flex;
    flex: 0 1 auto;
    gap: 0.45rem;
    justify-content: center;
    padding: 0.375rem 0.75rem;
    white-space: nowrap;
}

.btn.cga-back-button > i {
    flex: 0 0 auto;
    font-size: 1rem;
    line-height: 1;
    margin: 0;
}

.btn-group .btn,
.d-flex .btn,
.btn-toolbar .btn {
    white-space: nowrap;
}

/* Estandar para barras de acciones en cabecera de pagina. */
.cga-actions-toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.cga-actions-toolbar > .btn,
.cga-actions-toolbar > a.btn {
    white-space: nowrap;
}

.cga-empleados-obra-toolbar {
    align-items: flex-end;
}

.cga-empleados-obra-filter {
    flex: 1 1 26rem;
    margin-right: auto !important;
    max-width: 35rem;
    min-width: 20rem;
}

@media (max-width: 767.98px) {
    .cga-actions-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .cga-actions-toolbar > .btn,
    .cga-actions-toolbar > a.btn {
        width: 100%;
    }

    .cga-empleados-obra-filter {
        flex: 0 0 auto;
        flex-direction: column;
        max-width: none;
        min-width: 0;
        width: 100%;
    }

    .cga-empleados-obra-filter > * {
        width: 100%;
    }
}

/* Estandar para acciones en tablas: botones icono-only */
table td .d-grid.gap-2.d-flex,
table td .btn-group,
table td .cga-table-actions {
	align-items: center;
	display: flex;
	gap: 0.45rem !important;
}

table td .d-grid.gap-2.d-flex .btn,
table td .btn-group .btn,
table td .cga-table-actions .btn {
    align-items: center !important;
    display: inline-flex !important;
    height: 38px;
    justify-content: center !important;
    min-height: 38px;
    min-width: 38px;
    padding: 0 !important;
    width: 38px;
}

table td .d-grid.gap-2.d-flex .btn > i,
table td .btn-group .btn > i,
table td .cga-table-actions .btn > i {
    display: inline-block;
    font-size: 1rem;
    line-height: 1;
    margin: 0;
    vertical-align: 0;
}

/* Si el botón trae icono + texto, forzar visual solo icono en acciones */
table td .d-grid.gap-2.d-flex .btn,
table td .btn-group .btn,
table td .cga-table-actions .btn {
    font-size: 0;
}

table td .d-grid.gap-2.d-flex .btn > i,
table td .btn-group .btn > i,
table td .cga-table-actions .btn > i {
    font-size: 1rem;
}

@media (min-width: 768px) {
    table td .d-grid.gap-2.d-flex {
        flex-wrap: nowrap;
    }
}

@media (max-width: 767px) {
    .btn {
        min-height: 36px;
    }

    table td .d-grid.gap-2.d-flex {
        flex-wrap: wrap;
    }
}

/* Botones de texto con el mismo tamaño que el sitio principal. */
body .btn:not(.btn-close):not(table td .d-grid.gap-2.d-flex .btn):not(table td .btn-group .btn):not(table td .cga-table-actions .btn):not(.cga-floating-actions .btn) {
    min-height: 40px;
    padding: 9px 12px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.2;
}