/* ============================================
   NetworkDeviceManagement - Unified Styles
   ============================================ */

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    background-color: #f8f9fa;
}

/* ============================================
   Cards
   ============================================ */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.card-header {
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1rem;
}

.card-header i {
    margin-right: 0.5rem;
}

.card-body.p-0 .table {
    margin-bottom: 0;
}

/* ============================================
   Tables
   ============================================ */
.table thead.table-dark th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 0.75rem;
    background-color: #212529;
}

.table tbody td {
    vertical-align: middle;
    padding: 0.75rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
}

.btn i {
    margin-right: 0.25rem;
}

.btn-sm i {
    margin-right: 0;
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.alert i {
    margin-right: 0.5rem;
}

/* ============================================
   Badges
   ============================================ */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

.badge i {
    margin-right: 0.25rem;
}

/* ============================================
   Forms
   ============================================ */
.form-label {
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: #495057;
}

.form-control:focus,
.form-select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ============================================
   Modals
   ============================================ */
.modal-content {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* ============================================
   Status Indicators
   ============================================ */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-dot.online { background-color: #28a745; }
.status-dot.offline { background-color: #dc3545; }
.status-dot.unknown { background-color: #6c757d; }

/* ============================================
   Empty States
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ============================================
   Bulk Actions
   ============================================ */
.bulk-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============================================
   Selection Highlight
   ============================================ */
.item-selectable,
.device-item {
    transition: background-color 0.2s;
}

.item-selectable:hover,
.device-item:hover {
    background-color: #f8f9fa;
}

.item-selectable.selected,
.device-item.selected {
    background-color: #fff3cd;
}

/* ============================================
   Dashboard Stats
   ============================================ */
.stat-card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.stat-card .stat-icon { font-size: 2.5rem; opacity: 0.8; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; }
.stat-card .stat-label { font-size: 0.9rem; opacity: 0.8; }

/* ============================================
   Tree View (Dashboard)
   ============================================ */
.tree-container {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.tree-header {
    background: linear-gradient(135deg, #212529 0%, #495057 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem 0.5rem 0 0;
}

.tree-search {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.tree-content {
    padding: 0;
    max-height: calc(100vh - 350px);
    overflow-y: auto;
}

.tree-node { border-bottom: 1px solid #f0f0f0; }
.tree-node:last-child { border-bottom: none; }

.tree-node-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none;
}

.tree-node-header:hover { background-color: #f8f9fa; }
.tree-node-header.expanded { background-color: #e9ecef; }

.tree-node-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
    color: #6c757d;
    transition: transform 0.2s;
}

.tree-node-toggle.expanded { transform: rotate(90deg); }
.tree-node-toggle.no-children { visibility: hidden; }

.tree-node-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    border-radius: 6px;
    font-size: 1rem;
}

.tree-node-content { flex: 1; }
.tree-node-title { font-weight: 600; color: #333; }
.tree-node-subtitle { font-size: 0.8rem; color: #6c757d; }

.tree-node-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.tree-node-header:hover .tree-node-actions { opacity: 1; }

.tree-children {
    display: none;
    padding-left: 0;
    background: #fafafa;
}

.tree-children.expanded { display: block; }
.tree-children .tree-node-header { padding-left: 2.5rem; }
.tree-children .tree-children .tree-node-header { padding-left: 4rem; }
.tree-children .tree-children .tree-children .tree-node-header { padding-left: 5.5rem; }

.tree-loading, .tree-empty {
    padding: 1rem 2rem;
    text-align: center;
    color: #6c757d;
}

.node-icon-customer { background: #e3f2fd; color: #1976d2; }
.node-icon-location { background: #e8f5e9; color: #388e3c; }
.node-icon-device { background: #fff3e0; color: #f57c00; }
.node-icon-child { background: #fce4ec; color: #c2185b; }

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-results.show { display: block; }

.search-result-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-result-item:hover { background-color: #f8f9fa; }

.search-result-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    margin-right: 0.5rem;
}

.search-result-type.customer { background: #e3f2fd; color: #1976d2; }
.search-result-type.location { background: #e8f5e9; color: #388e3c; }
.search-result-type.device { background: #fff3e0; color: #f57c00; }

/* Footer */
.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60px;
    line-height: 60px;
    background-color: #f5f5f5;
}
