/* Theme Variables */
:root {
  /* Default Theme (Blue) */
  --theme-primary: #0d6efd;
  --theme-primary-dark: #0b5ed7;
  --theme-primary-rgb: 13, 110, 253;
  --theme-secondary: #6c757d;
  --theme-success: #198754;
  --theme-danger: #dc3545;
  --theme-warning: #ffc107;
  --theme-info: #0dcaf0;
  --theme-bg: #f8f9fa;
  --theme-navbar-bg: var(--theme-primary);
  --theme-navbar-text: #ffffff;
  --theme-card-bg: #ffffff;
  --theme-text: #212529;
  --theme-text-muted: #6c757d;
  --theme-border: #dee2e6;
  --theme-footer-bg: #f8f9fa;
}

/* Teal Theme */
[data-theme="teal"] {
  --theme-primary: #20c997;
  --theme-primary-dark: #1aa179;
  --theme-primary-rgb: 32, 201, 151;
  --theme-navbar-bg: #20c997;
}

/* Purple Theme */
[data-theme="purple"] {
  --theme-primary: #6f42c1;
  --theme-primary-dark: #59359a;
  --theme-primary-rgb: 111, 66, 193;
  --theme-navbar-bg: #6f42c1;
}

/* Indigo Theme */
[data-theme="indigo"] {
  --theme-primary: #6610f2;
  --theme-primary-dark: #520dc2;
  --theme-primary-rgb: 102, 16, 242;
  --theme-navbar-bg: #6610f2;
}

/* Pink Theme */
[data-theme="pink"] {
  --theme-primary: #d63384;
  --theme-primary-dark: #ab296a;
  --theme-primary-rgb: 214, 51, 132;
  --theme-navbar-bg: #d63384;
}

/* Orange Theme */
[data-theme="orange"] {
  --theme-primary: #fd7e14;
  --theme-primary-dark: #ca6510;
  --theme-primary-rgb: 253, 126, 20;
  --theme-navbar-bg: #fd7e14;
}

/* Dark Theme */
[data-theme="dark"] {
  --theme-primary: #0d6efd;
  --theme-primary-dark: #0b5ed7;
  --theme-primary-rgb: 13, 110, 253;
  --theme-bg: #212529;
  --theme-navbar-bg: #1a1d20;
  --theme-navbar-text: #ffffff;
  --theme-card-bg: #2b3035;
  --theme-text: #e9ecef;
  --theme-text-muted: #adb5bd;
  --theme-border: #495057;
  --theme-footer-bg: #1a1d20;
}

/* Green Theme */
[data-theme="green"] {
  --theme-primary: #198754;
  --theme-primary-dark: #146c43;
  --theme-primary-rgb: 25, 135, 84;
  --theme-navbar-bg: #198754;
}

/* Red Theme */
[data-theme="red"] {
  --theme-primary: #dc3545;
  --theme-primary-dark: #b02a37;
  --theme-primary-rgb: 220, 53, 69;
  --theme-navbar-bg: #dc3545;
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin-bottom: 60px;
  background-color: var(--theme-bg);
  color: var(--theme-text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* Custom Entra External ID Manager Styles */
.card {
  border: none;
  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;
}

.navbar-brand {
  font-size: 1.1rem;
}

.nav-link {
  transition: all 0.2s;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 0.25rem;
}

.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
}

.shadow-sm {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Dashboard Cards */
.card.border-primary,
.card.border-success,
.card.border-info,
.card.border-warning {
  border-width: 2px !important;
}

/* Form Styling */
.form-label.fw-bold {
  color: #495057;
  margin-bottom: 0.5rem;
}

.form-control:focus,
.form-select:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Code blocks */
code {
  background-color: #f8f9fa;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 87.5%;
}

/* Badges */
.badge {
  padding: 0.35em 0.65em;
  font-weight: 500;
}

/* Sticky elements */
.sticky-top {
  z-index: 1020;
}

/* Alert animations */
.alert {
  animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Custom color preview */
.form-control-color {
  width: 4rem;
  height: calc(2.875rem + 2px);
}

/* Responsive utilities */
@media (max-width: 768px) {
  .card {
    margin-bottom: 1rem;
  }

  .sticky-top {
    position: relative !important;
    top: 0 !important;
  }
}

/* Theme-aware styles */
.navbar.bg-primary {
  background-color: var(--theme-navbar-bg) !important;
  transition: background-color 0.3s ease;
}

.btn-primary {
  background-color: var(--theme-primary);
  border-color: var(--theme-primary);
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--theme-primary-dark);
  border-color: var(--theme-primary-dark);
}

.btn-outline-primary {
  color: var(--theme-primary);
  border-color: var(--theme-primary);
}

.btn-outline-primary:hover {
  background-color: var(--theme-primary);
  border-color: var(--theme-primary);
  color: #fff;
}

.bg-primary {
  background-color: var(--theme-primary) !important;
}

.text-primary {
  color: var(--theme-primary) !important;
}

.border-primary {
  border-color: var(--theme-primary) !important;
}

.badge.bg-primary {
  background-color: var(--theme-primary) !important;
}

.card {
  background-color: var(--theme-card-bg);
  border-color: var(--theme-border);
  transition: background-color 0.3s ease;
}

.card-header {
  background-color: var(--theme-card-bg);
  border-color: var(--theme-border);
}

.table {
  color: var(--theme-text);
}

.table-light {
  background-color: var(--theme-bg);
}

[data-theme="dark"] .table-light {
  background-color: #343a40;
  color: var(--theme-text);
}

[data-theme="dark"] .table-hover tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.075);
}

.footer {
  background-color: var(--theme-footer-bg) !important;
  border-color: var(--theme-border) !important;
  transition: background-color 0.3s ease;
}

[data-theme="dark"] .footer {
  color: var(--theme-text);
}

[data-theme="dark"] .bg-light {
  background-color: #343a40 !important;
}

[data-theme="dark"] .text-muted {
  color: var(--theme-text-muted) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: #343a40;
  border-color: var(--theme-border);
  color: var(--theme-text);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background-color: #3d4349;
  border-color: var(--theme-primary);
  color: var(--theme-text);
}

[data-theme="dark"] .dropdown-menu {
  background-color: #343a40;
  border-color: var(--theme-border);
}

[data-theme="dark"] .dropdown-item {
  color: var(--theme-text);
}

[data-theme="dark"] .dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .modal-content {
  background-color: var(--theme-card-bg);
  color: var(--theme-text);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  border-color: var(--theme-border);
}

[data-theme="dark"] code {
  background-color: #343a40;
  color: #e83e8c;
}

[data-theme="dark"] .alert-success {
  background-color: rgba(25, 135, 84, 0.2);
  border-color: rgba(25, 135, 84, 0.3);
  color: #75b798;
}

[data-theme="dark"] .alert-danger {
  background-color: rgba(220, 53, 69, 0.2);
  border-color: rgba(220, 53, 69, 0.3);
  color: #ea868f;
}

/* Theme Selector Styles */
.theme-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.theme-option {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}

.theme-option:hover {
  transform: scale(1.1);
}

.theme-option.active {
  border-color: var(--theme-text);
  box-shadow: 0 0 0 2px var(--theme-card-bg);
}

.theme-option[data-theme="default"] { background-color: #0d6efd; }
.theme-option[data-theme="teal"] { background-color: #20c997; }
.theme-option[data-theme="purple"] { background-color: #6f42c1; }
.theme-option[data-theme="indigo"] { background-color: #6610f2; }
.theme-option[data-theme="pink"] { background-color: #d63384; }
.theme-option[data-theme="orange"] { background-color: #fd7e14; }
.theme-option[data-theme="green"] { background-color: #198754; }
.theme-option[data-theme="red"] { background-color: #dc3545; }
.theme-option[data-theme="dark"] {
  background: linear-gradient(135deg, #212529 50%, #0d6efd 50%);
}