@keyframes itgModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes itgModalSlideUp {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.itg-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    font-family: 'Outfit', sans-serif;
}

.itg-modal-overlay.active {
    display: flex !important;
    animation: itgModalFadeIn 0.15s ease;
}

.itg-modal-dialog {
    position: relative;
    width: 95%;
    max-height: 90vh;
    box-sizing: border-box;
    background: #fff;
    border-radius: 16px;
    /* Accent bar - follows the dialog's rounded corners when clipped. */
    border-left: 4px solid var(--accent-bar-color, var(--primary));
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
}

.itg-modal-overlay.active .itg-modal-dialog {
    animation: itgModalSlideUp 0.2s ease;
}

/*
 * The left accent is the dialog's 4px left border (see `.itg-modal-dialog`)
 * rather than an absolutely positioned strip, so it is clipped by the
 * dialog's rounded corners instead of poking out past them.
 */

.itg-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.itg-modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
}

.itg-modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    border-radius: 50%;
    font-size: 1.3rem;
    line-height: 1;
    color: var(--muted-darker, #B0B0B0);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    padding: 0;
}

.itg-modal-close:hover {
    background: var(--gray-100, #f1f3f5);
    color: var(--gray-800, #343a40);
}

.itg-modal-body {
    padding: 16px 24px 20px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 80px;
    color: var(--primary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.itg-modal-body .text-muted {
    color: var(--muted-darker, #adb5bd) !important;
}

.itg-modal-body h6 {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 12px;
}

.itg-modal-body .card {
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.itg-modal-body .card-header {
    background: #f8fafd;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    padding: 10px 16px;
    border-radius: 12px 12px 0 0;
}

.itg-modal-body .card-body {
    padding: 14px 16px;
    font-size: 0.9rem;
}

.itg-modal-body .table-responsive .table {
    font-size: 0.85rem;
    margin-bottom: 0;
}

.itg-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px 20px;
    border-top: 1px solid #f0f0f0;
    flex-wrap: wrap;
}

.itg-modal-footer .btn {
    padding: 8px 20px;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary-modern {
    background: var(--primary);
    color: #fff;
    border: none;
}

.btn-primary-modern:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary-modern:disabled,
.btn-primary-modern.disabled {
    background: var(--gray-200, #e9ecef);
    color: var(--muted-darker, #adb5bd);
    box-shadow: none;
    opacity: 1;
    cursor: not-allowed;
}

.btn-secondary-modern {
    background: transparent;
    color: var(--muted-darker, #B0B0B0);
    border: 1px solid var(--gray-200, #e9ecef);
}

.btn-secondary-modern:hover:not(:disabled) {
    background: var(--gray-50, #f8f9fa);
    color: var(--gray-700, #495057);
    border-color: var(--gray-300, #dee2e6);
}

.btn-secondary-modern:disabled,
.btn-secondary-modern.disabled {
    background: transparent;
    color: var(--gray-300, #dee2e6);
    border-color: var(--gray-200, #e9ecef);
    box-shadow: none;
    opacity: 1;
    cursor: not-allowed;
}

.btn-danger-modern {
    background: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
}

.btn-danger-modern:hover {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

.btn-success-modern {
    background: transparent;
    color: #28a745;
    border: 1px solid #28a745;
}

.btn-success-modern:hover {
    background: #28a745;
    color: #fff;
    border-color: #28a745;
}

.itg-modal-footer .btn-group-modern {
    display: flex;
    gap: 8px;
    align-items: center;
}

.itg-modal-footer .error-messages {
    width: 100%;
    margin-top: 4px;
}

.itg-modal-footer .error-message {
    background: #fff0f3;
    border: 1px solid #f8bbd9;
    border-radius: 10px;
    padding: 10px 14px;
    color: #b71c1c;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.itg-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 0;
    color: var(--gray-500, #adb5bd);
}

/* Form elements inside modal body */
.itg-modal-body .form-section {
    margin-bottom: 20px;
}

.itg-modal-body .form-label {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Horizontal label/input rows (label on the left, field on the right). */
.itg-modal-body .itg-form-row {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}

.itg-modal-body .itg-form-row .form-label {
    margin-bottom: 0;
}

@media (max-width: 575.98px) {
    .itg-modal-body .itg-form-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

.itg-modal-body .form-control,
.itg-modal-body select,
.itg-modal-body textarea {
    border: 2px solid #e9ecef;
    border-radius: 25px;
    padding: 10px 16px;
    font-size: 0.92rem;
    font-family: 'Outfit', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    width: 100%;
}

.itg-modal-body .form-control:focus,
.itg-modal-body select:focus,
.itg-modal-body textarea:focus {
    border-color: var(--primary, #0056b3);
    box-shadow: 0 0 0 2px rgba(0,86,179,0.08);
    outline: none;
}

/* Disabled (read-only) fields inside modal body */
.itg-modal-body .form-control:disabled,
.itg-modal-body select:disabled,
.itg-modal-body textarea:disabled {
    background: #e9ecef;
    color: #adb5bd;
    border-color: #dee2e6;
    cursor: not-allowed;
    opacity: 1;
    box-shadow: none;
}

/* Input groups (prefix pills such as ABN/WWC) keep Bootstrap's attached
   geometry. Without this the modal-wide `width: 100%` above forces the input
   onto its own row, detaching the pill from its field. */
.itg-modal-body .input-group > .form-control,
.itg-modal-body .input-group > .form-select {
    width: 1%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
}

.itg-modal-body .input-group > .input-group-text {
    width: auto;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
}

/* ========================================
   STEP LOCKS TABLE
   ======================================== */

.itg-step-locks-table {
    width: 100%;
    border-collapse: collapse;
}

.itg-step-locks-table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500, #adb5bd);
    padding: 8px 12px;
    border-bottom: 2px solid var(--gray-200, #e9ecef);
}

.itg-step-locks-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100, #f1f3f5);
    vertical-align: middle;
}

.itg-step-group-header td {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-700, #495057);
    background: var(--gray-50, #f8f9fa);
    padding: 6px 12px;
    letter-spacing: 0.02em;
    border-top: 2px solid var(--gray-200, #e9ecef);
    border-bottom: 1px solid var(--gray-200, #e9ecef);
}

.itg-step-group-header:first-child td {
    border-top: none;
}

.itg-group-toggle {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200, #e9ecef);
    background: var(--gray-100, #f1f3f5);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    transition: background 0.15s, border-color 0.15s;
    vertical-align: middle;
}

.itg-group-toggle:hover {
    background: var(--gray-200, #e9ecef);
    border-color: var(--gray-300, #dee2e6);
}

.itg-step-name {
    font-size: 0.875rem;
    color: var(--gray-800, #343a40);
}

.itg-step-version {
    font-size: 0.75rem;
    color: var(--gray-400, #ced4da);
    margin-left: 6px;
}

.itg-step-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
}

.itg-step-badge.active {
    background: #d3f9d8;
    color: #2b8a3e;
}

.itg-step-badge.locked {
    background: #ffe3e3;
    color: #c92a2a;
}

.itg-step-badge.completed {
    background: var(--primary-light);
    color: var(--primary);
}

.itg-step-badge.pending {
    background: #fff3bf;
    color: #e67700;
}

.itg-step-toggle {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200, #e9ecef);
    background: var(--gray-50, #f8f9fa);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s, border-color 0.15s;
}

.itg-step-toggle:hover {
    background: var(--gray-100, #f1f3f5);
    border-color: var(--gray-300, #dee2e6);
}

.itg-step-toggle.locked {
    color: #c92a2a;
    border-color: #ffe3e3;
    background: #fff5f5;
}

.itg-step-toggle.unlocked {
    color: #2b8a3e;
    border-color: #d3f9d8;
    background: #f4fcf4;
}

.itg-renew-btn {
    padding: 4px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid var(--gray-200, #e9ecef);
    background: #fff;
    color: var(--gray-700, #495057);
    cursor: pointer;
    transition: all 0.15s;
}

.itg-renew-btn:hover {
    background: var(--primary-50, #e7f5ff);
    border-color: var(--primary-300, #74c0fc);
    color: var(--primary-700, #1c7ed6);
}

/* ========================================
   SERVICE AGREEMENT EXPIRY NOTICE MODAL
   ======================================== */

.itg-sa-expiry-notice {
    text-align: center;
    padding: 8px 0;
}

.itg-sa-expiry-icon {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

.itg-sa-expiry-message {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--gray-700, #495057);
    margin: 0;
}
