/**
 * DataTable overrides + processing spinner + badges.
 * Scoped to pages that render #watchTable / .dataTable.
 */

thead tr th {
    font-size: 14px;
}

.dt-column-order {
    display: none;
}

td:nth-child(2) {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

div.dataTables_wrapper {
    width: 100%;
    overflow-x: auto;
}

#watchTable .dt-type-numeric {
    vertical-align: middle !important;
    text-align: center !important;
}

table.dataTable {
    width: 100%;
    white-space: nowrap;
    background: #fff;
    border-collapse: separate;
    border-spacing: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

table.dataTable thead {
    background-color: #e9f1fb;
}

table.dataTable thead th {
    text-align: center;
    padding: 12px 8px;
    border-bottom: 2px solid #dee2e6;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

table.dataTable tbody td {
    height: 100px;
    text-align: center;
    padding: 10px 8px;
    border-right: 1px solid #dee2e6;
    vertical-align: middle;
    font-size: 13px;
    color: #555;
}

table.dataTable .dt-column-title {
    display: block;
    padding: 16px 0;
    text-align: center;
}

table.dataTable.hover > tbody > tr > *,
table.dataTable.display > tbody > tr > * {
    background: unset !important;
    box-shadow: unset !important;
}

table.dataTable > thead > tr > th,
table.dataTable > thead > tr > td {
    border-bottom: unset;
}

table.dataTable > thead > tr > th {
    border-bottom: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
}

table.dataTable > thead > tr > th:last-child,
table.dataTable > tbody > tr > td:last-child {
    border-right: unset;
}

table.dataTable > tbody > tr > td:first-child {
    position: relative;
}

div.dt-container.dt-empty-footer .dt-scroll-body {
    border-bottom: unset;
}

div.dt-container .dt-scroll {
    border: 1px solid #dee2e6;
}

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: white;
}

.badge-success { background-color: #4CAF50; }
.badge-warning { background-color: #FF9800; }
.badge-danger  { background-color: #F44336; }
.badge-info    { background-color: #2196F3; }

.img-thumbnail {
    width: 90px;
    height: auto;
}

.countImg {
    background: #999;
    max-width: 50px;
    position: absolute;
    top: 0;
    right: 0;
    color: white;
    padding: 0 10px;
}

div.dt-processing > div:last-child > div {
    background: #000;
}

/* --- Generic spinner (used by deep-link / image popup) --- */
#spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 9999;
}

.spinner-border {
    width: 10rem;
    height: 10rem;
    border-radius: 50%;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spin2 {
    0%   { stroke-dasharray: 1, 800;   stroke-dashoffset: 0; }
    50%  { stroke-dasharray: 400, 400; stroke-dashoffset: -200px; }
    100% { stroke-dasharray: 800, 1;   stroke-dashoffset: -800px; }
}

.spin2 {
    transform-origin: center;
    animation:
        spin2 1.5s ease-in-out infinite,
        spin 2s linear infinite;
    animation-direction: alternate;
}
