/* AI Summary Panel Styles */
/* Positioned same as control-panel (top-right corner of map area) */
.ai-summary-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 420px;
    max-height: calc(100vh - 140px);
    background: rgba(15, 15, 15, 0.95);
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    overflow: hidden;
}

.ai-summary-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ai-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #0f0f0f;
    border-bottom: 1px solid #333;
    border-radius: 10px 10px 0 0;
}

.ai-panel-title {
    color: #00cc66;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-panel-title i {
    font-size: 16px;
}

.ai-panel-actions {
    display: flex;
    gap: 6px;
}

.ai-panel-btn {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.ai-panel-btn:hover {
    background: #333;
    color: #fff;
    border-color: #666;
}

.ai-panel-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.ai-status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #151515;
    border-bottom: 1px solid #2a2a2a;
}

.ai-model-badge {
    background: #2a2a2a;
    color: #888;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-family: monospace;
}

.ai-status {
    color: #666;
    font-size: 12px;
}

.ai-status.active {
    color: #00cc66;
}

.ai-status.active::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #00cc66;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 1s infinite;
}

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

.ai-output {
    flex: 1 1 auto;
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 13px;
    line-height: 1.6;
    color: #ccc;
    min-height: 150px;
}

.ai-output::-webkit-scrollbar {
    width: 6px;
}

.ai-output::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.ai-output::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.ai-output::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.ai-placeholder {
    color: #666;
    text-align: center;
    padding: 40px 20px;
}

.ai-placeholder strong {
    color: #00cc66;
}

.ai-output ul {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-output li {
    margin: 6px 0;
}

.ai-output strong {
    color: #fff;
}

/* AI Structured Output Sections */
.ai-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #2a2a2a;
}

.ai-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.ai-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 10px;
}

.ai-section-header i {
    font-size: 12px;
    color: #00cc66;
}

.ai-section-header.threat i {
    color: #ff6b6b;
}

.ai-section-header.action i {
    color: #00cc66;
}

.ai-section-header.status i {
    color: #0088ff;
}

/* AI Data Tags (matching history log style) */
.ai-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    margin: 3px;
}

.ai-tag i {
    font-size: 11px;
    opacity: 0.85;
}

.ai-tag.node {
    background: rgba(0, 136, 255, 0.15);
    color: #4da6ff;
    border: 1px solid rgba(0, 136, 255, 0.3);
}

.ai-tag.target {
    background: rgba(255, 68, 68, 0.15);
    color: #ff8888;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.ai-tag.action {
    background: rgba(0, 204, 102, 0.15);
    color: #00ff88;
    border: 1px solid rgba(0, 204, 102, 0.3);
}

.ai-tag.action.spoof {
    background: rgba(156, 39, 176, 0.15);
    color: #ce93d8;
    border: 1px solid rgba(156, 39, 176, 0.3);
}

.ai-tag.action.jam {
    background: rgba(255, 152, 0, 0.15);
    color: #ffb74d;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.ai-tag.action.takeover {
    background: rgba(0, 188, 212, 0.15);
    color: #4dd0e1;
    border: 1px solid rgba(0, 188, 212, 0.3);
}

.ai-tag.action.monitor {
    background: rgba(100, 100, 100, 0.15);
    color: #aaa;
    border: 1px solid rgba(100, 100, 100, 0.3);
}

.ai-tag.status {
    background: rgba(255, 255, 255, 0.08);
    color: #aaa;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.ai-tag.status.active {
    background: rgba(0, 204, 102, 0.2);
    color: #00ff88;
    border: 1px solid rgba(0, 204, 102, 0.4);
}

.ai-tag.status.standby {
    background: rgba(136, 136, 136, 0.15);
    color: #aaa;
    border: 1px solid rgba(136, 136, 136, 0.3);
}

.ai-tag.status.offline {
    background: rgba(68, 68, 68, 0.2);
    color: #666;
    border: 1px solid rgba(68, 68, 68, 0.3);
}

.ai-tag.distance {
    background: rgba(100, 100, 100, 0.1);
    color: #999;
    border: 1px solid rgba(100, 100, 100, 0.2);
    font-family: 'Consolas', 'Monaco', monospace;
}

.ai-tag.eta {
    background: rgba(255, 170, 0, 0.15);
    color: #ffcc00;
    border: 1px solid rgba(255, 170, 0, 0.3);
}

.ai-tag.closing {
    background: rgba(255, 68, 68, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(255, 68, 68, 0.4);
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* AI Recommendation Card */
.ai-recommendation {
    background: #1f1f1f;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.ai-recommendation.primary {
    border-color: #00cc66;
    background: linear-gradient(135deg, rgba(0, 204, 102, 0.05), transparent);
}

.ai-recommendation.alternative {
    border-color: #444;
    opacity: 0.8;
}

.ai-recommendation-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ai-recommendation-action {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #00cc66;
}

.ai-recommendation-action i {
    font-size: 16px;
}

.ai-recommendation-arrow {
    color: #666;
    margin: 0 4px;
}

.ai-recommendation-reason {
    font-size: 12px;
    color: #888;
    margin-top: 6px;
    padding-left: 2px;
}

.ai-recommendation-reason i {
    color: #666;
    margin-right: 6px;
}

/* AI Status Grid */
.ai-status-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

/* AI Stats Row */
.ai-stats-row {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.ai-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #888;
}

.ai-stat-value {
    font-weight: 600;
    color: #fff;
}

.ai-stat-value.threat {
    color: #ff6b6b;
}

.ai-stat-value.ok {
    color: #00cc66;
}

/* AI No Threats Message */
.ai-no-threats {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    text-align: center;
}

.ai-no-threats i {
    font-size: 36px;
    color: #00cc66;
    margin-bottom: 12px;
}

.ai-no-threats-title {
    font-size: 16px;
    color: #00cc66;
    margin-bottom: 6px;
}

.ai-no-threats-subtitle {
    font-size: 13px;
    color: #666;
}

/* Light mode support for AI tags */
body.light-mode .ai-section {
    border-bottom-color: #ddd;
}

body.light-mode .ai-section-header {
    color: #666;
}

body.light-mode .ai-recommendation {
    background: #f8f8f8;
    border-color: #ddd;
}

body.light-mode .ai-recommendation.primary {
    border-color: #00aa55;
    background: linear-gradient(135deg, rgba(0, 170, 85, 0.05), transparent);
}

body.light-mode .ai-tag {
    border-width: 1px;
}

body.light-mode .ai-recommendation-action {
    color: #00aa55;
}

body.light-mode .ai-recommendation-reason {
    color: #666;
}

body.light-mode .ai-stat {
    color: #666;
}

body.light-mode .ai-stat-value {
    color: #333;
}

body.light-mode .ai-no-threats i {
    color: #00aa55;
}

body.light-mode .ai-no-threats-title {
    color: #00aa55;
}

body.light-mode .ai-no-threats-subtitle {
    color: #888;
}

.ai-error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 6px;
    padding: 14px;
    color: #ff6b6b;
}

.ai-error i {
    margin-right: 8px;
}

.ai-error code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.ai-cancelled {
    color: #888;
    font-style: italic;
    padding: 10px 0;
}

.ai-panel-footer {
    padding: 14px 16px;
    background: #151515;
    border-top: 1px solid #333;
    border-radius: 0 0 10px 10px;
}

.ai-analyze-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #00cc66, #00aa55);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ai-analyze-btn:hover {
    background: linear-gradient(135deg, #00dd77, #00bb66);
    transform: translateY(-1px);
}

.ai-analyze-btn:active {
    transform: translateY(0);
}

.ai-analyze-btn.loading {
    background: linear-gradient(135deg, #cc4444, #aa3333);
}

.ai-analyze-btn.loading:hover {
    background: linear-gradient(135deg, #dd5555, #bb4444);
}

/* Settings dropdown */
.ai-settings-dropdown {
    position: absolute;
    top: 50px;
    right: 10px;
    background: #0f0f0f;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 14px;
    z-index: 10;
    min-width: 280px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.ai-settings-row {
    margin-bottom: 12px;
}

.ai-settings-row label {
    display: block;
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.ai-settings-row input {
    width: 100%;
    padding: 8px 12px;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 5px;
    color: #fff;
    font-size: 13px;
    font-family: monospace;
}

.ai-settings-row input:focus {
    outline: none;
    border-color: #00cc66;
}

.ai-url-row {
    display: flex;
    gap: 8px;
}

.ai-url-row input {
    flex: 1;
}

.ai-refresh-btn {
    padding: 8px 12px;
    background: #333;
    border: 1px solid #444;
    border-radius: 5px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-refresh-btn:hover {
    background: #444;
    color: #fff;
    border-color: #00cc66;
}

.ai-refresh-btn.spinning i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ai-model-select-container {
    position: relative;
}

.ai-model-select {
    width: 100%;
    padding: 8px 12px;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 5px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.ai-model-select:hover {
    border-color: #666;
}

.ai-model-select:focus {
    outline: none;
    border-color: #00cc66;
}

.ai-model-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-model-select option {
    background: #1a1a1a;
    color: #fff;
    padding: 8px;
}

.ai-settings-save {
    width: 100%;
    padding: 8px 16px;
    background: #333;
    border: 1px solid #444;
    border-radius: 5px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-settings-save:hover {
    background: #444;
    border-color: #00cc66;
}

/* Light mode support */
body.light-mode .ai-summary-panel {
    background: rgba(255, 255, 255, 0.95);
    border-color: #d0d0d0;
}

body.light-mode .ai-panel-header {
    background: #f5f5f5;
    border-color: #ddd;
}

body.light-mode .ai-panel-title {
    color: #00aa55;
}

body.light-mode .ai-panel-btn {
    border-color: #ddd;
    color: #666;
}

body.light-mode .ai-panel-btn:hover {
    background: #eee;
    color: #333;
    border-color: #ccc;
}

body.light-mode .ai-status-bar {
    background: #f8f8f8;
    border-color: #eee;
}

body.light-mode .ai-model-badge {
    background: #eee;
    color: #666;
}

body.light-mode .ai-status {
    color: #888;
}

body.light-mode .ai-output {
    color: #333;
}

body.light-mode .ai-output::-webkit-scrollbar-track {
    background: #f5f5f5;
}

body.light-mode .ai-output::-webkit-scrollbar-thumb {
    background: #ccc;
}

body.light-mode .ai-placeholder {
    color: #888;
}

body.light-mode .ai-output strong {
    color: #000;
}

body.light-mode .ai-panel-footer {
    background: #f5f5f5;
    border-color: #ddd;
}

body.light-mode .ai-settings-dropdown {
    background: #fff;
    border-color: #ddd;
}

body.light-mode .ai-settings-row input {
    background: #f8f8f8;
    border-color: #ddd;
    color: #333;
}

body.light-mode .ai-settings-save {
    background: #eee;
    border-color: #ddd;
    color: #333;
}

body.light-mode .ai-settings-save:hover {
    background: #ddd;
}

body.light-mode .ai-refresh-btn {
    background: #eee;
    border-color: #ddd;
    color: #666;
}

body.light-mode .ai-refresh-btn:hover {
    background: #ddd;
    color: #333;
}

body.light-mode .ai-model-select {
    background-color: #f8f8f8;
    border-color: #ddd;
    color: #333;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

body.light-mode .ai-model-select option {
    background: #fff;
    color: #333;
}

/* AI Action Buttons */
.ai-actions {
    padding: 12px 16px;
    background: #151515;
    border-top: 1px solid #2a2a2a;
}

.ai-actions-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 10px;
}

.ai-actions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-action-btn {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
}

.ai-action-btn.primary {
    background: linear-gradient(135deg, #00cc66, #00aa55);
    color: #fff;
}

.ai-action-btn.primary:hover {
    background: linear-gradient(135deg, #00dd77, #00bb66);
    transform: translateY(-1px);
}

.ai-action-btn.secondary {
    background: #333;
    border: 1px solid #444;
    color: #ccc;
}

.ai-action-btn.secondary:hover {
    background: #444;
    color: #fff;
    border-color: #666;
}

.ai-action-btn.danger {
    background: linear-gradient(135deg, #cc4444, #aa3333);
    color: #fff;
}

.ai-action-btn.danger:hover {
    background: linear-gradient(135deg, #dd5555, #bb4444);
}

/* Settings panel styles for AI */
.ai-model-row {
    display: flex;
    gap: 8px;
}

.ai-model-row select {
    flex: 1;
}

.ai-status-display {
    padding: 12px;
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 13px;
    color: #888;
}

.settings-select {
    width: 100%;
    padding: 8px 12px;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 5px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}

.settings-select:focus {
    outline: none;
    border-color: #00cc66;
}

/* Light mode action buttons */
body.light-mode .ai-actions {
    background: #f5f5f5;
    border-color: #ddd;
}

body.light-mode .ai-action-btn.secondary {
    background: #eee;
    border-color: #ddd;
    color: #333;
}

body.light-mode .ai-action-btn.secondary:hover {
    background: #ddd;
    color: #000;
}

body.light-mode .ai-status-display {
    background: #f8f8f8;
    border-color: #ddd;
    color: #666;
}

body.light-mode .settings-select {
    background: #f8f8f8;
    border-color: #ddd;
    color: #333;
}
