/**
 * ImmigraSuite Admin - Notification Hub
 * Per-notification email configuration UI
 */

/* ==========================================================================
   Toolbar (tabs + intercept indicator on same row)
   ========================================================================== */

.is-nhub-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.is-nhub-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.is-nhub-intercept-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    color: rgb(133 77 14);
    background: rgb(254 249 195);
    border: 1px solid rgb(253 224 71);
    border-radius: 20px;
    cursor: default;
    white-space: nowrap;
}
.dark .is-nhub-intercept-pill {
    background: rgb(78 55 22 / 0.5);
    border-color: rgb(133 77 14 / 0.6);
    color: rgb(253 224 71);
}

.is-nhub-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: rgb(55 65 81);
    background: white;
    border: 1px solid rgb(229 231 235);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.is-nhub-tab:hover {
    border-color: rgb(234 88 12);
    color: rgb(234 88 12);
}
.is-nhub-tab-active {
    background: linear-gradient(135deg, rgb(234 88 12) 0%, rgb(249 115 22) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 4px rgba(234, 88, 12, 0.3);
}
.is-nhub-tab-active:hover {
    color: white;
}
.dark .is-nhub-tab {
    background: rgb(31 41 55);
    color: rgb(209 213 219);
    border-color: rgb(55 65 81);
}
.dark .is-nhub-tab:hover {
    border-color: rgb(234 88 12);
    color: rgb(234 88 12);
}
.dark .is-nhub-tab-active {
    border-color: transparent;
    color: white;
}

.is-nhub-tab-count {
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0,0,0,0.06);
    border-radius: 10px;
}
.is-nhub-tab-active .is-nhub-tab-count {
    background: rgba(255,255,255,0.25);
}
.dark .is-nhub-tab-count {
    background: rgba(255,255,255,0.08);
}

/* ==========================================================================
   Category Groups
   ========================================================================== */

.is-nhub-group {
    margin-bottom: 24px;
}

.is-nhub-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 0 4px;
}

.is-nhub-group-badge {
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 6px;
}

.is-nhub-cat-client { background: rgb(219 234 254); color: rgb(30 64 175); }
.is-nhub-cat-admin { background: rgb(254 243 199); color: rgb(133 77 14); }
.is-nhub-cat-hr { background: rgb(220 252 231); color: rgb(22 101 52); }
.dark .is-nhub-cat-client { background: rgb(30 58 138); color: rgb(147 197 253); }
.dark .is-nhub-cat-admin { background: rgb(78 55 22); color: rgb(253 224 71); }
.dark .is-nhub-cat-hr { background: rgb(22 78 52); color: rgb(134 239 172); }

/* ==========================================================================
   Table
   ========================================================================== */

.is-nhub-table-wrap {
    background: white;
    border: 1px solid rgb(229 231 235);
    border-radius: 12px;
    overflow: hidden;
}
.dark .is-nhub-table-wrap {
    background: rgb(17 24 39);
    border-color: rgb(55 65 81);
}

.is-nhub-row:hover {
    background: rgb(249 250 251);
}
.dark .is-nhub-row:hover {
    background: rgb(31 41 55);
}

/* ==========================================================================
   Row Actions
   ========================================================================== */

.is-nhub-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.is-nhub-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: rgb(107 114 128);
    cursor: pointer;
    transition: all 0.15s;
}
.is-nhub-btn-icon:hover {
    background: rgb(243 244 246);
    color: rgb(55 65 81);
}
.dark .is-nhub-btn-icon:hover {
    background: rgb(55 65 81);
    color: rgb(209 213 219);
}

.is-nhub-btn-success:hover { color: rgb(22 163 74); background: rgb(220 252 231); }
.is-nhub-btn-danger:hover { color: rgb(220 38 38); background: rgb(254 226 226); }
.is-nhub-btn-test:hover { color: rgb(37 99 235); background: rgb(219 234 254); }
.dark .is-nhub-btn-success:hover { color: rgb(134 239 172); background: rgb(22 78 52); }
.dark .is-nhub-btn-danger:hover { color: rgb(252 165 165); background: rgb(127 29 29); }
.dark .is-nhub-btn-test:hover { color: rgb(147 197 253); background: rgb(30 58 138); }

/* ==========================================================================
   Edit Card (replaces inline edit row)
   ========================================================================== */

.is-nhub-row-editing td {
    padding: 0 !important;
    border: none !important;
}

.is-nhub-edit-card {
    margin: 8px 12px 12px;
    background: white;
    border: 1px solid rgb(234 88 12 / 0.3);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.08), 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}
.dark .is-nhub-edit-card {
    background: rgb(24 32 48);
    border-color: rgb(234 88 12 / 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.is-nhub-edit-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, rgb(255 247 237) 0%, rgb(254 243 199) 100%);
    border-bottom: 1px solid rgb(253 186 116 / 0.3);
}
.dark .is-nhub-edit-card-header {
    background: linear-gradient(135deg, rgb(78 55 22 / 0.3) 0%, rgb(55 42 18 / 0.3) 100%);
    border-color: rgb(133 77 14 / 0.3);
}

.is-nhub-edit-card-title {
    font-size: 15px;
    font-weight: 600;
    color: rgb(17 24 39);
    margin: 0 0 2px;
    line-height: 1.3;
}
.dark .is-nhub-edit-card-title {
    color: rgb(243 244 246);
}

.is-nhub-edit-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.is-nhub-edit-card-footer {
    display: flex;
    gap: 8px;
    padding: 14px 20px;
    background: rgb(249 250 251);
    border-top: 1px solid rgb(229 231 235);
}
.dark .is-nhub-edit-card-footer {
    background: rgb(17 24 39);
    border-color: rgb(55 65 81);
}

.is-nhub-edit-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 768px) {
    .is-nhub-edit-row-2col {
        grid-template-columns: 1fr;
    }
}

.is-nhub-edit-section {
    padding-top: 12px;
    border-top: 1px solid rgb(229 231 235);
}
.dark .is-nhub-edit-section {
    border-color: rgb(55 65 81);
}

.is-nhub-edit-section-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgb(107 114 128);
    margin-bottom: 10px;
}
.dark .is-nhub-edit-section-label {
    color: rgb(156 163 175);
}

.is-nhub-edit-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: rgb(55 65 81);
    margin-bottom: 6px;
}
.dark .is-nhub-edit-field label {
    color: rgb(209 213 219);
}

/* Channel Toggles (card-style checkboxes in edit form) */
.is-nhub-channel-toggles {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.is-nhub-channel-toggle {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid rgb(209 213 219);
    background: white;
    color: rgb(107 114 128);
    transition: all 0.15s ease;
    white-space: nowrap;
}
.is-nhub-channel-toggle svg,
.is-nhub-channel-toggle .is-nhub-icon-sm {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.is-nhub-channel-toggle:hover {
    border-color: rgb(156 163 175);
}
.dark .is-nhub-channel-toggle {
    background: rgb(31 41 55);
    border-color: rgb(55 65 81);
    color: rgb(156 163 175);
}

.is-nhub-channel-toggle-on {
    background: rgb(220 252 231);
    color: rgb(22 101 52);
    border-color: rgb(134 239 172);
}
.is-nhub-channel-toggle-on:hover {
    border-color: rgb(74 222 128);
}
.dark .is-nhub-channel-toggle-on {
    background: rgba(22, 101, 52, 0.25);
    color: rgb(134 239 172);
    border-color: rgba(22, 101, 52, 0.5);
}

/* Audience grid */
.is-nhub-audience-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Row badges (mandatory + audience indicators) */
.is-nhub-row-badges {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.is-nhub-mini-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 9999px;
    line-height: 1.4;
}

.is-nhub-mini-mandatory {
    background: rgb(254 226 226);
    color: rgb(153 27 27);
}
.dark .is-nhub-mini-mandatory {
    background: rgba(153, 27, 27, 0.25);
    color: rgb(252 165 165);
}

.is-nhub-mini-audience {
    background: rgb(219 234 254);
    color: rgb(30 64 175);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dark .is-nhub-mini-audience {
    background: rgba(30, 64, 175, 0.25);
    color: rgb(147 197 253);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Form Controls
   ========================================================================== */

.is-nhub-select,
.is-nhub-input {
    width: 100%;
    padding: 8px 48px 8px 12px;
    font-size: 13px;
    border: 1px solid rgb(209 213 219);
    border-radius: 8px;
    background: white;
    color: rgb(17 24 39);
    transition: border-color 0.15s;
}
.is-nhub-select:focus,
.is-nhub-input:focus {
    outline: none;
    border-color: rgb(234 88 12);
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.1);
}
.dark .is-nhub-select,
.dark .is-nhub-input {
    background: rgb(17 24 39);
    border-color: rgb(55 65 81);
    color: rgb(229 231 235);
}
.dark .is-nhub-select:focus,
.dark .is-nhub-input:focus {
    border-color: rgb(234 88 12);
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.2);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.is-nhub-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.is-nhub-btn-primary {
    background: rgb(234 88 12);
    color: white;
}
.is-nhub-btn-primary:hover {
    background: rgb(194 65 12);
}

.is-nhub-btn-ghost {
    background: transparent;
    color: rgb(107 114 128);
    border-color: rgb(209 213 219);
}
.is-nhub-btn-ghost:hover {
    background: rgb(243 244 246);
    color: rgb(55 65 81);
}
.dark .is-nhub-btn-ghost {
    color: rgb(156 163 175);
    border-color: rgb(55 65 81);
}
.dark .is-nhub-btn-ghost:hover {
    background: rgb(55 65 81);
    color: rgb(209 213 219);
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.is-nhub-text-muted {
    color: rgb(107 114 128);
}
.dark .is-nhub-text-muted {
    color: rgb(156 163 175);
}

.is-nhub-text-sm { font-size: 13px; }
.is-nhub-text-xs { font-size: 12px; }
.is-nhub-icon-sm { width: 16px; height: 16px; }
.is-nhub-icon-md { width: 20px; height: 20px; }
.is-nhub-icon-xs { width: 12px; height: 12px; }

.is-nhub-addr-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.is-nhub-truncate {
    display: block;
    max-width: 200px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

.is-nhub-status-hint {
    font-size: 11px;
    color: rgb(156 163 175);
    margin-top: 3px;
    line-height: 1.2;
}
.dark .is-nhub-status-hint {
    color: rgb(107 114 128);
}

/* ==========================================================================
   Channel Pills (inline toggles in table rows)
   ========================================================================== */

.is-nhub-channel-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.is-nhub-channel-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    line-height: 1.4;
}

.is-nhub-channel-pill:disabled {
    cursor: default;
    opacity: 0.6;
}

.is-nhub-channel-on {
    background: rgb(220 252 231);
    color: rgb(22 101 52);
    border-color: rgb(187 247 208);
}
.dark .is-nhub-channel-on {
    background: rgba(22, 101, 52, 0.3);
    color: rgb(134 239 172);
    border-color: rgba(22, 101, 52, 0.5);
}

.is-nhub-channel-off {
    background: rgb(243 244 246);
    color: rgb(156 163 175);
    border-color: rgb(229 231 235);
}
.dark .is-nhub-channel-off {
    background: rgba(107, 114, 128, 0.15);
    color: rgb(107 114 128);
    border-color: rgba(107, 114, 128, 0.3);
}

/* Channel checkboxes in edit form */
.is-nhub-channel-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.is-nhub-check-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgb(55 65 81);
    cursor: pointer;
}
.dark .is-nhub-check-label {
    color: rgb(209 213 219);
}

.is-nhub-check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: rgb(59 130 246);
}

/* ==========================================================================
   Push Notification Card
   ========================================================================== */

.is-push-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: white;
    border: 1px solid rgb(229 231 235);
    border-radius: 12px;
    margin-bottom: 24px;
}
.dark .is-push-card {
    background: rgb(17 24 39);
    border-color: rgb(55 65 81);
}

.is-push-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgb(255 247 237) 0%, rgb(254 243 199) 100%);
    border-radius: 12px;
    flex-shrink: 0;
}
.dark .is-push-card-icon {
    background: linear-gradient(135deg, rgb(78 55 22 / 0.4) 0%, rgb(55 42 18 / 0.4) 100%);
}

.is-push-card-icon-svg {
    width: 24px;
    height: 24px;
    color: rgb(234 88 12);
}

.is-push-card-content {
    flex: 1;
    min-width: 0;
}

.is-push-card-title {
    font-size: 15px;
    font-weight: 600;
    color: rgb(17 24 39);
    margin: 0 0 4px;
}
.dark .is-push-card-title {
    color: rgb(243 244 246);
}

.is-push-card-desc {
    font-size: 13px;
    color: rgb(107 114 128);
    margin: 0;
    line-height: 1.5;
}
.dark .is-push-card-desc {
    color: rgb(156 163 175);
}

.is-push-card-status-on {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: rgb(22 101 52);
    background: rgb(220 252 231);
    padding: 1px 8px;
    border-radius: 9999px;
    margin-left: 4px;
}
.dark .is-push-card-status-on {
    background: rgba(22, 101, 52, 0.25);
    color: rgb(134 239 172);
}

.is-push-card-status-off {
    display: inline-flex;
    font-size: 12px;
    font-weight: 500;
    color: rgb(156 163 175);
    font-style: italic;
}

.is-push-card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.is-push-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.is-push-btn-enable {
    background: rgb(234 88 12);
    color: white;
}
.is-push-btn-enable:hover {
    background: rgb(194 65 12);
}

.is-push-btn-disable {
    background: transparent;
    color: rgb(107 114 128);
    border-color: rgb(209 213 219);
}
.is-push-btn-disable:hover {
    background: rgb(254 226 226);
    color: rgb(220 38 38);
    border-color: rgb(252 165 165);
}
.dark .is-push-btn-disable {
    color: rgb(156 163 175);
    border-color: rgb(55 65 81);
}
.dark .is-push-btn-disable:hover {
    background: rgb(127 29 29 / 0.3);
    color: rgb(252 165 165);
    border-color: rgb(127 29 29);
}

@media (max-width: 768px) {
    .is-push-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .is-push-card-actions {
        width: 100%;
    }
    .is-push-btn {
        flex: 1;
        justify-content: center;
    }
}

/* ==========================================================================
   User Preferences — Collapsible Sections
   ========================================================================== */

.is-pref-section {
    background: white;
    border: 1px solid rgb(229 231 235);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}
.dark .is-pref-section {
    background: rgb(17 24 39);
    border-color: rgb(55 65 81);
}

.is-pref-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    cursor: pointer;
    user-select: none;
    list-style: none;
}
.is-pref-section-header::-webkit-details-marker {
    display: none;
}
.is-pref-section-header:hover {
    background: rgb(249 250 251);
}
.dark .is-pref-section-header:hover {
    background: rgb(31 41 55);
}

.is-pref-section-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.is-pref-chevron {
    width: 16px;
    height: 16px;
    color: rgb(156 163 175);
    transition: transform 0.2s ease;
}
details[open] > .is-pref-section-header .is-pref-chevron {
    transform: rotate(90deg);
}

.is-pref-section-body {
    border-top: 1px solid rgb(229 231 235);
}
.dark .is-pref-section-body {
    border-color: rgb(55 65 81);
}

.is-pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    gap: 16px;
    border-bottom: 1px solid rgb(243 244 246);
}
.is-pref-row:last-child {
    border-bottom: none;
}
.is-pref-row:hover {
    background: rgb(249 250 251);
}
.dark .is-pref-row {
    border-color: rgb(31 41 55);
}
.dark .is-pref-row:hover {
    background: rgb(31 41 55);
}

.is-pref-row-info {
    flex: 1;
    min-width: 0;
}

.is-pref-row-title {
    font-size: 13px;
    font-weight: 600;
    color: rgb(17 24 39);
    display: block;
}
.dark .is-pref-row-title {
    color: rgb(243 244 246);
}

.is-pref-row-desc {
    font-size: 12px;
    color: rgb(107 114 128);
    margin: 2px 0 0;
    line-height: 1.3;
}
.dark .is-pref-row-desc {
    color: rgb(156 163 175);
}

.is-pref-row-channels {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
