/****** Custom Admin Panel Styles ******/

:root {
    --bs-primary-rgb: 13, 110, 253; /* Default Bootstrap Blue for consistency */
    --bs-primary-soft: #E9F5FF;
    --bs-secondary-rgb: 108, 117, 125;
    --bs-light-rgb: 248, 249, 250;
    --bs-dark-rgb: 33, 37, 41;
    --bs-body-font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --bs-body-color: #212529;
    --bs-body-bg: #f4f6f9; /* Lighter grey background for the body */
    --card-bg: #ffffff;
    --card-border-color: rgba(0, 0, 0, 0.1);
    --card-header-bg: #f8f9fa;
    --sidebar-bg: #ffffff;
    --sidebar-link-color: #333;
    --sidebar-link-active-color: var(--bs-primary);
    --sidebar-link-active-bg: var(--bs-primary-soft);
    --sidebar-icon-color: #555;
    --sidebar-icon-active-color: var(--bs-primary);
}

body {
    font-family: var(--bs-body-font-family);
    font-size: 0.9rem; /* Slightly smaller base font size */
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

/* Header */
.navbar-dark.bg-dark {
    background-color: #343a40 !important; /* Keep header distinct */
}
.navbar-brand {
    font-weight: 600;
}

/* Sidebar */
.sidebar {
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--card-border-color);
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

.sidebar .nav-link {
    color: var(--sidebar-link-color);
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-left: 3px solid transparent;
}

.sidebar .nav-link .feather {
    color: var(--sidebar-icon-color);
    margin-right: 8px;
    width: 18px;
    height: 18px;
}

.sidebar .nav-link:hover {
    color: var(--sidebar-link-active-color);
    background-color: var(--sidebar-link-active-bg);
    border-left-color: var(--sidebar-link-active-color);
}

.sidebar .nav-link.active {
    color: var(--sidebar-link-active-color);
    background-color: var(--sidebar-link-active-bg);
    border-left-color: var(--sidebar-link-active-color);
    font-weight: 600;
}

.sidebar .nav-link.active .feather {
    color: var(--sidebar-icon-active-color);
}

/* Main Content Area */
main {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.page-header h1.h2 {
    font-weight: 600;
    color: #333;
}

/* Cards */
.card {
    border: none; /* Remove default border, use shadow */
    border-radius: 0.5rem; /* Softer corners */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
    background-color: var(--card-bg);
}

.card-header {
    background-color: var(--card-header-bg);
    border-bottom: 1px solid var(--card-border-color);
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    color: var(--bs-body-color);
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

.card-title {
    margin-bottom: 0;
    font-size: 1.1rem;
}

.card-body {
    padding: 1.25rem;
}

/* Tables */
.table {
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0; /* Card will provide margin */
}

.table th, .table td {
    vertical-align: middle;
    padding: 0.85rem;
    border-top: 1px solid #dee2e6;
}

.table thead th {
    font-weight: 600;
    background-color: #f8f9fa;
    border-bottom-width: 2px;
    color: #495057;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(0,0,0,0.025);
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(0,0,0,0.045);
}

.table-sm th, .table-sm td {
    padding: 0.6rem;
}

.table-responsive {
    border-radius: 0.375rem; /* Match card body if table is directly in it */
    overflow: hidden; /* Clips table to rounded corners */
}

/* Forms */
.form-control, .form-select {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

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

.form-label {
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.form-switch .form-check-input:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'-4 -4 8 8\'%3e%3ccircle r=\'3\' fill=\'%23fff\'/%3e%3c/svg%3e");
}

/* Buttons */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Alerts */
.alert {
    border-radius: 0.375rem;
    padding: 0.9rem 1.25rem;
}

/* Progress Bars (for system info) */
.progress {
    height: 1rem;
    border-radius: 0.375rem;
}

.progress-bar {
    font-weight: 500;
}

/* Badges (for user status, log levels) */
.badge {
    font-size: 0.8em;
    padding: 0.4em 0.6em;
}

/* Utility classes */
.icon-lg {
    width: 48px;
    height: 48px;
}

.text-muted-light {
    color: #8898aa !important;
}

/* Specific page adjustments can be added below or in separate files if it gets too large */

/* Dashboard specific card styles */
.dashboard-card-icon {
    font-size: 2.5rem;
    opacity: 0.7;
}

.dashboard-card .card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bs-body-bg);
}

.login-form {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background-color: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1);
}

.login-form .form-floating > .form-control {
    height: calc(3.5rem + 2px);
    line-height: 1.25;
}

.login-form .form-floating > label {
    padding: 1rem 0.75rem;
}

/* Dashboard specific enhancements */
.hover-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

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

.text-xs {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

.fa-2x {
    font-size: 2em;
}

/* Progress bar animations */
.progress-bar {
    transition: width 0.6s ease;
}

/* Card border enhancements */
.border-start {
    border-left-width: 0.25rem !important;
}

.border-4 {
    border-width: 4px !important;
}

/* Gradient background utility */
.bg-gradient {
    background-image: linear-gradient(180deg, rgba(255,255,255,0.15), rgba(255,255,255,0));
}

/* Enhanced table styling */
.table-light {
    background-color: #f8f9fa;
}

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

/* Badge enhancements */
.badge {
    font-weight: 500;
}

/* Button group spacing */
.btn-group .btn {
    margin-right: 0;
}

/* Card header background */
.card-header.bg-light {
    background-color: #f8f9fa !important;
    border-bottom: 1px solid #dee2e6;
}

/* Icon sizing utilities */
.bi {
    vertical-align: -0.125em;
}

/* Dashboard specific spacing */
.dashboard-stats .card {
    transition: transform 0.2s ease-in-out;
}

.dashboard-stats .card:hover {
    transform: translateY(-2px);
}

/* System health indicators */
.progress {
    background-color: #e9ecef;
}

.progress-bar {
    font-size: 0.75rem;
    line-height: 1rem;
}

/* Quick action cards */
.quick-action-card {
    border: 1px solid #e3e6f0;
    border-radius: 0.35rem;
    transition: all 0.3s;
}

.quick-action-card:hover {
    border-color: #5a5c69;
    transform: translateY(-1px);
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .col-lg-2 {
        margin-bottom: 1rem;
    }
    
    .quick-action-card .card-body {
        padding: 1rem 0.5rem;
    }
    
    .dashboard-stats .h5 {
        font-size: 1.1rem;
    }
}

/* Animation for loading states */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.loading {
    animation: pulse 2s infinite;
}

@media (max-width: 767.98px) {
    .px-md-4 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    .sidebar {
        padding-top: 56px; /* Height of navbar on mobile */
    }
    .sidebar-sticky {
        height: calc(100vh - 56px);
    }
}

