/**
 * HaxDB Main Stylesheet
 * Shared styles for the HaxDB application
 */

/* ==========================================================================
   CSS Variables / Design Tokens
   ========================================================================== */

:root {
  /* Background colors - Material Light theme */
  --hax-bg-darkest: #fafafa;
  --hax-bg-darker: #f5f5f5;
  --hax-bg-dark: #eeeeee;
  --hax-bg-card: #ffffff;
  --hax-bg-elevated: #f5f5f5;

  /* Border */
  --hax-border: #e0e0e0;

  /* Text */
  --hax-text: #212121;
  --hax-text-muted: #757575;

  /* Accent colors */
  --hax-accent: #1976d2;
  --hax-accent-hover: #1565c0;

  /* Status colors */
  --hax-success: #388e3c;
  --hax-danger: #d32f2f;
  --hax-warning: #f57c00;
  --hax-info: #1976d2;

  /* Header - solid black */
  --hax-header-bg: #000000;
  --hax-header-text: #ffffff;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

body {
  background: var(--hax-bg-darkest);
  color: var(--hax-text);
}

a {
  color: var(--hax-accent);
}

a:hover {
  color: var(--hax-accent-hover);
}

hr {
  border-color: var(--hax-border);
  opacity: 1;
}

/* ==========================================================================
   Navbar
   ========================================================================== */

.navbar {
  background: var(--hax-header-bg) !important;
  border-bottom: none;
  z-index: 1030;
}

.navbar-brand {
  color: var(--hax-header-text) !important;
  font-weight: 600;
}

.navbar-brand img {
  height: 32px;
  width: auto;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
  background: var(--hax-bg-darker);
  border-right: 1px solid var(--hax-border);
}

.sidebar .nav-link {
  color: var(--hax-text-muted);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  margin: 0.125rem 0.5rem;
  transition: all 0.15s ease;
}

.sidebar .nav-link:hover {
  color: var(--hax-text);
  background: var(--hax-bg-elevated);
}

.sidebar .nav-link.active {
  color: #fff;
  background: var(--hax-accent);
}

.sidebar .nav-link i {
  width: 1.5rem;
}

/* Sidebar accordion sections */
.sidebar .sidebar-section {
  border-top: 1px solid var(--hax-border);
}

.sidebar .sidebar-section:first-child {
  border-top: none;
}

.sidebar .sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.625rem 0.75rem;
  background: transparent;
  border: none;
  color: var(--hax-text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s ease;
}

.sidebar .sidebar-toggle:hover {
  color: var(--hax-text);
}

.sidebar .sidebar-toggle i.toggle-icon {
  font-size: 0.6rem;
  transition: transform 0.2s ease;
}

.sidebar .sidebar-toggle.collapsed i.toggle-icon {
  transform: rotate(-90deg);
}

.sidebar .sidebar-content {
  padding-bottom: 0.5rem;
}

/* ==========================================================================
   Content Area
   ========================================================================== */

.content-wrapper {
  min-height: calc(100vh - 57px);
  background: var(--hax-bg-darkest);
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--hax-bg-card);
  border: 1px solid var(--hax-border);
  border-radius: 0.5rem;
}

.card-header {
  background: var(--hax-bg-elevated);
  border-bottom: 1px solid var(--hax-border);
}

.card.border-success {
  border-color: var(--hax-success) !important;
}

.card.border-secondary {
  border-color: var(--hax-border) !important;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--hax-text);
  --bs-table-border-color: var(--hax-border);
}

.table-light {
  --bs-table-bg: var(--hax-bg-elevated);
  --bs-table-color: var(--hax-text);
}

.table-hover > tbody > tr:hover {
  --bs-table-hover-bg: var(--hax-bg-elevated);
  --bs-table-hover-color: var(--hax-text);
}

/* Table dropdowns - allow overflow for action menus */
.table-responsive {
  overflow: visible !important;
}

.table-responsive .dropdown-menu {
  position: absolute;
  z-index: 1050;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-control,
.form-select {
  background: var(--hax-bg-dark);
  border-color: var(--hax-border);
  color: var(--hax-text);
}

.form-control:focus,
.form-select:focus {
  background: var(--hax-bg-dark);
  border-color: var(--hax-accent);
  color: var(--hax-text);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

.form-control::placeholder {
  color: var(--hax-text-muted);
}

.form-label {
  color: var(--hax-text);
}

.form-check-input {
  background-color: var(--hax-bg-dark);
  border-color: var(--hax-border);
}

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

.input-group-text {
  background: var(--hax-bg-elevated);
  border-color: var(--hax-border);
  color: var(--hax-text-muted);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-primary {
  background: var(--hax-accent);
  border-color: var(--hax-accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--hax-accent-hover);
  border-color: var(--hax-accent-hover);
  color: #fff;
}

.btn-outline-primary {
  color: var(--hax-accent);
  border-color: var(--hax-accent);
}

.btn-outline-primary:hover {
  background: var(--hax-accent);
  border-color: var(--hax-accent);
  color: #fff;
}

.btn-outline-secondary {
  color: var(--hax-text-muted);
  border-color: var(--hax-border);
}

.btn-outline-secondary:hover {
  background: var(--hax-bg-elevated);
  border-color: var(--hax-border);
  color: var(--hax-text);
}

.btn-outline-danger {
  color: var(--hax-danger);
  border-color: var(--hax-danger);
}

.btn-outline-danger:hover {
  background: var(--hax-danger);
  border-color: var(--hax-danger);
  color: #fff;
}

.btn-outline-dark {
  color: var(--hax-text);
  border-color: var(--hax-border);
  background: transparent;
}

.btn-outline-dark:hover {
  background: var(--hax-bg-elevated);
  border-color: var(--hax-text-muted);
  color: #fff;
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert-success {
  background: #e8f5e9;
  border-color: #c8e6c9;
  color: #2e7d32;
}

.alert-danger {
  background: #ffebee;
  border-color: #ffcdd2;
  color: #c62828;
}

.alert-warning {
  background: #fff3e0;
  border-color: #ffe0b2;
  color: #ef6c00;
}

.alert-info {
  background: #e3f2fd;
  border-color: #bbdefb;
  color: #1565c0;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge.bg-primary {
  background: var(--hax-accent) !important;
}

.badge.bg-success {
  background: var(--hax-success) !important;
}

.badge.bg-danger {
  background: var(--hax-danger) !important;
}

.badge.bg-warning {
  background: var(--hax-warning) !important;
  color: #000;
}

.badge.bg-secondary {
  background: var(--hax-bg-elevated) !important;
  color: var(--hax-text-muted);
}

/* ==========================================================================
   Tabs
   ========================================================================== */

.nav-tabs {
  border-bottom-color: var(--hax-border);
}

.nav-tabs .nav-link {
  color: var(--hax-text-muted);
  border: 1px solid transparent;
}

.nav-tabs .nav-link:hover {
  color: var(--hax-text);
  border-color: var(--hax-border) var(--hax-border) transparent;
}

.nav-tabs .nav-link.active {
  background: var(--hax-bg-card);
  border-color: var(--hax-border) var(--hax-border) var(--hax-bg-card);
  color: var(--hax-text);
}

/* ==========================================================================
   Dropdowns
   ========================================================================== */

.dropdown-menu {
  background: var(--hax-bg-card);
  border-color: var(--hax-border);
}

.dropdown-item {
  color: var(--hax-text);
}

.dropdown-item:hover {
  background: var(--hax-bg-elevated);
  color: var(--hax-text);
}

.dropdown-divider {
  border-color: var(--hax-border);
}

/* ==========================================================================
   Text Utilities
   ========================================================================== */

.text-muted {
  color: var(--hax-text-muted) !important;
}

/* ==========================================================================
   Mobile Navigation
   ========================================================================== */

.mobile-nav {
  background: var(--hax-bg-darker);
}

.mobile-nav .nav-link {
  color: var(--hax-text-muted);
  padding: 0.75rem 1rem;
}

.mobile-nav .nav-link:hover {
  color: var(--hax-text);
  background: var(--hax-bg-elevated);
}

.mobile-nav .nav-link.active {
  color: #fff;
  background: var(--hax-accent);
}

.mobile-nav .nav-link i {
  width: 1.5rem;
}

.mobile-nav .nav-divider {
  border-top: 1px solid var(--hax-border);
  margin: 0.5rem 0;
}

@media (min-width: 768px) {
  .mobile-nav {
    display: none !important;
  }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Logo sizing */
.logo-sm {
  max-height: 32px;
  max-width: 150px;
}

.logo-md {
  max-height: 48px;
  max-width: 200px;
}

.logo-lg {
  max-height: 60px;
  max-width: 250px;
}

/* Nav section labels */
.nav-section-label {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
}

/* Icon sizing */
.icon-sm {
  font-size: 1rem;
}

.icon-md {
  font-size: 1.5rem;
}

.icon-lg {
  font-size: 2rem;
}

.icon-xl {
  font-size: 3rem;
}

.icon-2xl {
  font-size: 4rem;
}

/* Aspect ratio containers */
.aspect-ratio-1-1 {
  position: relative;
  padding-top: 100%;
}

.aspect-ratio-16-9 {
  position: relative;
  padding-top: 56.25%;
}

.aspect-ratio-4-3 {
  position: relative;
  padding-top: 75%;
}

.aspect-ratio-3-2 {
  position: relative;
  padding-top: 66.67%;
}

.aspect-ratio-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Image cover utility */
.img-cover {
  object-fit: cover;
}

/* Thumbnail sizes */
.thumbnail-sm {
  width: 50px;
  height: 30px;
  object-fit: cover;
}

.thumbnail-md {
  width: 80px;
  height: 80px;
  object-fit: cover;
}

.thumbnail-lg {
  width: 150px;
  height: 150px;
  object-fit: cover;
}

/* Login card */
.login-card {
  max-width: 400px;
  margin: 2rem auto;
}

/* Modals */
.modal-content {
  background: var(--hax-bg-card);
  border-color: var(--hax-border);
}

.modal-header {
  border-bottom-color: var(--hax-border);
}

.modal-footer {
  border-top-color: var(--hax-border);
}

/* List groups */
.list-group-item {
  background: var(--hax-bg-card);
  border-color: var(--hax-border);
  color: var(--hax-text);
}

.list-group-item:hover {
  background: var(--hax-bg-elevated);
}

/* Pagination */
.page-link {
  background: var(--hax-bg-card);
  border-color: var(--hax-border);
  color: var(--hax-text);
}

.page-link:hover {
  background: var(--hax-bg-elevated);
  border-color: var(--hax-border);
  color: var(--hax-text);
}

.page-item.active .page-link {
  background: var(--hax-accent);
  border-color: var(--hax-accent);
}

.page-item.disabled .page-link {
  background: var(--hax-bg-dark);
  border-color: var(--hax-border);
  color: var(--hax-text-muted);
}
