/**
 * HECTOR ATELIER OS - APPARATEN & HARDWARE MONITOR STYLES
 * High-precision luxury workshop telemetry & device status styling.
 */

/* 1. HEADER STATUS PILL */
.btn-device-status-pill {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    height: 32px !important;
    padding: 0 10px !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    color: #94a3b8 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 0.74rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    box-shadow: none !important;
}

.btn-device-status-pill:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(197, 160, 89, 0.4) !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

/* Pulsing Status Dot */
.device-pulse-dot {
    position: relative;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.device-pulse-dot.online {
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: device-pulse-green 2s infinite;
}

.device-pulse-dot.standby {
    background: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    animation: device-pulse-amber 2.5s infinite;
}

.device-pulse-dot.offline {
    background: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: device-pulse-red 1.5s infinite;
}

@keyframes device-pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes device-pulse-amber {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

@keyframes device-pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 7px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.device-offline-warn-badge {
    background: rgba(239, 68, 68, 0.18) !important;
    color: #f87171 !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    padding: 1px 6px !important;
    border-radius: 5px !important;
    letter-spacing: 0.2px !important;
    box-shadow: none !important;
}

/* 2. EXECUTIVE MODAL STYLES */
.hector-devices-modal-box {
    background: #0b0f19;
    border: 1.5px solid rgba(197, 160, 89, 0.45);
    border-radius: 16px;
    max-width: 860px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 40px rgba(197, 160, 89, 0.12);
    color: #f8fafc;
    animation: devicesFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes devicesFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Modal Header */
.hector-devices-header {
    padding: 20px 24px;
    background: linear-gradient(180deg, #131b2c 0%, #0b0f19 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hector-devices-title-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hector-devices-title-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(197, 160, 89, 0.15);
    border: 1px solid rgba(197, 160, 89, 0.4);
    color: #c5a059;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(197, 160, 89, 0.15);
}

.hector-devices-title {
    font-family: "Cinzel", Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1.2;
    letter-spacing: 0.5px;
}

.hector-devices-subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 3px;
}

.hector-devices-close-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #94a3b8;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.hector-devices-close-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
}

/* Quick Summary Bar */
.hector-devices-summary-bar {
    padding: 12px 24px;
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hector-devices-stats-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    font-size: 0.72rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.stat-chip:hover, .stat-chip.active {
    background: rgba(197, 160, 89, 0.12);
    border-color: #c5a059;
    color: #ffffff;
}

.stat-chip.chip-offline.has-alert {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #fca5a5;
    font-weight: 700;
}

.hector-devices-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-device-action-small {
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-device-action-small:hover {
    background: rgba(197, 160, 89, 0.2);
    border-color: #c5a059;
    color: #ffffff;
}

/* Modal Body / Devices Grid */
.hector-devices-list-body {
    padding: 20px 24px;
    overflow-y: auto;
    max-height: calc(90vh - 180px);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(370px, 1fr));
    gap: 16px;
}

/* Device Card */
.device-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.device-card:hover {
    border-color: rgba(197, 160, 89, 0.45);
    background: rgba(21, 31, 55, 0.85);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.device-card.card-offline {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(30, 16, 20, 0.55);
}

.device-card.card-offline::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: #ef4444;
}

.device-card.card-online::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: #10b981;
}

.device-card.card-standby::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: #f59e0b;
}

.device-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.device-avatar-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.device-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}

.device-card.card-online .device-icon-box {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #10b981;
}

.device-card.card-offline .device-icon-box {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

.device-card.card-standby .device-icon-box {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
    color: #f59e0b;
}

.device-name-wrap {
    display: flex;
    flex-direction: column;
}

.device-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 6px;
}

.device-client-tag {
    font-size: 0.62rem;
    background: rgba(197, 160, 89, 0.2);
    border: 1px solid #c5a059;
    color: #c5a059;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 800;
    text-transform: uppercase;
}

.device-location {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.device-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-online {
    background: rgba(16, 185, 129, 0.16);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-standby {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-offline {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.45);
}

/* Device Metadata Details */
.device-meta-grid {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 0.72rem;
}

.meta-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meta-field-label {
    color: #64748b;
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.meta-field-value {
    color: #cbd5e1;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Warning Banner inside Offline Card */
.device-offline-alert-box {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.72rem;
    color: #fca5a5;
    line-height: 1.35;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* Device Card Footer / Actions */
.device-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-card-action {
    flex: 1;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-card-action:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.btn-card-ping:hover {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
}

.btn-card-toggle-offline {
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.btn-card-toggle-offline:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: #ef4444;
    color: #ffffff;
}

.btn-card-toggle-online {
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.btn-card-toggle-online:hover {
    background: rgba(16, 185, 129, 0.18);
    border-color: #10b981;
    color: #ffffff;
}

/* Ping result toast / feedback */
.ping-feedback {
    font-family: monospace;
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hector-devices-list-body {
        grid-template-columns: 1fr;
        padding: 14px;
    }
    .hector-devices-summary-bar {
        padding: 10px 14px;
    }
    .hector-devices-header {
        padding: 14px;
    }
    .btn-device-status-pill .spotlight-text,
    .btn-device-status-pill span:not(.device-pulse-dot):not(.device-offline-warn-badge) {
        font-size: 0.72rem;
    }
}

