:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --border-color: #334155;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 40px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    width: 90px;
    height: auto;
    margin-right: 12px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
    transition: all 0.3s ease;
}

.header-logo:hover {
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.5));
    transform: scale(1.05);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.header-brand {
    font-size: 0.7em;
    font-weight: 400;
    opacity: 0.85;
    margin-bottom: 1px;
    letter-spacing: 0.5px;
}

.header-content h1 {
    font-size: 1.4em;
    font-weight: 700;
    margin-bottom: 2px;
    line-height: 1.2;
}

.subtitle {
    opacity: 0.85;
    font-size: 0.75em;
    line-height: 1.2;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Summary Cards */
.summary-section {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 8px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--card-bg);
    padding: 12px 10px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 60px;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    font-size: 1.4em;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--bg-color);
    flex-shrink: 0;
}

.card-total .card-icon { background: #1e3a8a; }
.card-assigned .card-icon { background: #312e81; }
.card-good .card-icon { background: #15803d; }
.card-location .card-icon { background: #1e40af; }
.card-shutdown .card-icon { background: #991b1b; }

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

.card-label {
    font-size: 0.6em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
    line-height: 1.2;
}

.card-value {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.2;
}

.card-subtitle {
    font-size: 0.65em;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.3;
}

.card-subtitle.warning {
    color: #f59e0b;
}

.card-subtitle.warning::before {
    content: '⚠️ ';
}

/* Controls Bar */
.controls-bar {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bg-color);
    color: var(--text-color);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.filter-group label {
    font-weight: 500;
    color: var(--text-muted);
    margin-right: 5px;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--text-color);
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.refresh-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.refresh-control label {
    font-weight: 500;
    color: var(--text-muted);
}

.refresh-control select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

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

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-info:hover {
    background-color: #0891b2;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-icon {
    padding: 4px 8px;
    font-size: 14px;
    background-color: transparent;
    border: 1px solid var(--border-color);
    min-width: auto;
}

.btn-icon:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: scale(1.1);
}

.icon {
    font-size: 1.1em;
}

/* Table */
.table-container {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 30px;
}

.badge-table {
    width: 100%;
    border-collapse: collapse;
}

.badge-table thead {
    background-color: #0f172a;
    border-bottom: 2px solid var(--border-color);
}

.badge-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Column width optimization for better space allocation */
.badge-table th:nth-child(1) { width: 40px; }        /* Checkbox */
.badge-table th:nth-child(2) { width: 40px; }        /* Expand icon */
.badge-table th:nth-child(3) { width: 60px; }        /* ACK */
.badge-table th:nth-child(4) { width: 140px; }       /* Badge Name (reduced from auto) */
.badge-table th:nth-child(5) { width: 130px; }       /* Person Name */
.badge-table th:nth-child(6) { width: 80px; }        /* Category */
.badge-table th:nth-child(7) { width: 70px; }        /* Battery */
.badge-table th:nth-child(8) { width: 120px; }       /* Last Message (reduced) */
.badge-table th:nth-child(9) { width: 110px; }       /* Last Beacon Read (reduced) */
.badge-table th:nth-child(10) { width: 90px; }        /* Data Format */
.badge-table th:nth-child(11) { width: 120px; }       /* Last Beacon Scan Time (more space) */
.badge-table th:nth-child(12) { width: 140px; }      /* Current Location */
.badge-table th:nth-child(13) { width: 110px; }      /* Last GPS Time (more space) */
.badge-table th:nth-child(14) { width: 100px; }      /* Last Update */
.badge-table th:nth-child(15) { width: 90px; }       /* Condition */
.badge-table th:nth-child(16) { width: 150px; }      /* Actions */

.badge-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.badge-table th.sortable:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.badge-table .sort-icon {
    margin-left: 5px;
    font-size: 9px;
    opacity: 0.6;
}

.badge-table th.sortable.sorted .sort-icon {
    opacity: 1;
    color: var(--primary-color);
}

.badge-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.badge-table tbody tr {
    transition: background-color 0.2s;
}

.badge-table tbody tr:hover {
    background-color: #334155;
}

.badge-row {
    cursor: pointer;
}

.badge-row.expanded {
    background-color: #334155;
}

.expand-icon {
    font-size: 18px;
    transition: transform 0.3s ease-in-out;
    cursor: pointer;
    user-select: none;
    display: inline-block;
}

.expand-icon.expanded {
    transform: rotate(90deg);
}

/* Badge Name Column */
.badge-name {
    font-weight: 600;
    color: var(--primary-color);
}

/* Muster Warning Icon */
.muster-warning-icon {
    display: inline-block;
    margin-left: 6px;
    font-size: 14px;
    cursor: help;
    vertical-align: middle;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.muster-warning-icon:hover {
    opacity: 1;
}

/* Person Name Column */
.person-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.person-name-text {
    flex: 1;
}

.person-name-empty {
    color: var(--text-muted);
    font-style: italic;
}

.edit-name-btn {
    padding: 4px 8px;
    font-size: 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-name-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Category */
.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.category-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.category-roca {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
    color: white;
}

.category-eni {
    background: linear-gradient(135deg, #fde047 0%, #fbbf24 50%, #f59e0b 100%);
    color: #1f2937;
    font-weight: 700;
}

.category-visitor {
    background: linear-gradient(135deg, #34d399 0%, #10b981 50%, #059669 100%);
    color: white;
}

.category-not-informed {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 50%, #4b5563 100%);
    color: white;
}

.category-empty {
    color: var(--text-muted);
    font-style: italic;
}

/* Battery */
.battery {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Stacked battery layout - bar on top, percentage below */
.battery-stacked {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.battery-bar {
    width: 60px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.battery-fill {
    height: 100%;
    transition: width 0.3s;
}

.battery-high { background: var(--success-color); }
.battery-medium { background: var(--warning-color); }
.battery-low { background: var(--danger-color); }

.battery-text {
    font-weight: 500;
    font-size: 13px;
}

.battery-text-below {
    font-weight: 600;
    font-size: 11px;
    color: var(--text-color);
}

/* Condition Badge */
.condition-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    cursor: help;
    transition: transform 0.2s;
}

.condition-badge:hover {
    transform: scale(1.2);
}

.condition-good {
    background: #064e3b;
    color: #86efac;
}

.condition-bad {
    background: #7f1d1d;
    color: #fca5a5;
}

/* Message Type */
.message-type {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

/* More compact message type badges in table */
.badge-table .message-type {
    padding: 3px 6px;
    font-size: 10px;
    border-radius: 4px;
}

.msg-beacon-scan { background: #1e3a8a; color: #93c5fd; }
.msg-position { background: #312e81; color: #c7d2fe; }
.msg-heartbeat { background: #064e3b; color: #86efac; }
.msg-shutdown { background: #7f1d1d; color: #fca5a5; }
.msg-unknown { background: #334155; color: #94a3b8; }

/* Beacons */
.beacon-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.beacon-chip {
    display: inline-block;
    padding: 6px 12px;
    background: #334155;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    line-height: 1.4;
}

.beacon-id {
    font-weight: 600;
    color: var(--primary-color);
}

/* Compact beacon display in table cells */
.badge-table .beacon-id {
    font-size: 10px;
    padding: 2px 4px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 3px;
    display: inline-block;
    margin: 1px;
}

.badge-table .beacon-rssi {
    font-size: 9px;
}

/* Compact badge name display in table */
.badge-table .badge-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--primary-color);
}

.beacon-mac {
    font-size: 11px;
    color: #8b5cf6;
    font-weight: 600;
    display: inline-block;
}

.beacon-rssi {
    color: var(--text-muted);
    font-size: 11px;
    margin-left: 6px;
}

.no-beacons {
    color: var(--text-muted);
    font-style: italic;
    font-size: 13px;
}

/* Current Location Badges */
.location-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.location-active {
    background: #1e3a8a;
    color: #dbeafe;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
}

.location-unknown {
    background: #475569;
    color: #cbd5e1;
    font-weight: 600;
}

.location-shutdown,
.location-shutdown-out-of-base {
    background: #dc2626;
    color: #ffffff;
    border: 2px solid #991b1b;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.4);
    animation: pulse-red 2s infinite;
}

.location-non-reporting {
    background: #f59e0b;
    color: #ffffff;
    border: 2px solid #d97706;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
    animation: pulse-orange 2s infinite;
}

.location-out-of-base {
    background: #f97316;
    color: #ffffff;
    border: 2px solid #ea580c;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.4);
    animation: pulse-orange 2s infinite;
}

.location-on-base {
    background: #8b5cf6;
    color: #ffffff;
    font-weight: 600;
}

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

@keyframes pulse-red {
    0%, 100% {
        box-shadow: 0 0 10px rgba(220, 38, 38, 0.4);
    }
    50% {
        box-shadow: 0 0 20px rgba(220, 38, 38, 0.7);
    }
}

@keyframes pulse-orange {
    0%, 100% {
        box-shadow: 0 0 10px rgba(249, 115, 22, 0.4);
    }
    50% {
        box-shadow: 0 0 20px rgba(249, 115, 22, 0.7);
    }
}

.info-icon {
    font-size: 14px;
    cursor: help;
    margin-left: 4px;
    opacity: 0.9;
}

.info-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* GPS */
.gps-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 13px;
}

.gps-link:hover {
    text-decoration: underline;
}

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

.gps-source {
    color: #60a5fa;
    font-size: 12px;
    margin-top: 8px;
    margin-bottom: 8px;
}

/* Timestamp */
.timestamp {
    font-size: 13px;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

/* Mode Badge (P/M/S/O) */
.mode-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    min-width: 24px;
    letter-spacing: 0.5px;
}

.mode-permanent {
    background-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.mode-motion {
    background-color: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.mode-standby {
    background-color: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.mode-off {
    background-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.mode-unknown {
    background-color: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.4);
}

/* Recent Data Highlighting - Visual indicator for most recent GPS or BLE data */
.recent-data {
    background-color: rgba(16, 185, 129, 0.15);  /* Subtle green glow (dark mode compatible) */
    color: #10b981;                              /* Success green from design system */
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.3);   /* Green border */
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.2); /* Soft green glow effect */
    transition: all 0.3s ease;                    /* Smooth transitions */
}

.recent-data:hover {
    background-color: rgba(16, 185, 129, 0.25);  /* Slightly brighter on hover */
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

/* Actions */
.actions {
    display: flex;
    gap: 8px;
}

/* Detail Panel */
.detail-row {
    display: none;
}

.detail-row.show {
    display: table-row;
}

.detail-row td {
    padding: 0 !important;
    background: #0f172a;
}

.detail-panel {
    padding: 30px;
    background: #0f172a;
    border-top: 2px solid var(--primary-color);
    width: 100%;
}

.detail-section {
    margin-bottom: 25px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h3 {
    font-size: 16px;
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-item label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item span {
    font-size: 14px;
    font-weight: 500;
}

.detail-beacons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.detail-beacon-card {
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    min-width: 150px;
}

.detail-beacon-card .beacon-id {
    font-size: 18px;
    font-weight: 700;
    display: block;
    margin-bottom: 5px;
}

.detail-beacon-card .beacon-rssi {
    font-size: 14px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.2s;
}

.modal.show {
    display: block;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s;
}

.modal-small {
    max-width: 500px;
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    color: var(--text-color);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.close {
    color: var(--text-muted);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

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

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group input[readonly] {
    background-color: var(--bg-color);
    color: var(--text-muted);
}

/* Muster Config */
.config-instructions {
    background: #334155;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.muster-point-item {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.beacon-input-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Footer */
.footer {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 16px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .summary-section {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .header-logo {
        width: 70px;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .header-content h1 {
        font-size: 1.2em;
    }

    .subtitle {
        font-size: 0.7em;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .header-actions .btn {
        width: 100%;
        padding: 10px;
        font-size: 14px;
        justify-content: center;
    }

    .header-actions > div {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .header-actions select {
        width: 100%;
        padding: 10px;
        font-size: 14px;
    }

    .bulk-actions {
        flex-direction: column;
        width: 100%;
        margin-left: 0 !important;
        margin-top: 10px;
    }

    .bulk-actions .btn {
        width: 100%;
    }

    .summary-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .summary-card {
        padding: 10px 12px;
    }

    .card-icon {
        font-size: 1.5em;
        width: 40px;
        height: 40px;
    }

    .card-value {
        font-size: 1.3em;
    }

    .card-label {
        font-size: 0.65em;
    }

    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 15px;
    }

    .search-box {
        width: 100%;
        min-width: auto;
    }

    .search-box input {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .filter-group {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .filter-group label {
        width: 100%;
        margin-bottom: 5px;
    }

    .filter-btn {
        flex: 1;
        min-width: calc(50% - 4px);
        padding: 10px;
        font-size: 12px;
    }

    .refresh-control {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .refresh-control label {
        width: 100%;
    }

    .refresh-control select {
        width: 100%;
        padding: 10px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
    }

    .badge-table {
        min-width: 1200px;
        font-size: 12px;
    }

    .badge-table th,
    .badge-table td {
        padding: 8px 6px;
        font-size: 11px;
    }

    .badge-table th {
        font-size: 10px;
    }

    /* Touch-friendly buttons */
    .btn {
        min-height: 44px;
        padding: 10px 16px;
        font-size: 14px;
    }

    .btn-sm {
        min-height: 36px;
        padding: 8px 12px;
    }

    /* Modal adjustments */
    .modal-content {
        width: 95%;
        margin: 10% auto;
        max-width: none;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px 15px;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    /* Form adjustments */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }

    /* Detail panel adjustments */
    .detail-panel {
        padding: 20px 15px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    /* Footer adjustments */
    .footer-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 12px;
    }

    .header-content h1 {
        font-size: 1em;
    }

    .summary-section {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .summary-card {
        padding: 12px;
    }

    .card-value {
        font-size: 1.5em;
    }

    .filter-btn {
        min-width: 100%;
    }

    .badge-table {
        min-width: 1000px;
        font-size: 11px;
    }

    .badge-table th,
    .badge-table td {
        padding: 6px 4px;
        font-size: 10px;
    }

    .modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }
}

/* ===== Drill Styles ===== */
.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
}

.btn-danger:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.drill-progress {
    margin-bottom: 20px;
}

.drill-status {
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 15px;
}

.drill-status.success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #059669;
}

.drill-status.error {
    background: #7f1d1d;
    color: #fca5a5;
    border: 2px solid #dc2626;
}

.drill-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    padding: 15px;
    background: #334155;
    border-radius: 8px;
}

.drill-summary .summary-item {
    padding: 10px;
    background: var(--card-bg);
    border-radius: 6px;
    text-align: center;
}

.drill-badge-results {
    margin-top: 20px;
}

.drill-badge-results h3 {
    margin-bottom: 15px;
    color: #1f2937;
}

.drill-badge-item {
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #6b7280;
}

.drill-badge-item.success {
    background: #d1fae5;
    border-left-color: #059669;
}

.drill-badge-item.error {
    background: #7f1d1d;
    border-left-color: #dc2626;
}

.drill-badge-item.warning {
    background: #78350f;
    border-left-color: #f59e0b;
}

.drill-badge-header {
    margin-bottom: 5px;
    font-size: 14px;
}

.drill-badge-stats {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #6b7280;
}

.modal-large {
    max-width: 800px;
}

/* Beacon Placements Table */
.beacon-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.beacon-table thead {
    background-color: #0f172a;
    border-bottom: 2px solid var(--border-color);
}

.beacon-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.beacon-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-color);
}

.beacon-table tbody tr:hover {
    background-color: #334155;
}

.beacon-table tbody tr:nth-child(even) {
    background-color: rgba(51, 65, 85, 0.3);
}

/* Loading Progress Bar */
.loading {
    text-align: center;
    padding: 40px 20px;
}

.loading-text {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.loading-progress {
    max-width: 500px;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.progress-text {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 600;
}

/* SOS Control Buttons */
.btn-sos-start:hover {
    background: #dc2626 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-sos-start:active {
    transform: translateY(0);
}

.btn-sos-stop:hover {
    background: #059669 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-sos-stop:active {
    transform: translateY(0);
}

/* Notification animations */
@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Checkbox Styling */
.badge-checkbox,
#selectAllCheckbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.badge-checkbox:hover,
#selectAllCheckbox:hover {
    transform: scale(1.1);
}

/* Bulk Actions Styling */
.bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeInSlide 0.3s ease-out;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#selectedCount {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 14px;
}

.bulk-actions .btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.bulk-actions .btn .icon {
    font-size: 14px;
}

.bulk-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.bulk-actions .btn:active {
    transform: translateY(0);
}

/* Selected Row Highlighting */
.badge-row:has(.badge-checkbox:checked) {
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--primary-color);
}

.badge-row:has(.badge-checkbox:checked):hover {
    background-color: rgba(59, 130, 246, 0.15);
}

/* Checkbox column alignment */
.badge-table th:nth-child(1),
.badge-table td:nth-child(1) {
    text-align: center;
    vertical-align: middle;
}

/* ACK column alignment */
.badge-table th:nth-child(3),
.badge-table td:nth-child(3) {
    text-align: center;
    vertical-align: middle;
}
