/* Sleek Bootstrap Theme for Applites */
:root {
  --primary-color: #5a67d8;
  --secondary-color: #667eea;
  --success-color: #48bb78;
  --danger-color: #f56565;
  --warning-color: #ed8936;
  --info-color: #4299e1;
  --light-color: #f7fafc;
  --dark-color: #2d3748;
  --muted-color: #718096;
  --border-color: #e2e8f0;
  --sidebar-bg: #2d3748;
  --sidebar-width: 250px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f8fafc;
  color: #2d3748;
  line-height: 1.6;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #1a202c 100%);
  z-index: 1000;
  transition: all 0.3s ease;
  overflow-y: auto;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid #374151;
}

.sidebar-brand {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-brand:hover {
  color: var(--secondary-color);
  text-decoration: none;
}

.sidebar-nav {
  padding: 1rem 0;
}

.nav-item {
  margin-bottom: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: #cbd5e0;
  text-decoration: none;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  gap: 0.75rem;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  text-decoration: none;
}

.nav-link.active {
  background-color: var(--primary-color);
  color: white;
  border-right: 3px solid var(--secondary-color);
}

.nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.8;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background-color: #f8fafc;
}

.topbar {
  background: white;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: between;
  align-items: center;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--dark-color);
  margin: 0;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
}

.content-wrapper {
  padding: 2rem;
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: all 0.3s ease;
}

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

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background-color: #f8fafc;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dark-color);
  margin: 0;
}

.card-body {
  padding: 1.5rem;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-left: 4px solid var(--primary-color);
  transition: all 0.3s ease;
}

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

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

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

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

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

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark-color);
  margin-bottom: 0.5rem;
}

.stat-label {
  color: var(--muted-color);
  font-size: 0.9rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon {
  float: right;
  font-size: 2rem;
  opacity: 0.3;
  margin-top: -0.5rem;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  gap: 0.5rem;
}

.status-badge.up {
  background-color: #f0fff4;
  color: var(--success-color);
  border: 1px solid #9ae6b4;
}

.status-badge.down {
  background-color: #fff5f5;
  color: var(--danger-color);
  border: 1px solid #feb2b2;
}

.status-badge.pending {
  background-color: #fffaf0;
  color: var(--warning-color);
  border: 1px solid #fbd38d;
}

.status-badge.warning {
  background-color: #fffaf0;
  color: var(--warning-color);
  border: 1px solid #fbd38d;
}

.status-badge.neutral {
  background-color: #f7fafc;
  color: var(--muted-color);
  border: 1px solid #cbd5e0;
}

.status-badge.self-signed {
  background-color: #ebf8ff;
  color: var(--info-color);
  border: 1px solid #90cdf4;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(90, 103, 216, 0.4);
  color: white;
  text-decoration: none;
}

.btn-success {
  background-color: var(--success-color);
  color: white;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-outline:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
}

.table th,
.table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table th {
  background-color: #f8fafc;
  font-weight: 600;
  color: var(--dark-color);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table tbody tr:hover {
  background-color: #f8fafc;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--dark-color);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  background-color: white;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(90, 103, 216, 0.1);
}

/* Auth Pages */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 2rem;
}

.auth-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  width: 100%;
  max-width: 400px;
}

.auth-header {
  padding: 2rem 2rem 1rem;
  text-align: center;
}

.auth-logo {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--muted-color);
  font-size: 0.95rem;
}

.auth-body {
  padding: 0 2rem 2rem;
}

.auth-footer {
  text-align: center;
  padding: 1rem 2rem 2rem;
  border-top: 1px solid var(--border-color);
  background-color: #f8fafc;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .content-wrapper {
    padding: 1rem;
  }
}

/* Loading */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.75rem;
}

.col-lg-3, .col-lg-4, .col-lg-8, .col-lg-9, .col-md-4, .col-md-6, .col-12 {
    padding: 0 0.75rem;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

.col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

.col-lg-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

.col-lg-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

.col-lg-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
}

.col-lg-9 {
    flex: 0 0 75%;
    max-width: 75%;
}

@media (max-width: 992px) {
    .col-lg-3, .col-lg-4, .col-lg-8, .col-lg-9 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Utilities */
.text-muted { color: var(--muted-color); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-info { color: var(--info-color); }
.text-center { text-align: center; }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.ml-auto { margin-left: auto; }
.mr-3 { margin-right: 1rem; }
.py-5 { padding-top: 3rem; padding-bottom: 3rem; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

/* Additional Components */
.form-text {
    font-size: 0.875rem;
    color: var(--muted-color);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-danger {
    background-color: #fee;
    color: var(--danger-color);
    border: 1px solid #fcc;
}

.alert-success {
    background-color: #f0f9ff;
    color: var(--success-color);
    border: 1px solid #cfe;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Progress */
.progress {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.progress-bar.bg-danger {
    background: var(--danger-color);
}

/* Tips */
.tip-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: start;
}

.tip-item:last-child {
    margin-bottom: 0;
}

.tip-item i {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Plan Info */
.plan-info {
    text-align: center;
}

/* Charts Container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-small {
    height: 200px;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.25rem;
    top: 0.5rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid white;
    box-shadow: 0 0 0 3px #e5e7eb;
}

.timeline-item.success::before {
    background: var(--success-color);
}

.timeline-item.danger::before {
    background: var(--danger-color);
}

.timeline-item.warning::before {
    background: var(--warning-color);
}

.timeline-content {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 8px;
}

.timeline-time {
    font-size: 0.875rem;
    color: var(--muted-color);
    margin-bottom: 0.25rem;
}

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.quick-stat {
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    background: #f8fafc;
}

.quick-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
}

.quick-stat-label {
    font-size: 0.875rem;
    color: var(--muted-color);
}

/* Hover Effects */
.hover-shadow:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e0;
    transition: 0.4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--success-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

input:disabled + .slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal Enhancements */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: #f8fafc;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted-color);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: var(--danger-color);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: #f8fafc;
}

.form-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--muted-color);
}

[x-cloak] {
    display: none !important;
}