/* Enhanced Admin Styling for EcoSyno Platform */

/* Admin Tab Visibility */
#admin-tab-nav {
    display: none !important; /* Hidden by default */
}

body.admin-user #admin-tab-nav {
    display: block !important; /* Shown for admin users */
}

/* Admin Tab Highlight */
body.admin-user #admin-tab-nav .nav-link {
    background-color: rgba(254, 209, 64, 0.2); /* Subtle gold background */
    border: 1px solid rgba(254, 209, 64, 0.3);
    color: #fed140;
    font-weight: 600;
    position: relative;
}

body.admin-user #admin-tab-nav .nav-link::after {
    content: "Admin";
    position: absolute;
    top: -8px;
    right: -5px;
    background-color: #fed140;
    color: #212529;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

body.admin-user #admin-tab-nav .nav-link.active {
    background-color: rgba(254, 209, 64, 0.3);
    border-color: rgba(254, 209, 64, 0.5);
    color: #fff;
}

/* Admin Panel Styling */
.admin-panel {
    display: none; /* Hidden by default */
}

body.admin-user .admin-panel {
    display: block !important; /* Shown for admin users */
}

/* Admin Panels */
#adminControlPanels > div {
    display: none; /* All hidden by default */
}

#defaultAdminPanel {
    display: block; /* Default panel shown */
}

/* Enhanced Admin Card Styling */
.admin-card {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0.3rem 0.8rem rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    background-color: #2a3042;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-card:hover {
    box-shadow: 0 0.5rem 1.2rem rgba(0, 0, 0, 0.18);
    transform: translateY(-5px);
}

.admin-card .card-header {
    background-color: rgba(78, 115, 223, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-card .card-header h5 {
    margin-bottom: 0;
    font-weight: 600;
}

.admin-card .card-header .admin-card-actions {
    display: flex;
    gap: 0.5rem;
}

.admin-card .card-body {
    padding: 1.5rem;
}

/* Admin Dashboard Styling */
.admin-stats-card {
    border-radius: 10px;
    border-left: 4px solid #4e73df;
    transition: all 0.3s ease;
    background-color: rgba(42, 48, 66, 0.8);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.admin-stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1.2rem rgba(0, 0, 0, 0.15);
}

.admin-stats-card .stat-icon {
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 22px;
    margin-bottom: 1rem;
}

.admin-stats-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.admin-stats-card .stat-label {
    color: #a0aec0;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.75px;
}

.admin-stats-card .stat-change {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}

.admin-stats-card .stat-change i {
    margin-right: 0.25rem;
}

.stats-card-primary {
    border-left-color: #4e73df;
}

.stats-card-primary .stat-icon {
    background-color: rgba(78, 115, 223, 0.2);
    color: #4e73df;
}

.stats-card-success {
    border-left-color: #1cc88a;
}

.stats-card-success .stat-icon {
    background-color: rgba(28, 200, 138, 0.2);
    color: #1cc88a;
}

.stats-card-warning {
    border-left-color: #f6c23e;
}

.stats-card-warning .stat-icon {
    background-color: rgba(246, 194, 62, 0.2);
    color: #f6c23e;
}

.stats-card-danger {
    border-left-color: #e74a3b;
}

.stats-card-danger .stat-icon {
    background-color: rgba(231, 74, 59, 0.2);
    color: #e74a3b;
}

.stats-card-info {
    border-left-color: #36b9cc;
}

.stats-card-info .stat-icon {
    background-color: rgba(54, 185, 204, 0.2);
    color: #36b9cc;
}

/* Admin Actions Button Styling */
.admin-action-btn {
    margin-right: 5px;
    transition: all 0.3s ease;
    border-radius: 6px;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.admin-action-btn i {
    font-size: 0.85em;
}

/* Admin Form Elements */
.admin-form-group {
    margin-bottom: 1.5rem;
}

.admin-form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
    color: #e2e8f0;
}

.admin-form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #f8f9fa;
    background-color: #2d3348;
    background-clip: padding-box;
    border: 1px solid #3a4556;
    border-radius: 0.5rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.admin-form-control:focus {
    border-color: #4e73df;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
    outline: 0;
}

/* Admin Toggle Switch */
.admin-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.admin-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.admin-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3a4556;
    transition: .4s;
    border-radius: 30px;
}

.admin-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: #f8f9fa;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .admin-slider {
    background-color: #4e73df;
}

input:focus + .admin-slider {
    box-shadow: 0 0 1px #4e73df;
}

input:checked + .admin-slider:before {
    transform: translateX(30px);
}

/* Admin Tables */
.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
}

.admin-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    background-color: rgba(78, 115, 223, 0.15);
    color: #e2e8f0;
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #3a4556;
    text-align: left;
}

.admin-table td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.03);
}

.admin-table .status-active {
    color: #1cc88a;
    background-color: rgba(28, 200, 138, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.75rem;
    display: inline-block;
}

.admin-table .status-inactive {
    color: #e74a3b;
    background-color: rgba(231, 74, 59, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.75rem;
    display: inline-block;
}

.admin-table .status-pending {
    color: #f6c23e;
    background-color: rgba(246, 194, 62, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.75rem;
    display: inline-block;
}

/* Admin Navigation */
.admin-nav {
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: #2a3042;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.admin-nav .admin-nav-header {
    padding: 1rem 1.25rem;
    background-color: rgba(78, 115, 223, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #e2e8f0;
}

.admin-nav .list-group-item {
    background-color: transparent;
    border: none;
    border-left: 3px solid transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0;
    padding: 0.75rem 1.25rem;
    color: #e2e8f0;
    transition: all 0.2s;
}

.admin-nav .list-group-item:last-child {
    border-bottom: none;
}

.admin-nav .list-group-item:hover {
    border-left-color: #4e73df;
    background-color: rgba(78, 115, 223, 0.1);
}

.admin-nav .list-group-item.active {
    border-left-color: #4e73df;
    background-color: rgba(78, 115, 223, 0.15);
    color: #fff;
    font-weight: 600;
}

.admin-nav .list-group-item i {
    margin-right: 0.75rem;
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
}

/* Admin Tabs */
.admin-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
    padding-bottom: 1px;
}

.admin-tab {
    padding: 0.75rem 1.25rem;
    color: #a0aec0;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

.admin-tab:hover {
    color: #f8f9fa;
}

.admin-tab.active {
    color: #4e73df;
    font-weight: 600;
}

.admin-tab.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: #4e73df;
    border-radius: 3px 3px 0 0;
}

/* Metrics and Charts */
.admin-metric-box {
    background-color: #2a3042;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.admin-metric-box .metric-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-metric-box .metric-title i {
    color: #4e73df;
}

.admin-metric-box .metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #f8f9fa;
}

.admin-metric-box .metric-change {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
}

.admin-metric-box .metric-subtitle {
    font-size: 0.875rem;
    color: #a0aec0;
    margin-bottom: 1rem;
}

.admin-metric-positive {
    color: #1cc88a;
}

.admin-metric-negative {
    color: #e74a3b;
}

/* Admin Tooltips */
.admin-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.admin-tooltip .admin-tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #2a3042;
    color: #f8f9fa;
    text-align: center;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.875rem;
    font-weight: 400;
}

.admin-tooltip .admin-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #2a3042 transparent transparent transparent;
}

.admin-tooltip:hover .admin-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Admin Badge Styles */
.admin-badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 50rem;
}

.admin-badge-primary {
    background-color: #4e73df;
}

.admin-badge-success {
    background-color: #1cc88a;
}

.admin-badge-warning {
    background-color: #f6c23e;
    color: #212529;
}

.admin-badge-danger {
    background-color: #e74a3b;
}

.admin-badge-info {
    background-color: #36b9cc;
}

/* Admin Search */
.admin-search {
    position: relative;
    margin-bottom: 1.5rem;
}

.admin-search input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background-color: #2d3348;
    border: 1px solid #3a4556;
    border-radius: 8px;
    color: #f8f9fa;
    transition: all 0.2s;
}

.admin-search input:focus {
    border-color: #4e73df;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
    outline: none;
}

.admin-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
}

/* Documentation panels */
.admin-doc-panel {
    background-color: rgba(78, 115, 223, 0.05);
    border-left: 4px solid #4e73df;
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.admin-doc-panel-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-doc-panel-title i {
    color: #4e73df;
}

.admin-doc-panel-content {
    color: #a0aec0;
    font-size: 0.875rem;
}

/* Admin button groups */
.admin-btn-group {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
}

.admin-btn-group .admin-btn {
    padding: 0.5rem 1rem;
    background-color: #2d3348;
    border: 1px solid #3a4556;
    color: #e2e8f0;
    margin: 0;
    transition: all 0.2s;
}

.admin-btn-group .admin-btn:not(:last-child) {
    border-right: none;
}

.admin-btn-group .admin-btn.active {
    background-color: #4e73df;
    border-color: #4e73df;
    color: #fff;
    font-weight: 500;
}

.admin-btn-group .admin-btn:hover:not(.active) {
    background-color: #343c5a;
}

/* Admin Tab Content Styles */
.tab-pane {
    transition: opacity 0.3s ease;
}

/* Fix admin tabs position to be at the top */
#adminControlTabs {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 1.5rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background-color: #2a3042;
    padding: 0.5rem 1rem 0;
    border-radius: 8px 8px 0 0;
}

#adminControlTabs .nav-item {
    margin-bottom: -1px;
}

#adminControlTabs .nav-link {
    color: #e2e8f0;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

#adminControlTabs .nav-link:hover {
    background-color: rgba(78, 115, 223, 0.1);
    border-color: rgba(255, 255, 255, 0.05);
}

#adminControlTabs .nav-link.active {
    color: #4e73df;
    background-color: #2d3348;
    border-color: rgba(255, 255, 255, 0.1);
    border-bottom-color: #2d3348;
    font-weight: 600;
}

/* Ensure admin tab panels have proper spacing */
#adminControlTabContent {
    margin-top: 0;
    padding-top: 1.5rem;
    background-color: #2d3348;
    border-radius: 0 0 8px 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    padding: 1.5rem;
}

/* MDM Management Panel Styles */
#admin-mdm-panel .card,
#admin-fields-panel .card {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0.3rem 0.8rem rgba(0, 0, 0, 0.12);
    margin-bottom: 1.5rem;
    background-color: #2a3042;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#admin-mdm-panel .card-header,
#admin-fields-panel .card-header {
    background-color: rgba(78, 115, 223, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
}

#admin-mdm-panel .nav-pills .nav-link,
#admin-fields-panel .nav-pills .nav-link {
    color: #a0aec0;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    margin-right: 0.5rem;
    transition: all 0.2s ease;
}

#admin-mdm-panel .nav-pills .nav-link:hover,
#admin-fields-panel .nav-pills .nav-link:hover {
    color: #f8f9fa;
    background-color: rgba(78, 115, 223, 0.1);
}

#admin-mdm-panel .nav-pills .nav-link.active,
#admin-fields-panel .nav-pills .nav-link.active {
    background-color: #4e73df;
    color: #ffffff;
    font-weight: 500;
}

#admin-mdm-panel .table,
#admin-fields-panel .table {
    color: #e2e8f0;
    margin-bottom: 0;
}

#admin-mdm-panel .table thead th,
#admin-fields-panel .table thead th {
    background-color: rgba(78, 115, 223, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1rem;
}

#admin-mdm-panel .table tbody td,
#admin-fields-panel .table tbody td {
    vertical-align: middle;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#admin-mdm-panel .table-hover tbody tr:hover,
#admin-fields-panel .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

#admin-mdm-panel .badge,
#admin-fields-panel .badge {
    padding: 0.4rem 0.6rem;
    font-weight: 600;
    font-size: 0.75rem;
    border-radius: 6px;
}

#admin-mdm-panel .dropdown-menu,
#admin-fields-panel .dropdown-menu {
    background-color: #2d3348;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

#admin-mdm-panel .dropdown-item,
#admin-fields-panel .dropdown-item {
    color: #e2e8f0;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

#admin-mdm-panel .dropdown-item:hover,
#admin-fields-panel .dropdown-item:hover {
    background-color: rgba(78, 115, 223, 0.1);
    color: #fff;
}

#admin-mdm-panel .dropdown-item i,
#admin-fields-panel .dropdown-item i {
    width: 20px;
    text-align: center;
}

/* Field Template Card Styles */
#admin-fields-panel .field-template-card {
    height: 100%;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background-color: #2d3348;
    transition: all 0.3s ease;
}

#admin-fields-panel .field-template-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-color: rgba(78, 115, 223, 0.5);
}

#admin-fields-panel .field-template-card .card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #e2e8f0;
}

#admin-fields-panel .field-template-card .card-title i {
    color: #4e73df;
}

#admin-fields-panel .field-template-card .card-text {
    color: #a0aec0;
    margin-bottom: 1rem;
}

/* Tab Content Animation */
.tab-content .tab-pane.fade {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tab-content .tab-pane.fade.show {
    opacity: 1;
    transform: translateY(0);
}

/* Bootstrap Tabs Overrides */
.nav-tabs {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-tabs .nav-link {
    color: #a0aec0;
    border: none;
    padding: 0.75rem 1rem;
    margin-right: 0.5rem;
    border-radius: 0.5rem 0.5rem 0 0;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
    color: #f8f9fa;
    border-color: transparent;
    background-color: rgba(78, 115, 223, 0.05);
}

.nav-tabs .nav-link.active {
    color: #4e73df;
    font-weight: 600;
    background-color: transparent;
    border-bottom: 3px solid #4e73df;
}

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

.status-indicator-online {
    background-color: #1cc88a;
    box-shadow: 0 0 5px rgba(28, 200, 138, 0.5);
}

.status-indicator-offline {
    background-color: #e74a3b;
    box-shadow: 0 0 5px rgba(231, 74, 59, 0.5);
}

.status-indicator-idle {
    background-color: #f6c23e;
    box-shadow: 0 0 5px rgba(246, 194, 62, 0.5);
}

/* System Health Indicators */
.system-health-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.system-health-indicator .indicator-label {
    width: 40%;
    font-weight: 500;
    color: #e2e8f0;
}

.system-health-indicator .progress {
    width: 60%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.system-health-indicator .cpu-bar {
    background-color: #4e73df;
}

.system-health-indicator .memory-bar {
    background-color: #1cc88a;
}

.system-health-indicator .disk-bar {
    background-color: #f6c23e;
}

.system-health-indicator .network-bar {
    background-color: #36b9cc;
}

/* Device Status Badges */
.badge-compliant {
    background-color: #1cc88a;
    color: #fff;
}

.badge-non-compliant {
    background-color: #e74a3b;
    color: #fff;
}

.badge-updates-pending {
    background-color: #f6c23e;
    color: #212529;
}