/* OptimaBox Custom Styles */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
  --warning-color: #ffc107;
    --info-color: #0dcaf0;
}

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

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

/* Global */
body {
  font-size: 0.95rem;
}

/* Navbar */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: rgba(255, 255, 255, 1);
}

/* Cards */
.card {
  border-radius: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.card-header {
    background-color: rgba(0, 0, 0, 0.03);
    font-weight: 600;
}

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

/* Alerts */
.alert {
    border-radius: 0.5rem;
    border-left: 4px solid;
}

.alert-success {
  border-left-color: var(--success-color);
}

.alert-danger {
    border-left-color: var(--danger-color);
}

.alert-warning {
    border-left-color: var(--warning-color);
}

.alert-info {
    border-left-color: var(--info-color);
}

/* Tables */
.table > thead {
    background-color: #f8f9fa;
}

.table > :not(caption) > * > * {
    padding: 0.75rem 0.5rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Forms */
.form-label {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

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

.btn-group-sm > .btn, .btn-sm {
    padding: 0.25rem 0.5rem;
}

/* Dashboard KPI Cards */
.card.bg-primary,
.card.bg-danger,
.card.bg-warning,
.card.bg-info,
.card.bg-success {
    border: none;
}

.card.bg-primary .card-body,
.card.bg-danger .card-body,
.card.bg-warning .card-body,
.card.bg-info .card-body,
.card.bg-success .card-body {
    padding: 1.5rem;
}

/* Connection Status Indicator */
.connection-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 1000;
}

.connection-status.connected {
    background-color: var(--success-color);
}

.connection-status.reconnecting {
    background-color: var(--warning-color);
    animation: pulse 1s infinite;
}

.connection-status.disconnected {
    background-color: var(--danger-color);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Toast Notifications */
.toast-container {
    z-index: 1055;
}

.toast {
    min-width: 300px;
}

/* Metrics Charts */
.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
 align-items: center;
    z-index: 9999;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-state i {
    font-size: 4rem;
    color: #ccc;
}

/* Status Indicators */
.status-online {
    color: var(--success-color);
}

.status-offline {
    color: var(--danger-color);
}

.status-warning {
    color: var(--warning-color);
}

/* Alert Border Colors */
.border-start.border-4.border-danger {
    border-left-color: var(--danger-color) !important;
}

.border-start.border-4.border-warning {
  border-left-color: var(--warning-color) !important;
}

.border-start.border-4.border-info {
    border-left-color: var(--info-color) !important;
}

/* Responsive */
@media (max-width: 768px) {
    html {
      font-size: 13px;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* Dark Mode Support (Future) */
@media (prefers-color-scheme: dark) {
  /* Add dark mode styles here */
}

/* Print Styles */
@media print {
    .navbar,
    .btn,
    .card-header .btn,
    .connection-status {
        display: none !important;
    }
    
    .card {
      box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
      transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Code blocks */
code {
    color: #e83e8c;
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
}

pre code {
    background-color: transparent;
    padding: 0;
}

/* Links */
a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.card a {
    text-decoration: none;
}

.card a:hover {
    text-decoration: underline;
}

/* Footer */
.footer {
    flex-shrink: 0;
    padding: 1rem 0;
    margin-top: 3rem;
 background-color: #f8f9fa;
}

/* Hierarchical Boxes View */
.boxes-hierarchy {
    padding: 0.5rem 0;
}

.hierarchy-group,
.hierarchy-client,
.hierarchy-site {
  margin-bottom: 0.5rem;
}

.hierarchy-header {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
 transition: all 0.2s ease;
    display: flex;
    align-items: center;
    user-select: none;
}

.hierarchy-header:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.hierarchy-header.group-header {
    background-color: rgba(13, 110, 253, 0.08);
    border-left: 4px solid var(--primary-color);
    font-size: 1.05rem;
}

.hierarchy-header.group-header:hover {
    background-color: rgba(13, 110, 253, 0.12);
}

.hierarchy-header.client-header {
    background-color: rgba(13, 202, 240, 0.08);
    border-left: 4px solid var(--info-color);
    margin-left: 1rem;
}

.hierarchy-header.client-header:hover {
    background-color: rgba(13, 202, 240, 0.12);
}

.hierarchy-header.site-header {
    background-color: rgba(25, 135, 84, 0.08);
    border-left: 4px solid var(--success-color);
    margin-left: 2rem;
}

.hierarchy-header.site-header:hover {
    background-color: rgba(25, 135, 84, 0.12);
}

.hierarchy-content {
    padding: 0.5rem 0;
}

.hierarchy-group > .collapse > .hierarchy-content,
.hierarchy-client > .collapse > .hierarchy-content {
    padding-left: 1rem;
}

.hierarchy-site > .collapse > .hierarchy-content {
    padding-left: 2rem;
}

.toggle-icon {
    margin-right: 0.5rem;
    transition: transform 0.2s ease;
    font-size: 0.875rem;
}

.hierarchy-header[aria-expanded="true"] .toggle-icon {
    transform: rotate(90deg);
}

/* Boxes table in hierarchy */
.hierarchy-site .table {
    margin-top: 0.5rem;
    background-color: white;
    border-radius: 0.375rem;
    overflow: hidden;
}

.hierarchy-site .table thead {
    background-color: #f8f9fa;
    font-size: 0.875rem;
}

.hierarchy-site .table td,
.hierarchy-site .table th {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
}

.hierarchy-site .table tbody tr {
    border-top: 1px solid #dee2e6;
}

.hierarchy-site .table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.03);
}

/* Badge in hierarchy headers */
.hierarchy-header .badge {
    margin-left: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hierarchy-header.client-header {
      margin-left: 0.5rem;
    }

    .hierarchy-header.site-header {
        margin-left: 1rem;
    }
    
    .hierarchy-content {
        padding-left: 0.25rem !important;
    }
    
 .hierarchy-site .table {
        font-size: 0.85rem;
    }
    
    .hierarchy-site .table .btn-group-sm > .btn {
        padding: 0.15rem 0.3rem;
        font-size: 0.75rem;
    }
}

/* Animation for collapse */
.collapsing {
    transition: height 0.25s ease;
}

/* Quick access cards hover effect */
.hover-shadow {
    transition: all 0.3s ease;
}

.hover-shadow:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.hover-shadow a {
  text-decoration: none;
}
