/* ============================================================
   Admin Integration Tools - Custom Styles
   Uses V14 theme variables for dark mode support
   ============================================================ */

/* ---- Campaign Type Cards (Listing Page) ---- */
.intg-type-card {
    border: none;
    border-radius: 0.75rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}
.intg-type-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}
.intg-type-card .card-body {
    padding: 1rem 1.25rem;
}
.intg-type-card--banner {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #fff;
}
.intg-type-card--text {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
}
.intg-type-card--link {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: #fff;
}
.intg-type-card--video {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
}
.intg-type-card .intg-type-icon {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.intg-type-card .btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 0.8rem;
    padding: 0.3rem 0.75rem;
    border-radius: 50rem;
    transition: background 0.2s;
}
.intg-type-card .btn:hover {
    background: rgba(255, 255, 255, 0.35);
    color: #fff;
}

/* ---- Filter Section ---- */
.intg-filter-card {
    border: 1px solid var(--v14-border-light);
    background: var(--v14-card-bg);
}
.intg-filter-header {
    background: var(--v14-surface-2) !important;
    border-bottom: 1px solid var(--v14-border-light) !important;
    padding: 0.5rem 1rem !important;
    cursor: pointer;
}
.intg-filter-header .card-title {
    font-size: 0.875rem;
}
.intg-filter-body {
    padding: 0.75rem 1rem !important;
}

/* ---- Data Table ---- */
.intg-table-card {
    border: 1px solid var(--v14-border-light);
    background: var(--v14-card-bg);
}
.intg-table thead.table-light {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
}
.intg-table thead.table-light th {
    background: transparent !important;
    color: #e2e8f0 !important;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.55rem 0.6rem !important;
    border: none !important;
    white-space: nowrap;
}
.intg-table tbody tr {
    transition: background-color 0.15s ease;
}
.intg-table tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.05) !important;
}
.intg-table tbody td {
    padding: 0.5rem 0.6rem;
    vertical-align: middle;
    color: var(--v14-text-primary);
    font-size: 0.875rem;
}

/* Table column widths (replacing inline styles) */
.intg-th-image { width: 70px; }
.intg-th-name { width: 240px; }
.intg-th-plugin { width: 130px; }
.intg-th-view { width: 80px; }
.intg-th-ratio { width: 140px; }
.intg-th-integration { width: 100px; }
.intg-th-status { width: 100px; }
.intg-th-action { width: 200px; }

/* Campaign thumbnail */
.intg-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}
.intg-thumb:hover {
    transform: scale(1.1);
}

/* Action dropdown */
.intg-action-dropdown .dropdown-toggle {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}
.intg-action-dropdown .dropdown-toggle::after {
    display: none;
}
.intg-action-dropdown .dropdown-menu {
    font-size: 0.85rem;
    min-width: 12rem;
    border: 1px solid var(--v14-border-light);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
.intg-action-dropdown .dropdown-item {
    padding: 0.45rem 0.75rem;
}
.intg-action-dropdown .dropdown-item i {
    width: 1.25rem;
    text-align: center;
}

/* ---- Security Check Modal ---- */
.intg-step-hidden {
    display: none;
}
.intg-progress-bar {
    height: 20px;
}
.intg-result-card-hidden {
    display: none;
}

/* ---- Spin animation for BI icons ---- */
@keyframes intg-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.intg-spin {
    animation: intg-spin 1s linear infinite;
    display: inline-block;
}

/* ---- Form Page Styles ---- */
/* Page bar: back link + title */
.intg-page-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.intg-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--v14-text-secondary);
    text-decoration: none;
    padding: 0.35rem 0.75rem 0.35rem 0.5rem;
    border-radius: 50rem;
    border: 1px solid var(--v14-border-light);
    background: var(--v14-card-bg);
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.intg-back-link:hover {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}
.intg-back-link i {
    font-size: 0.9rem;
}
.intg-page-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.intg-page-title h5 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.intg-form-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #fff;
    border-radius: 0.625rem;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.intg-form-icon[data-type="text_ads"] { background: linear-gradient(135deg, #10b981, #059669); }
.intg-form-icon[data-type="link_ads"] { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.intg-form-icon[data-type="video_ads"] { background: linear-gradient(135deg, #f59e0b, #d97706); }
.intg-type-badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 50rem;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}
.intg-type-badge[data-type="text_ads"] { background: rgba(16, 185, 129, 0.1); color: #059669; }
.intg-type-badge[data-type="link_ads"] { background: rgba(139, 92, 246, 0.1); color: #6d28d9; }
.intg-type-badge[data-type="video_ads"] { background: rgba(245, 158, 11, 0.1); color: #d97706; }

/* Compact alert bar */
.intg-alert-bar {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.intg-alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.3;
}
.intg-alert i:first-child {
    flex-shrink: 0;
    font-size: 0.9rem;
}
.intg-alert span {
    flex: 1;
    min-width: 0;
}
.intg-alert-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.6;
    font-size: 1rem;
    flex-shrink: 0;
    color: inherit;
}
.intg-alert-close:hover {
    opacity: 1;
}
.intg-alert--danger {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.15);
}
.intg-alert--warning {
    background: rgba(245, 158, 11, 0.08);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.15);
}

/* Form card */
.intg-form-header {
    border-left: 4px solid #3b82f6;
    background: var(--v14-card-bg);
}
.intg-form-header[data-type="text_ads"] { border-left-color: #10b981; }
.intg-form-header[data-type="link_ads"] { border-left-color: #8b5cf6; }
.intg-form-header[data-type="video_ads"] { border-left-color: #f59e0b; }

/* Tab navigation */
.intg-tabs .nav-link {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--v14-text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem 0.5rem 0 0;
}
.intg-tabs .nav-link.active {
    color: #3b82f6;
    font-weight: 600;
    background: var(--v14-card-bg);
    border-color: var(--v14-border-light) var(--v14-border-light) var(--v14-card-bg);
}
.intg-tabs .nav-link i {
    font-size: 0.9rem;
}
/* Unified tab navigation */
.intg-unified-tabs {
    background: var(--v14-surface-2);
    border-radius: 0.75rem;
    padding: 0.35rem;
    border: 1px solid var(--v14-border-light);
}
.intg-unified-tabs .nav {
    gap: 0.25rem;
}
.intg-unified-tabs .nav-link {
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 0.5rem;
    padding: 0.45rem 0.9rem;
    transition: all 0.2s ease;
    color: var(--v14-text-secondary);
    white-space: nowrap;
}
.intg-unified-tabs .nav-link.active {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}
.intg-unified-tabs .nav-link:not(.active):hover {
    background: rgba(59, 130, 246, 0.08);
    color: #3b82f6;
}
.intg-unified-tabs .nav-link i {
    font-size: 0.85rem;
}
.intg-tab-divider {
    width: 1px;
    background: var(--v14-border-light);
    margin: 0.35rem 0.25rem;
    align-self: stretch;
}

/* Form footer */
.intg-form-footer {
    background: var(--v14-surface-2) !important;
    border-top: 2px solid var(--v14-border-light) !important;
    padding: 0.75rem 1rem !important;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* (removed: advanced tab toggle - replaced by unified tabs) */

/* Form section cards */
.intg-section-card {
    border: 1px solid var(--v14-border-light);
    border-radius: 0.5rem;
    background: var(--v14-card-bg);
    margin-bottom: 0.75rem;
}
.intg-section-card .card-header {
    background: var(--v14-surface-2);
    border-bottom: 1px solid var(--v14-border-light);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
}
.intg-section-card .card-body {
    padding: 0.75rem;
}

/* Featured image */
.intg-featured-img-wrap {
    width: 80px;
    height: 80px;
    overflow: hidden;
    border-radius: 0.5rem;
    border: 2px dashed var(--v14-border-light);
}
.intg-featured-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
}
.intg-file-hidden {
    display: none;
}

/* Stripe fields */
.intg-stripe-hidden {
    display: none;
}
.intg-stripe-help-hidden {
    display: none;
}

/* Date inputs */
.intg-date-hidden {
    display: none;
}

/* Tool integration plugin */
.intg-plugin-hidden {
    display: none;
}

/* Video source section visibility */
.intg-video-section-hidden {
    display: none;
}

/* Banner table */
.intg-banner-table th {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    background: var(--v14-surface-2);
}
.intg-banner-th-dim {
    width: 140px;
}
.intg-banner-th-action {
    width: 80px;
}

/* Level settings table */
.intg-level-table th {
    vertical-align: top;
    border-right: 1px solid var(--v14-border-light);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.5rem;
    background: var(--v14-surface-2);
}
.intg-level-table th:last-child,
.intg-level-table td:last-child {
    border-right: none;
}
.intg-level-table td {
    padding: 0.35rem 0.5rem;
    vertical-align: middle;
    border-right: 1px solid var(--v14-border-light);
}
.intg-level-table .form-control {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
}

/* MLM default section hidden */
.intg-mlm-default-hidden {
    display: none;
}

/* S2S Section */
.intg-s2s-section .card-header {
    cursor: pointer;
}

/* Commission cards */
.intg-commission-card {
    border: 1px solid var(--v14-border-light);
    border-radius: 0.5rem;
    background: var(--v14-card-bg);
}
.intg-commission-card .card-header {
    background: var(--v14-surface-2);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--v14-border-light);
}

/* Video source cards */
.intg-video-source-card {
    border: 2px solid var(--v14-border-light);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    padding: 1rem;
}
.intg-video-source-card:hover,
.intg-video-source-card.active {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

/* Postback section */
.intg-postback-url {
    font-family: monospace;
    font-size: 0.85rem;
    background: var(--v14-surface-2);
}

/* Conversion API code blocks */
.intg-api-code {
    white-space: pre-wrap;
    font-size: 13px;
}

/* Cookies type */
.intg-cookies-hidden {
    display: none;
}

/* S2S details */
.intg-s2s-details-hidden {
    display: none;
}

/* Custom time container */
.intg-customtime-hidden {
    display: none;
}

/* Video preview container */
.intg-video-preview {
    min-height: 250px;
}

/* Integration users list */
.intg-users-list {
    height: 200px;
    overflow: auto;
}

/* Campaign image */
img.campaign-img.campaign_default_image {
    max-width: 150px !important;
    max-height: 100px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

/* Remove country cursor */
.intg-remove-country {
    cursor: pointer;
}

/* Tab navigation styling */
#TabsNav .nav-link {
    color: #6c757d !important;
    background-color: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    margin-right: 5px;
    transition: all 0.3s ease;
    font-weight: 500;
}
#TabsNav .nav-link:hover {
    color: #495057 !important;
    background-color: #e9ecef !important;
    border-color: #adb5bd !important;
}
#TabsNav .nav-link.active {
    color: #fff !important;
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}
#TabsNav .nav-link.active:hover {
    color: #fff !important;
    background-color: #0b5ed7 !important;
    border-color: #0a58ca !important;
}
#TabsNav .nav-link i {
    font-size: 0.9em;
}

/* ===== Unified Modal Design System ===== */
.intg-modal .modal-content {
    border: none;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}
.intg-modal .intg-modal-header {
    background: var(--v14-card-bg);
    border-bottom: 1px solid var(--v14-border-light);
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.intg-modal .intg-modal-header-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}
.intg-modal-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}
.intg-modal-icon--info { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.intg-modal-icon--primary { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.intg-modal-icon--secondary { background: linear-gradient(135deg, #6b7280, #4b5563); }
.intg-modal-icon--success { background: linear-gradient(135deg, #10b981, #059669); }
.intg-modal-icon--warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.intg-modal .intg-modal-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--v14-text-primary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.intg-modal .intg-modal-subtitle {
    font-size: 0.75rem;
    color: var(--v14-text-secondary);
    margin: 0;
}
.intg-modal .intg-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: var(--v14-surface-2);
    color: var(--v14-text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.intg-modal .intg-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}
.intg-modal .modal-body {
    padding: 1rem 1.25rem;
    background: var(--v14-surface-2);
}
.intg-modal .intg-modal-footer {
    background: var(--v14-card-bg);
    border-top: 1px solid var(--v14-border-light);
    padding: 0.65rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}
.intg-modal .intg-modal-footer .btn {
    font-size: 0.8rem;
    border-radius: 50rem;
    padding: 0.35rem 1rem;
}

/* Modal data cards */
.intg-modal-card {
    background: var(--v14-card-bg);
    border: 1px solid var(--v14-border-light);
    border-radius: 0.5rem;
    padding: 0.75rem;
}
.intg-modal-card-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--v14-text-secondary);
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.intg-modal-card-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--v14-text-primary);
}
.intg-modal-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--v14-text-primary);
    margin-bottom: 0.65rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--v14-border-light);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Modal stat row */
.intg-modal-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
}
.intg-modal-stat-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.intg-modal-stat-icon--green { background: rgba(16, 185, 129, 0.1); color: #059669; }
.intg-modal-stat-icon--blue { background: rgba(59, 130, 246, 0.1); color: #1d4ed8; }
.intg-modal-stat-label {
    font-size: 0.75rem;
    color: var(--v14-text-secondary);
}
.intg-modal-stat-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--v14-text-primary);
}

/* Modal table */
.intg-modal-table {
    font-size: 0.8rem;
}
.intg-modal-table thead th {
    background: var(--v14-card-bg);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--v14-text-secondary);
    padding: 0.5rem 0.6rem;
    border-bottom: 2px solid var(--v14-border-light);
}
.intg-modal-table tbody td {
    padding: 0.45rem 0.6rem;
    vertical-align: middle;
    border-color: var(--v14-border-light);
}

/* Modal utility classes */
.intg-modal-empty-icon {
    font-size: 2rem;
    opacity: 0.3;
}
.intg-modal-result-icon {
    font-size: 1.5rem;
}
.intg-modal-disabled-state .intg-modal-empty-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--bs-danger, #dc3545);
    opacity: 1;
}

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .intg-type-card .card-body {
        padding: 0.75rem 1rem;
    }
}
