/* Custom Styles for Drone Detection App */

:root {
    --bg-dark: #1a1d23;
    --bg-dark-lighter: #242831;
    --border-color: #3a3f4b;
    --text-light: #e4e6eb;
    --text-muted: #8b8d95;
    --highlight-glow: rgba(255, 193, 7, 0.3);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.container-fluid {
    max-width: 100%;
    padding: 0.25rem;
}

/* Scroll container optimization */
#scroll-container {
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Card Styles - Optimized for narrow vertical layout */
.drone-card {
    background-color: var(--bg-dark-lighter);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
    position: relative;
    width: 100%;
    max-width: 400px;
    max-height: 160px;
    display: flex;
    flex-direction: row;
    margin: 0 auto;
}

.drone-card:hover {
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* New Detection Highlighting (temporary, 3 seconds) */
.drone-card.new-detection {
    border: 2px solid #00ff88 !important;
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.4);
    animation: newDetectionPulse 0.5s ease-out;
}

@keyframes newDetectionPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 25px rgba(0, 255, 136, 0.6);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 35px rgba(0, 255, 136, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 25px rgba(0, 255, 136, 0.4);
    }
}

/* API-Triggered Persistent Highlighting */
.drone-card.api-highlighted {
    border: 2px solid #ffc107 !important;
    box-shadow: 0 0 20px var(--highlight-glow);
    animation: apiHighlightPulse 2s infinite;
}

@keyframes apiHighlightPulse {
    0%, 100% {
        box-shadow: 0 0 20px var(--highlight-glow);
    }
    50% {
        box-shadow: 0 0 30px var(--highlight-glow);
    }
}

/* Aging/Graying out old cards */
.drone-card.aging {
    opacity: 0.5;
    filter: grayscale(50%);
}

.drone-card.aging:hover {
    opacity: 0.8;
    filter: grayscale(30%);
}

/* Remove old highlight class */
.drone-card.highlighted {
    border-color: #ffc107 !important;
    box-shadow: 0 0 20px var(--highlight-glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px var(--highlight-glow);
    }
    50% {
        box-shadow: 0 0 30px var(--highlight-glow);
    }
}

/* NEW badge indicator for new detections */
.new-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #000;
    font-weight: bold;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 3px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 255, 136, 0.6);
    animation: newBadgePulse 0.5s ease-out;
}

@keyframes newBadgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* API highlight indicator - yellow dot */
.api-highlight-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background-color: #ffc107;
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.8);
    animation: blink 1.5s infinite;
}

/* Remove old highlight-indicator */
.highlight-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 16px;
    height: 16px;
    background-color: #ffc107;
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.8);
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.card-img-top {
    width: 140px;
    min-width: 140px;
    height: 100%;
    object-fit: cover;
    background-color: #2c2f36;
}

.card-body {
    padding: 0.4rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    min-width: 0;
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.2rem;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-footer {
    background-color: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-color);
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
}

/* Detection Info Styles */
.detection-info {
    font-size: 0.7rem;
    line-height: 1.2;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.15rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    gap: 0.3rem;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row strong {
    font-size: 0.65rem;
    min-width: 50px;
    flex-shrink: 0;
}

.info-row span {
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.info-label {
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: 0.5rem;
}

.info-value {
    color: var(--text-light);
    text-align: right;
    word-break: break-word;
}

/* Badge Styles */
.badge {
    font-size: 0.75rem;
    padding: 0.35em 0.6em;
}

/* Button Styles */
.btn-outline-warning {
    color: #ffc107;
    border-color: #ffc107;
}

.btn-outline-warning:hover {
    background-color: #ffc107;
    color: #000;
}

/* Scrollbar Styles */
.overflow-auto::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.overflow-auto::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

.overflow-auto::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.overflow-auto::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .card-title {
        font-size: 0.8rem;
    }
    
    .detection-info {
        font-size: 0.65rem;
    }
    
    .info-row strong {
        font-size: 0.6rem;
        min-width: 45px;
    }
}

/* Extra narrow screens - ultra compact */
@media (max-width: 400px) {
    .drone-card {
        max-width: 100%;
    }
    
    .card-img-top {
        width: 100px;
        min-width: 100px;
    }
    
    .card-body {
        padding: 0.3rem;
    }
    
    .card-title {
        font-size: 0.75rem;
    }
    
    .detection-info {
        font-size: 0.6rem;
    }
    
    .info-row {
        padding: 0.1rem 0;
    }
}

/* Dark theme text colors */
.text-muted {
    color: var(--text-muted) !important;
}

.text-light {
    color: var(--text-light) !important;
}

/* Card deck spacing */
#card-deck {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
