/* =============================================================================
   Alert Center Styles (Shared Component)
   ============================================================================= */

#alert-center {
    /* Removed fixed positioning - now works as a flex child */
    width: 100%;
    height: 100%;
    background: #252526;
    border-radius: 8px;
    border: 1px solid #3e3e42;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(30px);
        opacity: 0.55;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #2d2d30;
    border-bottom: 2px solid #4ec9b0;
    border-radius: 8px 8px 0 0;
}

.alert-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-header-left svg {
    color: #569cd6;
}

.alert-header h2 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #569cd6;
}

.alert-header-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #858585;
}

.alert-header-stats .c2-panel-stat span {
    color: #d4d4d4;
    font-weight: 600;
}

.alert-header-stats .c2-panel-stat.critical span {
    color: #f48771;
}

.alert-header-stats .c2-panel-stat-sep {
    color: #3e3e42;
}

.alert-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-disable-btn {
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.4);
    border-radius: 4px;
    color: #f48771;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.alert-disable-btn:hover {
    background: rgba(220, 53, 69, 0.25);
    border-color: rgba(220, 53, 69, 0.6);
}

.sound-toggle {
    background: #3e3e42;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #d4d4d4;
    transition: background 0.2s;
}

.sound-toggle:hover {
    background: #4e4e52;
}

.sound-toggle.muted {
    opacity: 0.5;
}

#alerts-list {
    overflow-y: auto;
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-item {
    background: #1e1e1e;
    border-radius: 6px;
    padding: 14px;
    display: flex;
    gap: 12px;
    border: 1px solid #3e3e42;
    border-left: 3px solid #f48771;
    transition: all 0.2s;
    overflow: visible;
    cursor: pointer;
}

/* Slide-in only on new alerts (class added on creation, removed after animation) */
.alert-item.alert-slide-in {
    animation: alertSlideIn 0.3s ease-out;
}

.alert-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-left-color: #ce9178;
}

/* Alert item animations */
@keyframes alertSlideIn {
    from {
        transform: translateX(50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Disable animation for existing alerts during reorder (e.g., damage updates) */
.alert-item.no-animate {
    animation: none !important;
}

.alert-item.removing {
    animation: alertFadeOut 0.3s ease-out forwards;
}

@keyframes alertFadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
        max-height: 200px;
        margin-bottom: 12px;
    }
    to {
        transform: translateX(50px);
        opacity: 0;
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
}

.alert-entity-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-entity-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-entity-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.alert-entity-name {
    font-size: 14px;
    font-weight: 600;
    color: #ce9178;
    flex: 1;
}

.alert-track-count {
    font-weight: 700;
    color: #ffffff;
    margin-left: 4px;
}

.alert-entity-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #858585;
    padding-left: 32px;
}

.alert-entity-detail {
    display: flex;
    align-items: center;
    gap: 6px;
}

.alert-entity-detail svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Dynamic value elements that update periodically */
.alert-target-name,
.alert-distance-value,
.alert-time-value,
.alert-direction-value {
    color: #d4d4d4;
    font-weight: 500;
}

.alert-distance-value {
    color: #4ec9b0;  /* Cyan for distance */
}

.alert-time-value {
    color: #dcdcaa;  /* Yellow for time */
}

.alert-direction-value {
    color: #c586c0;  /* Purple for direction */
}

/* =============================================================================
   Alert Description Line
   ============================================================================= */

.alert-description {
    font-size: 11px;
    color: #858585;
    padding-left: 32px;
    margin-top: -4px;
}

/* =============================================================================
   Alert Metric Cards (Distance, ETA, HVA)
   ============================================================================= */

.alert-metrics {
    display: flex;
    gap: 8px;
    padding-left: 32px;
}

.alert-metric-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #3e3e42;
    border-radius: 4px;
    min-width: 70px;
}

.alert-metric-card .metric-icon {
    width: 14px;
    height: 14px;
    color: #858585;
}

.alert-metric-card .metric-label {
    font-size: 9px;
    font-weight: 600;
    color: #858585;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alert-metric-card .metric-value {
    font-size: 13px;
    font-weight: 600;
    color: #d4d4d4;
}

.alert-metric-card .metric-value.alert-distance-value {
    color: #4ec9b0;
}

.alert-metric-card .metric-value.alert-time-value {
    color: #dcdcaa;
}

.alert-metric-card .metric-value.alert-target-name {
    color: #c586c0;
    font-size: 11px;
}

.alert-detection-zone {
    background: rgba(0, 100, 200, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    margin-left: 4px;
}

.alert-detection-zone-value {
    color: #4fc3f7;  /* Light blue for detection zone */
    font-weight: 600;
}

.alert-target-label {
    font-size: 11px;
    color: #858585;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

.alert-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
    position: relative;
    align-self: stretch;
}

/* Custom Select Dropdown */
.custom-select {
    position: relative;
    user-select: none;
    z-index: 100;
}

.custom-select-trigger {
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    color: #d4d4d4;
    padding: 8px 28px 8px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-select-trigger::after {
    content: '▼';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #858585;
    transition: transform 0.2s;
}

.custom-select.open .custom-select-trigger::after {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-trigger:hover {
    background: #3e3e42;
    border-color: #4e4e52;
}

.custom-select-trigger.selected {
    color: #4ec9b0;
    font-weight: 500;
}

.custom-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #252526;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.custom-select.open .custom-options {
    display: block;
}

.custom-select.open-upwards .custom-options {
    top: auto;
    bottom: calc(100% + 4px);
}

.custom-option {
    padding: 8px 10px;
    font-size: 12px;
    color: #d4d4d4;
    cursor: pointer;
    transition: all 0.15s;
}

.custom-option:hover {
    background: #0e639c;
    color: white;
}

/* Touch-friendly highlight state (first tap before selection) */
.custom-option.highlighted {
    background: rgba(59, 130, 246, 0.3);
    border-left: 3px solid #3B82F6;
    color: white;
}

.custom-option:first-child {
    border-radius: 5px 5px 0 0;
}

.custom-option:last-child {
    border-radius: 0 0 5px 5px;
}

.custom-option.disabled {
    color: #666;
    font-style: italic;
    cursor: not-allowed;
}

.custom-option.disabled:hover {
    background: transparent;
    color: #666;
}

/* Legacy styles for backwards compatibility */
.alert-sam-select {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    color: #333;
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.alert-sam-select:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.3);
}

.alert-sam-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.alert-sam-select option {
    background: white;
    color: #333;
}

.alert-action-btn {
    background: rgba(220, 53, 69, 0.8);
    border: none;
    border-radius: 6px;
    color: white;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.alert-action-btn:hover {
    background: rgba(220, 53, 69, 1);
}

.alert-action-btn.confirm {
    background: rgba(40, 167, 69, 0.8);
}

.alert-action-btn.confirm:hover {
    background: rgba(40, 167, 69, 1);
}

.alert-empty {
    text-align: center;
    padding: 40px 20px;
    color: #858585;
    font-size: 14px;
}

/* =============================================================================
   Cluster Alert Priority Badges
   ============================================================================= */

.alert-priority-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 8px;
}

.alert-priority-badge.priority-critical {
    background: rgba(220, 53, 69, 0.3);
    color: #f48771;
    border: 1px solid rgba(220, 53, 69, 0.5);
}

.alert-priority-badge.priority-high {
    background: rgba(255, 152, 0, 0.3);
    color: #ffb74d;
    border: 1px solid rgba(255, 152, 0, 0.5);
}

.alert-priority-badge.priority-medium {
    background: rgba(255, 235, 59, 0.3);
    color: #fff176;
    border: 1px solid rgba(255, 235, 59, 0.5);
}

.alert-priority-badge.priority-low {
    background: rgba(76, 175, 80, 0.3);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.5);
}

/* =============================================================================
   Alert Update Animation
   ============================================================================= */

.alert-item.updated {
    animation: alertUpdate 0.3s ease;
}

@keyframes alertUpdate {
    0%, 100% {
        background: #1e1e1e;
    }
    50% {
        background: #3a2a2a;
        border-left-color: #f48771;
    }
}

/* =============================================================================
   Multi-Unit Assignment UI (for cluster alerts)
   ============================================================================= */

.unit-assignments {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.unit-row {
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
    z-index: 1;
}

/* When a dropdown is open, raise its row above others */
.unit-row:has(.custom-select.open) {
    z-index: 100;
}

/* Custom select dropdown in unit rows */
.unit-row .unit-custom-select {
    flex: 1;
}

.unit-row .unit-custom-select .custom-select-trigger {
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    padding: 8px 28px 8px 10px;
    color: #cccccc;
    font-size: 12px;
}

.unit-row .unit-custom-select .custom-select-trigger:hover {
    border-color: #007acc;
}

.unit-row .unit-custom-select .custom-select-trigger.selected {
    color: #4ec9b0;
}

/* Row action buttons (remove and add) */
.remove-unit-btn,
.unit-row .add-unit-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.remove-unit-btn {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #f48771;
}

.remove-unit-btn:hover {
    background: rgba(220, 53, 69, 0.3);
    border-color: rgba(220, 53, 69, 0.6);
}

.unit-row .add-unit-btn {
    background: rgba(78, 201, 176, 0.2);
    border: 1px solid rgba(78, 201, 176, 0.4);
    color: #4ec9b0;
}

.unit-row .add-unit-btn:hover {
    background: rgba(78, 201, 176, 0.3);
    border-color: rgba(78, 201, 176, 0.6);
}

/* Unit actions row (Add Unit + Approve) */
.unit-actions-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.unit-actions-row .add-unit-btn {
    background: rgba(78, 201, 176, 0.1);
    border: 1px solid rgba(78, 201, 176, 0.3);
    border-radius: 4px;
    color: #4ec9b0;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    width: auto;
    height: auto;
    min-width: unset;
}

.unit-actions-row .add-unit-btn:hover {
    background: rgba(78, 201, 176, 0.2);
    border-color: rgba(78, 201, 176, 0.5);
}

.approve-btn {
    background: rgba(40, 167, 69, 0.15);
    border: 1px solid rgba(40, 167, 69, 0.4);
    border-radius: 4px;
    color: #81c784;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: auto;
}

.approve-btn:hover {
    background: rgba(40, 167, 69, 0.25);
    border-color: rgba(40, 167, 69, 0.6);
}

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

.approve-btn.approved {
    background: rgba(78, 201, 176, 0.2);
    border-color: rgba(78, 201, 176, 0.5);
    color: #4ec9b0;
    cursor: default;
}

.approve-btn.edit-mode {
    background: rgba(86, 156, 214, 0.15);
    border-color: rgba(86, 156, 214, 0.4);
    color: #569cd6;
    cursor: pointer;
}

.approve-btn.edit-mode:hover {
    background: rgba(86, 156, 214, 0.25);
    border-color: rgba(86, 156, 214, 0.6);
}

/* Approved state - disabled dropdowns and buttons */
.unit-assignments.approved .unit-custom-select {
    pointer-events: none;
}

.unit-assignments.approved .unit-custom-select .custom-select-trigger {
    background: #1e1e1e;
    border-color: #2d2d30;
    color: #666;
    cursor: not-allowed;
}

.unit-assignments.approved .unit-custom-select .custom-select-trigger::after {
    display: none;
}

.unit-assignments.approved .unit-custom-select .custom-select-trigger.selected {
    color: #5a8a7d;  /* Muted version of the selected color */
}

.unit-assignments.approved .remove-unit-btn,
.unit-assignments.approved .add-unit-btn {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Standalone disabled dropdown class */
.unit-custom-select.disabled {
    pointer-events: none;
}

.unit-custom-select.disabled .custom-select-trigger {
    background: #1e1e1e;
    border-color: #2d2d30;
    color: #666;
    cursor: not-allowed;
}

.unit-custom-select.disabled .custom-select-trigger::after {
    display: none;
}

.unit-custom-select.disabled .custom-select-trigger.selected {
    color: #5a8a7d;
}

/* =============================================================================
   Reported Message Display (from zone data)
   ============================================================================= */

.alert-reported-message {
    width: 100%;
    padding: 6px 10px;
    margin-top: 8px;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 3px;
    font-size: 11px;
    line-height: 1.3;
    color: #93c5fd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

/* Priority-based message colors */
.alert-reported-message.priority-medium {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
}

.alert-reported-message.priority-high,
.alert-reported-message.priority-critical {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Acknowledge button uses same style as Approve (no special styling needed) */

/* =========================================================================
   DEFCON Alert Styling
   ========================================================================= */

.defcon-alert-item {
    border-left: 3px solid #ff9800;
    background: rgba(255, 152, 0, 0.08);
}

.defcon-alert-title {
    font-weight: 600;
    font-size: 12px;
    color: #e2e8f0;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.defcon-alert-message {
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.4;
    margin-bottom: 4px;
}

.defcon-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.defcon-actions {
    display: flex;
    gap: 6px;
    padding-top: 4px;
}

.defcon-actions .approve-btn {
    flex: 1;
}

.decline-btn {
    background: rgba(239, 68, 68, 0.3) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #fca5a5 !important;
}

.decline-btn:hover {
    background: rgba(239, 68, 68, 0.5) !important;
}

.decline-btn.declined {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #94a3b8 !important;
    cursor: default;
}

/* DEFCON badge in alert center header */
#defcon-level-badge {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    transition: background-color 0.3s ease;
}

@keyframes defcon-flash-anim {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.defcon-flash {
    animation: defcon-flash-anim 0.4s ease;
}
