/* ==========================================================================
   SITE.CSS - Global Base Styles
   Professional End-Level UI Design
   ========================================================================== */

/* --------------------------------------------------------------------------
   BASE STYLES & RESETS
   -------------------------------------------------------------------------- */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--font-sans, 'Inter', system-ui, -apple-system, sans-serif);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Selection styling */
::selection {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   NAVBAR
   -------------------------------------------------------------------------- */
.navbar {
  background-color: var(--navbar-bg) !important;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.navbar-brand {
  font-weight: 700;
  color: var(--text-primary) !important;
  letter-spacing: -0.025em;
  transition: all 0.2s ease;
}

.navbar-brand:hover {
  transform: scale(1.02);
}

.navbar-brand img {
  transition: transform 0.3s ease;
}

.navbar-brand:hover img {
  transform: rotate(-5deg) scale(1.05);
}

.nav-link {
  font-weight: 500;
  color: var(--text-secondary) !important;
  transition: all 0.2s ease;
  position: relative;
  padding: 8px 16px !important;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-link:hover::after {
  width: 60%;
}

.nav-link:hover {
  color: var(--color-primary) !important;
}

/* Mobile navbar toggle */
.navbar-toggler {
  border: none;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* --------------------------------------------------------------------------
   CARDS
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.modern-card {
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  background: var(--bg-surface);
  overflow: hidden;
}

.modern-card:hover {
  box-shadow: var(--shadow-md);
}

/* --------------------------------------------------------------------------
   BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  border-radius: 10px;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--color-primary-light);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-outline-primary {
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--color-primary);
  color: white;
  transform: translateY(-2px);
}

.btn-outline-danger {
  border: 2px solid var(--color-danger);
  color: var(--color-danger);
  background: transparent;
}

.btn-outline-danger:hover {
  background: var(--color-danger);
  color: white;
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */
footer.footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color) !important;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.75rem;
}

h4 {
  font-size: 1.5rem;
}

h5 {
  font-size: 1.25rem;
}

h6 {
  font-size: 1rem;
}

p {
  color: var(--text-secondary);
  line-height: 1.7;
}

a {
  color: var(--color-primary);
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-primary-hover);
}

.text-muted {
  color: var(--text-muted) !important;
}

/* --------------------------------------------------------------------------
   FORM CONTROLS
   -------------------------------------------------------------------------- */
.form-control {
  border-radius: 10px;
  border: 2px solid var(--border-color);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
  outline: none;
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.form-select {
  border-radius: 10px;
  border: 2px solid var(--border-color);
  padding: 0.75rem 1rem;
  background-color: var(--bg-surface);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
}

/* --------------------------------------------------------------------------
   MODERN HEADER
   -------------------------------------------------------------------------- */
.modern-header {
  background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5));
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  border-radius: 20px;
  padding: 3rem 2rem;
  color: white;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.modern-header-bg-default {
  background-image: url("/static/img/header_bg.png");
}

.header-content {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   ACTION TOOLBAR
   -------------------------------------------------------------------------- */
.action-toolbar {
  background: var(--bg-surface);
  padding: 1rem 1.5rem;
  border-radius: 14px;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   TABLES
   -------------------------------------------------------------------------- */
.table {
  color: var(--text-primary);
}

.table-modern thead th {
  border-top: none;
  border-bottom: 2px solid var(--border-color);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 1rem;
  background: var(--bg-surface-hover);
}

.table-modern tbody td {
  padding: 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color-light);
  color: var(--text-primary);
}

.table-modern tbody tr:last-child td {
  border-bottom: none;
}

.table-modern tbody tr {
  transition: all 0.2s ease;
}

.table-modern tbody tr:hover {
  background-color: var(--bg-surface-hover);
}

/* --------------------------------------------------------------------------
   UTILITY CLASSES
   -------------------------------------------------------------------------- */

/* Avatars */
.avatar-md {
  width: 44px !important;
  height: 44px !important;
  object-fit: cover;
  border-radius: 12px;
}

.avatar-sm {
  width: 36px !important;
  height: 36px !important;
  object-fit: cover;
  border-radius: 10px;
}

.avatar-circle {
  width: 40px !important;
  height: 40px !important;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Progress */
.progress {
  height: 8px;
  border-radius: 10px;
  background: var(--bg-surface-hover);
  overflow: hidden;
}

.progress-bar {
  border-radius: 10px;
  transition: width 0.6s ease;
}

.progress-thin {
  height: 4px;
}

/* Sizes */
.icon-sm {
  width: 20px;
  height: 20px;
}

.chart-container {
  min-height: 200px;
}

/* Font sizes */
.font-size-sm {
  font-size: 0.85rem;
}

.font-size-xs {
  font-size: 0.75rem;
}

/* Object fit */
.object-fit-cover {
  object-fit: cover;
}

/* Device icon container */
.device-icon-container {
  min-width: 60px;
}

/* Dynamic sizing via CSS variables */
.w-dynamic {
  width: var(--width-val, 0%);
}

.h-dynamic-bar {
  width: 60%;
  height: var(--height-val, 0px);
  max-height: 150px;
  min-height: 4px;
  opacity: 0.8;
  transition: height 0.3s ease;
}

/* Card helpers */
.card-split-h {
  height: 48%;
}

/* --------------------------------------------------------------------------
   BADGES
   -------------------------------------------------------------------------- */
.badge {
  font-weight: 600;
  padding: 0.4em 0.8em;
  border-radius: 8px;
  font-size: 0.8rem;
}

.badge.bg-primary {
  background: var(--gradient-primary) !important;
}

.badge.bg-success {
  background: var(--color-success) !important;
}

.badge.bg-danger {
  background: var(--color-danger) !important;
}

.badge.bg-warning {
  background: var(--color-warning) !important;
  color: #451a03 !important;
  /* Darker brown for warning contrast */
}

/* --------------------------------------------------------------------------
   ALERTS
   -------------------------------------------------------------------------- */
.alert {
  border-radius: 12px;
  border: none;
  padding: 1rem 1.25rem;
}

.alert-success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.alert-danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.alert-warning {
  background: var(--color-warning-light);
  color: #92400e;
}

.alert-info {
  background: var(--color-info-light);
  color: var(--color-info);
}

/* --------------------------------------------------------------------------
   HOVER EFFECTS
   -------------------------------------------------------------------------- */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg) !important;
}

/* --------------------------------------------------------------------------
   RESPONSIVE UTILITIES
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.5rem;
  }

  .modern-header {
    padding: 2rem 1.5rem;
    border-radius: 16px;
  }

  .action-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    padding: 0.75rem 1rem;
  }
}

@media (max-width: 576px) {
  body {
    font-size: 0.95rem;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .modern-header {
    padding: 1.5rem 1rem;
  }
}

/* --------------------------------------------------------------------------
   PRINT STYLES
   -------------------------------------------------------------------------- */
@media print {

  .navbar,
  .footer,
  .btn,
  .action-toolbar {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .card,
  .modern-card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}