/* TG Agent — Custom styles (Bootstrap 5) */

html { font-size: 14px; }

/* Utility class for flex text truncation */
.min-w-0 { min-width: 0; }

/* Badge colors */
.badge-active { color: #15803d; font-weight: 600; }
.badge-inactive { color: #9ca3af; }
.badge-filtered { color: #dc2626; font-weight: 600; }
[data-bs-theme="dark"] .badge-active { color: #4ade80; }
[data-bs-theme="dark"] .badge-filtered { color: #f87171; }

/* Debug log coloring */
.log-error td { color: var(--bs-danger); }
.log-warning td { color: var(--bs-warning); }
.log-debug td { opacity: 0.5; }

/* Channels table fixed layout */
.channels-table {
    table-layout: fixed;
    width: 100%;
    min-width: 1250px;
}
.channels-table th { white-space: nowrap; }
.channels-table th:nth-child(1), .channels-table td:nth-child(1) { width: 100px; }
.channels-table th:nth-child(2), .channels-table td:nth-child(2) { width: 135px; }
.channels-table th:nth-child(3), .channels-table td:nth-child(3) { width: 110px; }
.channels-table th:nth-child(4), .channels-table td:nth-child(4) { width: 85px; }
.channels-table th:nth-child(5), .channels-table td:nth-child(5) { width: 55px; }
.channels-table th:nth-child(6), .channels-table td:nth-child(6) { width: 80px; }
.channels-table th:nth-child(7), .channels-table td:nth-child(7) { width: 100px; }
.channels-table th:nth-child(8), .channels-table td:nth-child(8) { width: 75px; }
.channels-table th:nth-child(9), .channels-table td:nth-child(9) { width: 70px; }
.channels-table th:nth-child(10), .channels-table td:nth-child(10) { width: 70px; }
.channels-table th:nth-child(11), .channels-table td:nth-child(11) { width: 65px; }
.channels-table th:nth-child(12), .channels-table td:nth-child(12) { width: 175px; }
.channels-table td:nth-child(12) { white-space: nowrap; }
.channels-table td:nth-child(1),
.channels-table td:nth-child(2),
.channels-table td:nth-child(3) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Emoji action buttons (used in channels, search queries) */
.emoji-btn {
    padding: 0.25rem 0.4rem !important;
    font-size: 1rem;
    line-height: 1;
    margin: 0 1px;
    display: inline-flex !important;
    align-items: center;
}

/* Settings tabs */
#settings-tabs {
    gap: 0.25rem;
}
#settings-tabs .nav-link {
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
}

/* Search queries table */
.sq-table {
    table-layout: fixed;
    width: 100%;
    min-width: 900px;
}
.sq-table th { white-space: nowrap; }
.sq-table th:nth-child(1), .sq-table td:nth-child(1) { width: 35%; }
.sq-table th:nth-child(2), .sq-table td:nth-child(2) { width: 5%; }
.sq-table th:nth-child(3), .sq-table td:nth-child(3) { width: 8%; }
.sq-table th:nth-child(4), .sq-table td:nth-child(4) { width: 7%; }
.sq-table th:nth-child(5), .sq-table td:nth-child(5) { width: 9%; }
.sq-table th:nth-child(6), .sq-table td:nth-child(6) { width: 13%; }
.sq-table th:nth-child(7), .sq-table td:nth-child(7) { width: 23%; }
.sq-table td:nth-child(1) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sq-table td:nth-child(7) { white-space: nowrap; }

/* Tooltip hint icons */
.hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1em;
    height: 1.1em;
    border-radius: 50%;
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    font-size: 0.7em;
    font-weight: 700;
    cursor: help;
    vertical-align: middle;
    margin-left: 0.3em;
    position: relative;
}
.hint::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bs-emphasis-color);
    color: var(--bs-body-bg);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.35;
    padding: 0.5em 0.7em;
    border-radius: 0.35rem;
    white-space: normal;
    width: max-content;
    max-width: 260px;
    text-align: left;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 99;
}
.hint::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 1px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--bs-emphasis-color);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 99;
}
.hint:hover::after,
.hint:hover::before { opacity: 1; }
label:first-child .hint::after { left: 0; transform: none; }
label:first-child .hint::before { left: 0.5em; transform: none; }

/* Mobile card layout */
.mobile-cards .card {
    border-radius: 0.5rem;
}
.mobile-cards .card-body {
    padding: 0.6rem 0.75rem;
}
.mobile-cards .card-label {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    margin-bottom: 0;
}
.mobile-cards .card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.4rem;
}

.photo-target-summary {
    min-height: 2.5rem;
}

.photo-target-list {
    max-height: 20rem;
    overflow-y: auto;
}

.photo-target-list .list-group-item {
    text-align: left;
}

.photo-feedback-panel {
    border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
    box-shadow: 0 0.75rem 1.5rem rgba(15, 23, 42, 0.08);
}

.photo-submit-status {
    min-height: 1.25rem;
    margin-top: 0.65rem;
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
}

[data-photo-submit-button].is-busy {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 1;
}

.photo-result-highlight {
    animation: photo-result-pulse 2.4s ease;
    outline: 2px solid rgba(13, 110, 253, 0.3);
    outline-offset: -2px;
}

@keyframes photo-result-pulse {
    0% {
        background-color: rgba(13, 110, 253, 0.18);
    }
    100% {
        background-color: transparent;
    }
}

/* ── Responsive: Tablet (<768px) ── */
@media (max-width: 767.98px) {
    .channels-table,
    .sq-table {
        min-width: 0;
    }

    .emoji-btn {
        min-width: 44px;
        min-height: 44px;
        font-size: 1.15rem;
        justify-content: center;
    }

    #settings-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #settings-tabs .nav-link {
        white-space: nowrap;
    }
}

/* ── Responsive: Phone (<576px) ── */
@media (max-width: 575.98px) {
    html { font-size: 13px; }

    .container, .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    h1 { font-size: 1.4rem; }

    #settings-tabs .nav-link { font-size: 0.8rem; }

    .card-body { padding: 0.75rem; }
}
