/* OP25 Shared Component Styles - 29 JAN 2026 */
/* Badges, Cards, Tables, Modals, Buttons, Tabs, Forms, Status Indicators */

/* ========================================
   HEADER COMPONENTS
   ======================================== */
.site-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.back-link:hover {
    background: var(--bg-card-hover);
    color: var(--accent-orange);
}

.back-link svg {
    width: 18px;
    height: 18px;
}

.header-logo {
    width: 40px;
    height: 40px;
}

.header-titles {
    flex: 1;
}

.header-brand {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent-orange);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.header-brand:hover {
    color: var(--accent-yellow);
}

.header-area {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0;
}

/* ========================================
   STATUS INDICATORS
   ======================================== */
.status {
    font-size: 12px;
    color: #888;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-card);
    border-radius: 20px;
}

.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #888;
}

.status.connected {
    color: var(--accent-green);
}

.status.connected::before {
    background: var(--accent-green);
    animation: blink 2s ease-in-out infinite;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ========================================
   TABS
   ======================================== */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-subtle);
    flex-wrap: wrap;
}

.tab {
    font-family: 'IBM Plex Mono', monospace;
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: #fff;
    border-bottom-color: var(--accent-orange);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    font-family: 'IBM Plex Mono', monospace;
    background: var(--bg-card);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--bg-card-hover);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-play {
    background: var(--accent-orange);
}

.btn-play:hover {
    background: var(--accent-red);
}

.btn-primary {
    background: var(--accent-orange);
}

.btn-primary:hover {
    background: #ff5722;
}

.btn-ack {
    background: #6366f1;
}

.btn-ack:hover {
    background: #4f46e5;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-danger {
    background: var(--accent-red);
}

.btn-danger:hover {
    background: #dc2626;
}

/* ========================================
   TABLES
   ======================================== */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--bg-deep);
}

th {
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:hover {
    background: var(--bg-card-hover);
}

.transcript-text {
    max-width: 500px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tg-tag {
    color: var(--accent-yellow);
}

/* Compact table variant */
.compact-table {
    font-size: 0.8rem;
}

.compact-table th,
.compact-table td {
    padding: 8px;
    text-align: center;
    vertical-align: middle;
}

.compact-table tr:nth-child(even) {
    background: var(--bg-deep);
}

.compact-table tr:nth-child(odd) {
    background: var(--bg-primary);
}

/* ========================================
   CARDS
   ======================================== */
.card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--border-subtle);
    transition: all 0.2s;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

/* ========================================
   TALKGROUP BADGES
   ======================================== */
.tg-badge,
.incident-tg-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 8px;
    text-transform: uppercase;
}

/* Police - Blue */
.tg-badge.tg-police,
.incident-tg-badge.tg-police {
    background: rgba(59,130,246,0.3);
    color: #60a5fa;
}

/* Fire - Red */
.tg-badge.tg-fire,
.incident-tg-badge.tg-fire {
    background: rgba(239,68,68,0.3);
    color: #fca5a5;
}

/* EMS - Yellow/Amber */
.tg-badge.tg-ems,
.incident-tg-badge.tg-ems {
    background: rgba(255,194,52,0.3);
    color: #fcd34d;
}

/* Dispatch - Orange */
.tg-badge.tg-dispatch,
.incident-tg-badge.tg-dispatch {
    background: rgba(255,107,53,0.3);
    color: #fdba74;
}

/* Other - Gray */
.tg-badge.tg-other,
.incident-tg-badge.tg-other {
    background: rgba(107,114,128,0.3);
    color: #9ca3af;
}

/* ========================================
   INCIDENT CARDS
   ======================================== */
.incident-card {
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
    border-left: 4px solid #6b7280;
    border: 1px solid var(--border-subtle);
    border-left-width: 4px;
}

.incident-card.tg-police {
    border-left-color: #3b82f6;
    background: linear-gradient(90deg, rgba(59,130,246,0.08) 0%, var(--bg-card) 100%);
}

.incident-card.tg-fire {
    border-left-color: var(--accent-red);
    background: linear-gradient(90deg, rgba(255,59,59,0.08) 0%, var(--bg-card) 100%);
}

.incident-card.tg-ems {
    border-left-color: var(--accent-yellow);
    background: linear-gradient(90deg, rgba(255,194,52,0.08) 0%, var(--bg-card) 100%);
}

.incident-card.tg-dispatch {
    border-left-color: var(--accent-orange);
    background: linear-gradient(90deg, rgba(255,107,53,0.08) 0%, var(--bg-card) 100%);
}

.incident-card.tg-other {
    border-left-color: var(--text-muted);
}

.incident-header {
    padding: 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.incident-header:hover {
    background: rgba(255,255,255,0.05);
}

.incident-title {
    font-family: 'Anybody', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.incident-summary {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 8px;
}

.incident-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.incident-time {
    color: var(--text-secondary);
}

.incident-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.incident-status.active {
    background: #059669;
    color: #fff;
}

.incident-status.closed {
    background: #6b7280;
    color: #fff;
}

.incident-category {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    background: rgba(255,107,53,0.15);
    color: var(--accent-orange);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.incident-transcripts {
    display: none;
    border-top: 1px solid var(--border-subtle);
    padding: 16px;
    background: var(--bg-deep);
}

.incident-transcripts.expanded {
    display: block;
}

.incident-transcript {
    padding: 12px;
    background: var(--bg-card);
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid var(--border-subtle);
}

.incident-transcript:last-child {
    margin-bottom: 0;
}

.incident-transcript-meta {
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}

.incident-transcript-text {
    color: #eee;
}

.incident-location {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-yellow);
}

.incident-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.incident-filters select {
    font-family: 'IBM Plex Mono', monospace;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.incident-filters select:hover {
    border-color: var(--accent-orange);
}

/* ========================================
   MODALS
   ======================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
}

.modal h2 {
    font-family: 'Anybody', sans-serif;
    margin: 0 0 16px 0;
    color: var(--text-primary);
}

.modal-row {
    margin-bottom: 12px;
}

.modal-label {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.modal-value {
    color: var(--text-primary);
}

.modal-transcript {
    background: var(--bg-deep);
    padding: 16px;
    border-radius: 8px;
    line-height: 1.6;
    border: 1px solid var(--border-subtle);
}

.modal audio {
    width: 100%;
    margin-top: 16px;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

/* ========================================
   FORMS
   ======================================== */
input[type="text"],
input[type="number"],
input[type="search"],
select {
    font-family: 'IBM Plex Mono', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

input:focus,
select:focus {
    border-color: var(--accent-orange);
    background: var(--bg-card-hover);
}

select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
}

input[type="checkbox"]:checked {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
}

input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 5px;
    width: 4px;
    height: 9px;
    border: solid var(--bg-deep);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.2s ease;
}

input[type="checkbox"]:checked::after {
    opacity: 1;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4b5563;
    transition: .2s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #059669;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* ========================================
   PAGINATION
   ======================================== */
.paging-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.page-info {
    color: var(--text-muted);
    font-size: 13px;
}

/* ========================================
   EMPTY STATES
   ======================================== */
.empty {
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

/* ========================================
   ALERT ROWS
   ======================================== */
tr.alert-row {
    background: #3b1219;
    border-left: 3px solid var(--accent-red);
}

tr.alert-row:hover {
    background: #4a1a22;
}

tr.acked {
    opacity: 0.6;
}

.keyword {
    color: var(--accent-red);
    font-weight: bold;
}

/* ========================================
   BADGE
   ======================================== */
.badge {
    background: var(--accent-red);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 14px;
    font-weight: bold;
}

.badge-blue {
    background: #6366f1;
}

/* ========================================
   NOTIFICATION PROMPT
   ======================================== */
.notification-prompt {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border-subtle);
}

.notification-prompt.hidden {
    display: none;
}

/* ========================================
   CALLERS TABLE
   ======================================== */
.caller-name-input {
    background: var(--bg-primary);
    color: #fff;
    border: 1px solid var(--border-subtle);
    padding: 6px 10px;
    border-radius: 4px;
    width: 150px;
    font-family: 'IBM Plex Mono', monospace;
}

.caller-suggested {
    color: var(--accent-yellow);
    font-style: italic;
}

.caller-manual {
    color: var(--accent-green);
}

.confidence-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--bg-primary);
}

/* ========================================
   TALKGROUP ROW DISABLED
   ======================================== */
.tg-row-disabled {
    opacity: 0.5;
}

/* ========================================
   MAP STYLES
   ======================================== */
#map {
    height: 500px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.map-legend {
    background: var(--bg-card);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
}

.map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 16px;
    font-size: 13px;
}

.map-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.marker-active {
    background: #ef4444;
}

.marker-closed {
    background: #6b7280;
}

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */
@media (max-width: 768px) {
    /* Header */
    .site-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .header-logo {
        width: 32px;
        height: 32px;
    }

    .header-titles {
        order: 3;
        width: 100%;
        margin-top: 4px;
    }

    .header-area {
        font-size: 1.1rem;
    }

    .status {
        margin-left: auto;
    }

    /* Tabs */
    .tabs {
        gap: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Cards */
    .incident-header {
        flex-direction: column;
        gap: 12px;
        padding: 14px;
    }

    .incident-header > div:last-child {
        align-self: flex-start;
    }

    .incident-title {
        font-size: 15px;
    }

    .incident-summary {
        font-size: 13px;
    }

    .incident-meta {
        flex-wrap: wrap;
        gap: 8px;
    }

    .incident-tg-badge {
        font-size: 10px;
        padding: 2px 6px;
        margin-right: 4px;
    }

    .incident-transcripts {
        padding: 12px;
    }

    .incident-transcript {
        padding: 10px;
    }

    /* Paging */
    .paging-controls {
        padding: 12px;
        gap: 12px;
    }

    .page-info {
        font-size: 11px;
        text-align: center;
    }

    /* Map */
    #map {
        height: 350px;
    }

    .map-legend {
        font-size: 12px;
    }

    .map-legend-item {
        margin-right: 12px;
    }

    /* Modal */
    .modal-content {
        padding: 16px;
        max-height: 90vh;
    }
}

@media (max-width: 480px) {
    .site-header {
        gap: 10px;
    }

    .back-link {
        width: 32px;
        height: 32px;
    }

    .header-brand {
        font-size: 0.75rem;
    }

    .header-area {
        font-size: 1rem;
    }

    .tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    .incident-status,
    .incident-category {
        font-size: 10px;
        padding: 3px 8px;
    }
}
