/* Global Form Styles for Dynamic Sections */

/* Dynamic Section Container */
.dynamic-section {
    margin-bottom: 1.5rem;
}

.dynamic-section-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1rem;
    width: 100%;
    padding-right: 0;
}

/* Icon-only Add Button */
.dynamic-section-add-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    background-color: #2f2f9c;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.dynamic-section-add-btn:hover {
    background-color: #25257a;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(47, 47, 156, 0.3);
}

.dynamic-section-add-btn:active {
    transform: translateY(0);
}

.dynamic-section-add-btn i,
.dynamic-section-add-btn svg {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Dynamic Section Table */
.dynamic-section-table {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.dynamic-section-table .table-responsive {
    border-radius: 8px;
}

.dynamic-section-table .table {
    margin-bottom: 0;
}

.dynamic-section-table .table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #272b41;
    padding: 12px 16px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dynamic-section-table .table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
}

.dynamic-section-table .table tbody tr:hover {
    background-color: #f8f9fa;
}

.dynamic-section-table .table tbody tr:last-child td {
    border-bottom: none;
}

/* Empty State */
.dynamic-section-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #868eae;
    background: #fff;
    border-radius: 8px;
    border: 1px dashed #dee2e6;
}

.dynamic-section-empty p {
    margin: 0;
    font-size: 14px;
}

/* Action Buttons */
.dynamic-section-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dynamic-section-actions .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
}

.dynamic-section-actions .btn-icon.edit {
    color: #1c467b;
}

.dynamic-section-actions .btn-icon.edit:hover {
    background-color: rgba(28, 70, 123, 0.1);
    color: #153a66;
}

.dynamic-section-actions .btn-icon.remove {
    color: #dc3545;
}

.dynamic-section-actions .btn-icon.remove:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #c82333;
}

.dynamic-section-actions .btn-icon i,
.dynamic-section-actions .btn-icon svg {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Legacy support for existing table actions */
.orderDatatable_actions {
    display: flex;
    gap: 8px;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
}

.orderDatatable_actions li {
    display: inline-block;
}

.orderDatatable_actions a {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.orderDatatable_actions a.edit {
    color: #1c467b;
}

.orderDatatable_actions a.edit:hover {
    background-color: rgba(28, 70, 123, 0.1);
    color: #153a66;
}

.orderDatatable_actions a.remove {
    color: #dc3545;
}

.orderDatatable_actions a.remove:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #c82333;
}

.orderDatatable_actions a i,
.orderDatatable_actions a svg {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Table Content */
.dynamic-section-table .userDatatable-content {
    font-size: 14px;
    color: #272b41;
}

/* Text Ellipsis Utility */
.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Global Modal Close Button Styles */
.modal .btn-close,
.modal-header .btn-close,
button.btn-close {
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%232f2f9c'%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") center/1em auto no-repeat !important;
    border: none !important;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #2f2f9c !important;
    opacity: 1 !important;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    display: inline-block;
    width: 1em;
    height: 1em;
    margin: 0;
    transition: all 0.2s ease;
    -webkit-box-sizing: content-box;
    box-sizing: content-box;
}

.modal .btn-close:hover,
.modal-header .btn-close:hover,
button.btn-close:hover {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2325257a'%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") !important;
    color: #25257a !important;
    opacity: 1 !important;
    transform: scale(1.1);
}

.modal .btn-close:focus,
.modal-header .btn-close:focus,
button.btn-close:focus {
    outline: none !important;
    box-shadow: 0 0 0 0.25rem rgba(47, 47, 156, 0.25) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%232f2f9c'%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") !important;
    color: #2f2f9c !important;
    opacity: 1 !important;
}

.modal .btn-close:disabled,
.modal-header .btn-close:disabled,
button.btn-close:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23868eae'%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") !important;
}

.modal .btn-close span,
.modal-header .btn-close span,
button.btn-close span {
    display: none !important;
}

/* Ensure close button is visible in modal header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.modal-header .btn-close {
    margin-left: auto;
    order: 2;
}

/* Responsive */
@media (max-width: 768px) {
    .dynamic-section-table {
        font-size: 12px;
    }
    
    .dynamic-section-table .table thead th,
    .dynamic-section-table .table tbody td {
        padding: 8px 12px;
    }
    
    .dynamic-section-add-btn {
        width: 32px;
        height: 32px;
    }
    
    .modal .btn-close,
    .modal-header .btn-close {
        font-size: 1.25rem;
        padding: 0.375rem 0.5rem;
    }
}
