/* ============================================================
   FallGuard Card View Styles
   ============================================================ */

/* Filter Toolbar */
.fg-filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
    background: var(--dx-blazor-bg, #fff);
    border-bottom: 1px solid var(--dx-blazor-border-color, #e0e0e0);
    align-items: flex-end;
}

.fg-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.fg-filter-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #78909c;
}

.fg-filter-combo {
    min-width: 150px;
}

.fg-filter-date {
    min-width: 130px;
}

.fg-filter-actions {
    flex-direction: row;
    gap: 8px;
    align-items: flex-end;
}

.fg-filter-btn {
    min-width: 80px;
}

/* Timeline layout (vertical list) */
.fg-card-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    max-width: 900px;
    margin: 0 auto;
}

/* Grid layout (for non-timeline views) */
.fg-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
    padding: 16px;
}

/* Card wrapper */
.fg-card-wrapper {
    position: relative;
    cursor: pointer;
    border-radius: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

    .fg-card-wrapper:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    }

/* Base card */
.fg-card {
    display: flex;
    flex-direction: row;
    background: var(--dx-blazor-bg, #fff);
    border: 1px solid var(--dx-blazor-border-color, #e0e0e0);
    border-radius: 12px;
    overflow: hidden;
    min-height: 120px;
}

/* Left color stripe */
.fg-card-stripe {
    width: 5px;
    flex-shrink: 0;
}

.stripe-success {
    background: #4caf50;
}

.stripe-warning {
    background: #ff9800;
}

.stripe-danger {
    background: #f44336;
}

.stripe-emergency {
    background: #d50000;
    animation: pulse-stripe 1.5s ease-in-out infinite;
}

.stripe-info {
    background: #2196f3;
}

.stripe-muted {
    background: #bdbdbd;
}

@keyframes pulse-stripe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Card content */
.fg-card-content {
    flex: 1;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

/* Header row */
.fg-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Icon */
.fg-card-icon {
    flex-shrink: 0;
    color: #546e7a;
}

.fg-card-icon-round {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.icon-bg-info {
    background: rgba(33,150,243,0.12);
}

.icon-bg-warning {
    background: rgba(255,152,0,0.12);
}

.icon-bg-danger {
    background: rgba(244,67,54,0.12);
}

.icon-bg-emergency {
    background: rgba(213,0,0,0.18);
}

.icon-bg-success {
    background: rgba(76,175,80,0.12);
}

.icon-bg-muted {
    background: rgba(0,0,0,0.06);
}

/* Avatar (Person card) */
.fg-card-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Titles */
.fg-card-titles {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.fg-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--dx-blazor-text-color, #212121);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fg-card-subtitle {
    font-size: 0.78rem;
    color: #78909c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badges */
.fg-card-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.fg-card-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-success {
    background: rgba(76,175,80,0.12);
    color: #2e7d32;
}

.badge-warning {
    background: rgba(255,152,0,0.12);
    color: #e65100;
}

.badge-danger {
    background: rgba(244,67,54,0.12);
    color: #c62828;
}

.badge-emergency {
    background: rgba(213,0,0,0.18);
    color: #d50000;
    animation: pulse-badge 1.5s ease-in-out infinite;
}

.badge-info {
    background: rgba(33,150,243,0.12);
    color: #1565c0;
}

.badge-muted {
    background: rgba(0,0,0,0.06);
    color: #78909c;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Body */
.fg-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Row */
.fg-card-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* Detail item */
.fg-card-detail {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.fg-card-detail-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.fg-card-detail-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #90a4ae;
    font-weight: 500;
}

.fg-card-detail-value {
    font-size: 0.82rem;
    color: var(--dx-blazor-text-color, #37474f);
    font-weight: 500;
}

.fg-card-detail-highlight {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dx-blazor-primary, #1976d2);
}

/* Truncation utility */
.fg-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Footer row with tags */
.fg-card-footer-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.fg-card-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(0,0,0,0.04);
    font-size: 0.72rem;
    color: #546e7a;
}

.fg-card-tag-accent {
    background: rgba(33,150,243,0.08);
    color: #1565c0;
}

.fg-card-tag-danger {
    background: rgba(244,67,54,0.08);
    color: #c62828;
}

/* Battery gauge (Device card) */
.fg-card-metric {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fg-card-metric-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #90a4ae;
    font-weight: 500;
}

.fg-card-metric-value {
    font-size: 0.82rem;
    font-weight: 600;
}

.fg-card-battery {
    width: 50px;
    height: 10px;
    background: rgba(0,0,0,0.08);
    border-radius: 5px;
    overflow: hidden;
}

.fg-card-battery-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.battery-good {
    background: #4caf50;
    color: #2e7d32;
}

.battery-medium {
    background: #ff9800;
    color: #e65100;
}

.battery-low {
    background: #ff5722;
    color: #d84315;
}

.battery-critical {
    background: #f44336;
    color: #c62828;
    animation: pulse-battery 1s ease-in-out infinite;
}

@keyframes pulse-battery {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Online dot (Device card) */
.fg-card-online-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

    .fg-card-online-dot.online {
        background: #4caf50;
        box-shadow: 0 0 6px rgba(76,175,80,0.5);
    }

    .fg-card-online-dot.offline {
        background: #bdbdbd;
    }

/* Escalation level badge (PersonResponsible card) */
.fg-card-escalation-level {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6f00, #ff8f00);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fg-escalation-number {
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
}

/* Geofence color swatch */
.fg-geofence-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
    font-weight: 700;
}

/* Empty state */
.fg-card-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
    color: #90a4ae;
    gap: 12px;
}

.fg-card-empty-icon {
    font-size: 48px;
    opacity: 0.5;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .fg-card-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
    }
}
