/* =============================================================
   Station Custom Styles – Unified Material Design
   ============================================================= */

a.btn.header-item.noti-icon {
    display: flex;
    align-items: center;
}

/* ── Page Background ───────────────────────────────────────── */
.page-content {
    background: #f4f6fb;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
    transition: all 0.15s ease;
}
.btn-sm {
    border-radius: 0.375rem;
    padding: 0.3rem 0.75rem;
}
.btn-primary {
    background: #2c3e50;
    border-color: #2c3e50;
}
.btn-primary:hover,
.btn-primary:focus {
    background: #1a252f;
    border-color: #1a252f;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.3);
}
.btn-dark {
    background: #1e293b;
    border-color: #1e293b;
}
.btn-dark:hover,
.btn-dark:focus {
    background: #0f172a;
    border-color: #0f172a;
}
.btn-outline-secondary {
    border-color: #dee2e6;
    color: #495057;
}
.btn-outline-secondary:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #212529;
}

/* ── Cards – Material Tile ─────────────────────────────────── */
.card {
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: #fff;
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.06),
        0 0 1px rgba(0, 0, 0, 0.04);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid #eef0f3;
}
.card .card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1e293b;
}
.card-h-100 {
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.06),
        0 0 1px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ── Avatar / Icon – GLOBAL: No backgrounds anywhere ───────── */
.avatar-title {
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.avatar-sm,
.avatar-md,
.avatar-lg {
    width: auto !important;
    height: auto !important;
    background: transparent !important;
}
.avatar-sm .avatar-title,
.avatar-md .avatar-title,
.avatar-lg .avatar-title {
    width: auto !important;
    height: auto !important;
    background: transparent !important;
}
.avatar-title i {
    font-size: 26px !important;
}

/* Exceptions: keep round bg for empty-state hero icons & auth pages */
.text-center .avatar-lg .avatar-title,
.text-center .avatar-md .avatar-title,
.auth-page .avatar-title,
[class*="auth-"] .avatar-title {
    background: rgba(44, 62, 80, 0.08) !important;
    border-radius: 50% !important;
    width: 4rem !important;
    height: 4rem !important;
}
.text-center .avatar-lg,
.text-center .avatar-md {
    width: 4rem !important;
    height: 4rem !important;
}
.text-center .avatar-lg .avatar-title i,
.text-center .avatar-md .avatar-title i {
    font-size: 24px !important;
}

/* ── Stat Cards – Uniform Size ─────────────────────────────── */
.card-body.py-3 {
    min-height: 80px;
    display: flex;
    align-items: center;
}
.card-body.py-3 > .d-flex {
    width: 100%;
}
.card-body.py-3 i.bx.flex-shrink-0 {
    font-size: 1.5rem;
}
.card-body.py-3 p.text-muted,
.card-body .text-muted.lh-1 {
    font-size: 0.7rem !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-bottom: 0.25rem !important;
}
.card-body.py-3 h4,
.card-body.py-3 h5,
.card-body h4.mb-1,
.card-body h5.mb-0 {
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.1rem;
}

/* ── Tables – Striped, Clean ───────────────────────────────── */
.table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom-width: 1px;
}
.table thead tr,
.table thead th {
    background-color: #f8f9fc !important;
}
.table td {
    vertical-align: middle;
    font-size: 0.8125rem;
    color: #334155;
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(0, 0, 0, 0.015);
}
.table > tbody > tr:hover > * {
    background-color: rgba(44, 62, 80, 0.03);
}
table.dataTable tbody tr:hover {
    background-color: rgba(44, 62, 80, 0.03) !important;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    font-weight: 500;
    letter-spacing: 0.02em;
    border-radius: 0.375rem;
}

/* ── Form Controls ─────────────────────────────────────────── */
.form-control,
.form-select {
    border-radius: 0.5rem;
    border-color: #e2e8f0;
    font-size: 0.8125rem;
}
.form-control:focus,
.form-select:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 0.2rem rgba(148, 163, 184, 0.15);
}
.form-control-sm,
.form-select-sm {
    border-radius: 0.375rem;
}
.form-check-input:checked {
    background-color: #2c3e50;
    border-color: #2c3e50;
}

/* ── Page Titles ───────────────────────────────────────────── */
.page-title-box h4 {
    font-weight: 700;
    color: #1e293b;
}

/* ── Shadows ───────────────────────────────────────────────── */
.shadow-sm {
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.06),
        0 0 1px rgba(0, 0, 0, 0.04) !important;
}

/* ── Channel Cards ─────────────────────────────────────────── */
.channel-card {
    transition: all 0.2s ease;
    border-radius: 0.75rem;
}
.channel-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1) !important;
}

/* ── Sync Tab ──────────────────────────────────────────────── */
#sync-jobs-table th {
    font-size: 0.6875rem;
    padding: 0.5rem 0.75rem;
}
#sync-jobs-table td {
    padding: 0.625rem 0.75rem;
}

/* ── Breadcrumbs ───────────────────────────────────────────── */
.breadcrumb-item a {
    color: #64748b;
    text-decoration: none;
}
.breadcrumb-item a:hover {
    color: #2c3e50;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
    border-radius: 0.5rem;
    border: none;
    font-size: 0.8125rem;
}

/* ── Dropdowns ─────────────────────────────────────────────── */
.dropdown-menu {
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    font-size: 0.8125rem;
}
.dropdown-item {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
}
.dropdown-item:hover {
    background: #f1f5f9;
}
.table-responsive {
    overflow: visible !important;
}
.table-responsive .dropdown-menu {
    position: absolute;
    z-index: 1050;
}
.dataTables_wrapper .table-responsive,
.card-body .table-responsive {
    overflow: visible !important;
}

/* ── DataTables ────────────────────────────────────────────── */
.dataTables_wrapper .dataTables_length select {
    border-radius: 0.375rem;
    border-color: #e2e8f0;
    font-size: 0.8125rem;
    padding: 0.25rem 2rem 0.25rem 0.5rem;
}
.dataTables_wrapper .dataTables_filter input {
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 0.2rem rgba(148, 163, 184, 0.15);
    outline: none;
}
.dataTables_wrapper .dataTables_info {
    font-size: 0.8125rem;
    color: #64748b;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 0.375rem !important;
    margin: 0 2px;
    font-size: 0.8125rem;
    border-color: #e2e8f0 !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #2c3e50 !important;
    border-color: #2c3e50 !important;
    color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f1f5f9 !important;
    border-color: #dee2e6 !important;
    color: #1e293b !important;
}
.dataTables_wrapper .dataTables_processing {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
}
table.dataTable thead .sorting:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting_desc:after {
    opacity: 0.3;
}
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:after {
    opacity: 0.8;
}
table.dataTable.no-footer {
    border-bottom: none;
}

/* ── Mapping / Search ──────────────────────────────────────── */
.variant-results {
    position: relative;
    z-index: 1060;
}
.variant-dropdown {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 260px;
    overflow-y: auto;
    z-index: 1070;
}
.variant-dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.8125rem;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.1s ease;
}
.variant-dropdown-item:last-child {
    border-bottom: none;
}
.variant-dropdown-item:hover {
    background: #f0f7ff;
}

/* ── Pagination ────────────────────────────────────────────── */
.pagination .page-link {
    border-radius: 0.375rem;
    margin: 0 2px;
    font-size: 0.8125rem;
    color: #64748b;
    border-color: #e2e8f0;
}
.pagination .page-item.active .page-link {
    background: #2c3e50;
    border-color: #2c3e50;
}

/* ── Pill Tag Input ────────────────────────────────────────── */
.pill-tag-input {
    background: #fff;
    transition: border-color 0.15s ease;
}
.pill-tag-input:focus-within {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
}
.pill-tag .btn-close {
    filter: none;
    opacity: 0.5;
    transition: opacity 0.15s;
}
.pill-tag .btn-close:hover {
    opacity: 1;
}

/* ── Product Form Cards ────────────────────────────────────── */
.row.g-3 > .col-xl-8 > .card + .card,
.row.g-3 > .col-xl-4 > .card + .card,
.row.g-4 > .col-xl-8 > .card + .card,
.row.g-4 > .col-xl-4 > .card + .card {
    margin-top: 0.75rem;
}

/* ── Category Tree ─────────────────────────────────────────── */
.category-indent {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ── Sync Job Icons ────────────────────────────────────────── */
.job-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 16px;
    flex-shrink: 0;
}

/* ── Nav Tabs ──────────────────────────────────────────────── */
.nav-tabs-custom .nav-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
}
.nav-tabs-custom .nav-link.active {
    color: #1e293b;
    font-weight: 600;
}

/* ── Filter Buttons ────────────────────────────────────────── */
.financial-filter,
.status-filter,
.filter-btn {
    border-radius: 20px !important;
    padding: 0.25rem 0.875rem !important;
    font-size: 0.75rem !important;
}

/* ── Platform / Selection Cards ────────────────────────────── */
.platform-card {
    transition: all 0.15s ease;
}
.platform-card:hover {
    border-color: #94a3b8 !important;
}
.platform-card.border-primary {
    border-color: #2c3e50 !important;
    box-shadow: 0 0 0 1px #2c3e50;
}
.platform-card .avatar-md .avatar-title {
    background: rgba(44, 62, 80, 0.08) !important;
    border-radius: 50% !important;
    width: 3.5rem !important;
    height: 3.5rem !important;
}
.platform-card .avatar-md {
    width: 3.5rem !important;
    height: 3.5rem !important;
}

/* ── Migration progress ────────────────────────────────────── */
.progress {
    border-radius: 4px;
    background: #e9ecef;
}

button#bulk-delete-btn,
button#bulk-clear-btn {
    padding: 0 !important;
    margin: 0 !important;
    height: 21px !important;
    padding-right: 2px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ── Notification Dropdown Fix ─────────────────────────────── */
#notification-dropdown .dropdown-menu,
#notification-dropdown .dropdown-menu.dropdown-menu-lg {
    width: 320px !important;
    max-width: 320px !important;
    min-width: 320px !important;
    overflow: hidden !important;
    right: 0 !important;
    left: auto !important;
    transform: translate3d(0, 0, 0) !important;
}
#notification-dropdown .notification-item {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    display: block;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
#notification-dropdown .notification-item .d-flex {
    width: 100%;
    overflow: hidden;
}
#notification-dropdown .notification-item h6 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.35;
    font-size: 12px !important;
    margin: 0 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
#notification-dropdown .notification-item .flex-grow-1 {
    min-width: 0;
    overflow: hidden;
    width: 0;
    flex: 1;
}
#notification-dropdown .notification-item .flex-shrink-0 {
    flex-shrink: 0;
}

/* =============================================================
   Dark Mode Overrides
   ============================================================= */
[data-bs-theme="dark"] .page-content {
    background: #1a1d21;
}
[data-bs-theme="dark"] .card {
    background: #212529;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.15);
}
[data-bs-theme="dark"] .card-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
[data-bs-theme="dark"] .card .card-title {
    color: #e2e8f0;
}
[data-bs-theme="dark"] .card-h-100 {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.08);
}
[data-bs-theme="dark"] .card-body.py-3 h4,
[data-bs-theme="dark"] .card-body.py-3 h5,
[data-bs-theme="dark"] .card-body h4.mb-1,
[data-bs-theme="dark"] .card-body h5.mb-0 {
    color: #e2e8f0;
}
[data-bs-theme="dark"] .table th {
    color: #94a3b8;
}
[data-bs-theme="dark"] .table thead tr,
[data-bs-theme="dark"] .table thead th {
    background-color: #1e2328 !important;
}
[data-bs-theme="dark"] .table td {
    color: #cbd5e1;
}
[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, 0.02);
}
[data-bs-theme="dark"] .table > tbody > tr:hover > * {
    background-color: rgba(255, 255, 255, 0.04);
}
[data-bs-theme="dark"] table.dataTable tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #2b3035;
    border-color: #495057;
    color: #e2e8f0;
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    border-color: #6c757d;
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.2);
}
[data-bs-theme="dark"] .dropdown-menu {
    background: #2b3035;
    border-color: #495057;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
[data-bs-theme="dark"] .dropdown-item {
    color: #cbd5e1;
}
[data-bs-theme="dark"] .dropdown-item:hover {
    background: #343a40;
    color: #f8f9fa;
}
[data-bs-theme="dark"] .page-title-box h4 {
    color: #e2e8f0;
}
[data-bs-theme="dark"] .breadcrumb-item a {
    color: #94a3b8;
}
[data-bs-theme="dark"] .breadcrumb-item a:hover {
    color: #e2e8f0;
}
[data-bs-theme="dark"] .nav-tabs-custom .nav-link {
    color: #94a3b8;
}
[data-bs-theme="dark"] .nav-tabs-custom .nav-link.active {
    color: #f8f9fa;
}
[data-bs-theme="dark"] .variant-dropdown {
    background: #2b3035;
    border-color: #495057;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
[data-bs-theme="dark"] .variant-dropdown-item {
    border-bottom-color: #343a40;
}
[data-bs-theme="dark"] .variant-dropdown-item:hover {
    background: #343a40;
}
[data-bs-theme="dark"] .pill-tag-input {
    background: #2b3035;
}
[data-bs-theme="dark"] .progress {
    background: #343a40;
}
[data-bs-theme="dark"] .btn-outline-secondary {
    border-color: #495057;
    color: #adb5bd;
}
[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background: #343a40;
    border-color: #6c757d;
    color: #f8f9fa;
}
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #495057;
}
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background: #2b3035;
    border-color: #495057;
    color: #e2e8f0;
}
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input:focus {
    border-color: #6c757d;
}
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background: #2b3035;
    border-color: #495057;
    color: #e2e8f0;
}
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_info {
    color: #94a3b8;
}
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    border-color: #495057 !important;
    color: #adb5bd !important;
}
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #343a40 !important;
    border-color: #6c757d !important;
    color: #f8f9fa !important;
}
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_processing {
    background: rgba(33, 37, 41, 0.9);
}
[data-bs-theme="dark"] .pagination .page-link {
    color: #adb5bd;
    border-color: #495057;
    background: #2b3035;
}
[data-bs-theme="dark"] .shadow-sm {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.15) !important;
}
[data-bs-theme="dark"] .bg-light {
    background-color: #2b3035 !important;
}
[data-bs-theme="dark"] .text-muted {
    color: #8b95a5 !important;
}
[data-bs-theme="dark"] .border {
    border-color: rgba(255, 255, 255, 0.1) !important;
}
[data-bs-theme="dark"] .border-bottom {
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}
[data-bs-theme="dark"] .border-top {
    border-top-color: rgba(255, 255, 255, 0.1) !important;
}
[data-bs-theme="dark"] .alert {
    border: 1px solid rgba(255, 255, 255, 0.08);
}
[data-bs-theme="dark"] .platform-card .avatar-md .avatar-title {
    background: rgba(255, 255, 255, 0.08) !important;
}
[data-bs-theme="dark"] .text-center .avatar-lg .avatar-title,
[data-bs-theme="dark"] .text-center .avatar-md .avatar-title {
    background: rgba(255, 255, 255, 0.08) !important;
}

/* Channel type selector grid */
.channel-type-option {
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.channel-type-option:hover {
    border-color: var(--bs-primary) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.channel-type-option.border-primary {
    box-shadow: 0 0 0 1px var(--bs-primary);
}
