/* Project styles - uses Bootstrap CSS variables from bootstrap.css */

/* ==========================================================================
   Alert Styles
   ========================================================================== */

.alert-debug {
  color: black;
  background-color: white;
  border-color: #d6e9c6;
}

.alert-error {
  color: #b94a48;
  background-color: #f2dede;
  border-color: #eed3d7;
}

/* ==========================================================================
   Layout - Base Structure
   ========================================================================== */

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

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

.navbar-hub {
  background: linear-gradient(135deg, var(--bs-dark) 0%, #1a1a2e 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.navbar-hub .navbar-brand {
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-hub .navbar-brand img {
  filter: brightness(1.1);
}

.navbar-hub .nav-link {
  font-weight: 500;
  transition: all 0.2s ease;
}

.navbar-hub .nav-link:hover {
  transform: translateY(-1px);
}

/* ==========================================================================
   Footer Styling
   ========================================================================== */

.footer-hub {
  background: var(--bs-dark);
  color: var(--bs-light);
  padding: 1.5rem 0;
  margin-top: auto;
}

.footer-hub a {
  color: var(--bs-light);
  text-decoration: none;
}

.footer-hub a:hover {
  color: white;
}

/* ==========================================================================
   Card Enhancements
   ========================================================================== */

.card {
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: 0.5rem;
}

.card-header {
  background: white;
  border-bottom: 2px solid var(--bs-light);
  font-weight: 600;
}

/* ==========================================================================
   Button Enhancements
   ========================================================================== */

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.3);
}

/* ==========================================================================
   HTMX Loading Indicators
   ========================================================================== */

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline-block;
}

.htmx-request.htmx-indicator {
  display: inline-block;
}

/* Smooth transitions for HTMX swaps */
.htmx-swapping {
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.htmx-settling {
  opacity: 1;
  transition: opacity 0.2s ease-in;
}

/* Loading overlay for HTMX requests */
.loading-overlay {
  background: rgba(255, 255, 255, 0.8);
  z-index: 10;
  pointer-events: none;
}

/* Min-height utility for card bodies */
.card-body-min-200 {
  min-height: 200px;
}

/* ==========================================================================
   Loading Skeleton Animation
   ========================================================================== */

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-card {
  height: 180px;
  border-radius: 1rem;
}

/* Skeleton size variants for dashboard */
.skeleton-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.skeleton-stat-number {
  width: 40px;
  height: 28px;
}

.skeleton-stat-label {
  width: 80px;
  height: 14px;
}

.skeleton-app-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.skeleton-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

/* ==========================================================================
   App Icons and Logos
   ========================================================================== */

.app-logo-sm {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.app-logo-md {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.app-logo-lg {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.app-icon-fallback {
  display: none;
}

.app-icon-fallback.show {
  display: block;
}

/* ==========================================================================
   Icon Size Utilities
   ========================================================================== */

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

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

.icon-xxl {
  font-size: 4rem;
}

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

/* App icon indicator fallback colors */
.app-icon-primary {
  font-size: 2rem;
  color: var(--bs-primary);
}

.app-icon-info {
  font-size: 2rem;
  color: var(--bs-info);
}

/* Text truncate with max width */
.text-truncate-200 {
  max-width: 200px;
}

/* Preview iframe for email templates */
.preview-iframe {
  width: 100%;
  height: 450px;
  border: none;
  background: white;
}

/* Empty state icon size */
.empty-state-icon {
  font-size: 2rem;
}

/* ==========================================================================
   Hub Hero Header
   ========================================================================== */

.hub-hero {
  background: linear-gradient(135deg, var(--bs-dark) 0%, #1a1a2e 100%);
  color: white;
  padding: 3rem 0;
  margin: -2rem -12px 2rem -12px;
  border-radius: 0 0 1.5rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.hub-hero::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(135deg, transparent 0%, rgba(var(--bs-primary-rgb), 0.1) 100%);
}

.hub-hero h1 {
  font-weight: 700;
  font-size: 2rem;
}

.hub-hero .lead {
  opacity: 0.9;
}

/* Page header variant (for management pages) */
.page-header {
  background: linear-gradient(135deg, var(--bs-dark) 0%, #1a1a2e 100%);
  color: white;
  padding: 2rem 0;
  margin: -2rem -12px 2rem -12px;
  border-radius: 0 0 1rem 1rem;
}

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

.app-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  height: 100%;
  border: 2px solid transparent;
  border-radius: 1rem;
  overflow: hidden;
}

.app-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
  border-color: var(--bs-primary);
}

.app-card.no-access {
  opacity: 0.75;
  background: linear-gradient(135deg, #f8f9fa 0%, var(--bs-light) 100%);
}

.app-card.no-access:hover {
  opacity: 1;
  border-color: var(--bs-info);
}

.app-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  border-radius: 1rem;
  background: var(--bs-light);
  color: var(--bs-primary);
  font-size: 2rem;
}

.app-card.no-access .app-icon {
  color: var(--bs-info);
}

.app-icon img {
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
}

.app-card.no-access .app-icon img {
  filter: grayscale(100%);
}

.app-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.app-link:hover {
  text-decoration: none;
  color: inherit;
}

/* ==========================================================================
   Section Styling
   ========================================================================== */

.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.section-header i {
  font-size: 1.5rem;
}

.section-header h4 {
  margin: 0;
  font-weight: 600;
}

.section-divider {
  position: relative;
  text-align: center;
  margin: 3rem 0 2rem;
}

.section-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 2px dashed var(--bs-light);
}

.section-divider span {
  position: relative;
  background: var(--bs-background);
  padding: 0 1.5rem;
  color: var(--bs-info);
  font-weight: 500;
}

/* ==========================================================================
   Badge Animations
   ========================================================================== */

.badge-pending {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--bs-info);
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-icon {
  color: #dee2e6;
}

/* ==========================================================================
   Request Access Button
   ========================================================================== */

.btn-request {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  transition: all 0.2s ease;
}

.btn-request:hover {
  transform: scale(1.05);
}

/* ==========================================================================
   Management Link Button
   ========================================================================== */

.management-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  transition: all 0.2s ease;
}

.management-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: white;
  transform: translateY(-2px);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
}

.toast-notification {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  max-width: 400px;
}

/* ==========================================================================
   Login Page
   ========================================================================== */

.login-container {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}

.login-card {
  max-width: 420px;
  width: 100%;
}

.login-card .card {
  border: none;
  border-radius: 1rem;
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, var(--bs-dark) 0%, #1a1a2e 100%);
  padding: 2.5rem 2rem;
  text-align: center;
}

.login-header img {
  max-height: 60px;
  margin-bottom: 1rem;
}

.login-header h2 {
  color: white;
  font-weight: 700;
  margin: 0;
  font-size: 1.5rem;
}

.login-body {
  padding: 2.5rem 2rem;
}

.login-btn {
  background: var(--bs-primary);
  border: none;
  padding: 0.875rem 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.login-btn:hover {
  background: #a93226;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(var(--bs-primary-rgb), 0.35);
}

.login-btn i {
  font-size: 1.25rem;
}

.login-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: var(--bs-info);
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--bs-light);
}

.login-divider span {
  padding: 0 1rem;
  font-size: 0.875rem;
}

.features-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.features-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  color: var(--bs-secondary);
  font-size: 0.9rem;
}

.features-list li i {
  color: var(--bs-primary);
  font-size: 1rem;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bs-light);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  color: var(--bs-secondary);
  margin-top: 1rem;
}

.security-badge i {
  color: var(--bs-info);
}

/* ==========================================================================
   Stats Cards (Dashboard)
   ========================================================================== */

.stat-card {
  border: none;
  border-radius: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

/* ==========================================================================
   User List Items
   ========================================================================== */

.user-list-item {
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.user-list-item:hover {
  border-left-color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), 0.05);
}

/* ==========================================================================
   Search Box
   ========================================================================== */

.search-box {
  position: relative;
}

.search-box i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bs-info);
}

.search-box input {
  padding-left: 2.5rem;
  border-radius: 2rem;
  border: 2px solid var(--bs-light);
}

.search-box input:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

/* ==========================================================================
   Quick Action Buttons
   ========================================================================== */

.quick-action-btn {
  position: relative;
  border-radius: 0.75rem;
  padding: 0.75rem 1.25rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.quick-action-btn:hover {
  transform: translateY(-2px);
}

.badge-notification {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 0.75rem;
  padding: 0.35em 0.65em;
}

/* ==========================================================================
   Request Cards (Queue Pages)
   ========================================================================== */

.request-card {
  border: none;
  border-radius: 1rem;
  border-left: 4px solid var(--bs-warning);
  transition: all 0.2s ease;
}

.request-card:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.request-card.approving {
  border-left-color: var(--bs-success);
  opacity: 0.7;
}

.request-card.denying {
  border-left-color: var(--bs-danger);
  opacity: 0.7;
}

.request-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.requester-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bs-primary) 0%, #e74c3c 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.requester-avatar-sm {
  width: 36px;
  height: 36px;
  font-size: 0.875rem;
}

.requested-apps {
  background: var(--bs-light);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-top: 1rem;
}

.requested-apps .app-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  padding: 0.5rem 0.75rem;
  border-radius: 2rem;
  margin: 0.25rem;
  font-size: 0.875rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   App Badge
   ========================================================================== */

.app-badge {
  background: var(--bs-primary);
  color: white;
  padding: 0.35rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.8rem;
  font-weight: 500;
}

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

.status-badge {
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-weight: 500;
  font-size: 0.8rem;
}

.status-badge.assigned {
  background: rgba(var(--bs-success-rgb), 0.15);
  color: var(--bs-success);
}

.status-badge.not-assigned {
  background: var(--bs-light);
  color: var(--bs-info);
}

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

.activity-card {
  border: none;
  border-radius: 1rem;
}

.activity-card .card-header {
  border-radius: 1rem 1rem 0 0;
  font-weight: 600;
}

.activity-item {
  border-bottom: 1px solid var(--bs-light);
  padding: 0.75rem 0;
}

.activity-item:last-child {
  border-bottom: none;
}

/* ==========================================================================
   Email Template Cards
   ========================================================================== */

.template-card {
  border: none;
  border-radius: 1rem;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.template-card .card-header {
  background: white;
  border-bottom: 2px solid var(--bs-light);
  padding: 1rem 1.25rem;
}

.template-card .card-header h5 {
  margin: 0;
  font-weight: 600;
}

.template-type-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-right: 0.75rem;
}

.template-type-icon.welcome {
  background: rgba(var(--bs-primary-rgb), 0.1);
  color: var(--bs-primary);
}

.template-type-icon.app-access {
  background: rgba(var(--bs-success-rgb), 0.1);
  color: var(--bs-success);
}

.template-type-icon.denied {
  background: rgba(var(--bs-danger-rgb), 0.1);
  color: var(--bs-danger);
}

.template-type-icon.other {
  background: var(--bs-light);
  color: var(--bs-info);
}

.template-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--bs-light);
  transition: background 0.2s ease;
}

.template-item:last-child {
  border-bottom: none;
}

.template-item:hover {
  background: rgba(var(--bs-primary-rgb), 0.02);
}

.template-info h6 {
  margin-bottom: 0.25rem;
}

.template-subject {
  color: var(--bs-info);
  font-size: 0.875rem;
}

.empty-template {
  padding: 2.5rem 2rem;
  text-align: center;
  color: var(--bs-info);
  background: rgba(var(--bs-light-rgb), 0.5);
}

/* ==========================================================================
   Email Editor
   ========================================================================== */

.editor-card {
  border: none;
  border-radius: 1rem;
}

.editor-card .card-header {
  background: white;
  border-bottom: 2px solid var(--bs-light);
  font-weight: 600;
}

.placeholder-dropdown {
  max-height: 300px;
  overflow-y: auto;
}

.placeholder-dropdown .dropdown-item {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--bs-light);
}

.placeholder-dropdown .dropdown-item:last-child {
  border-bottom: none;
}

.placeholder-dropdown code {
  background: var(--bs-primary);
  color: white;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
}

.preview-card {
  border: none;
  border-radius: 1rem;
  position: sticky;
  top: 1rem;
}

.preview-card .card-header {
  background: var(--bs-dark);
  color: white;
  border-radius: 1rem 1rem 0 0;
}

.required-star {
  color: var(--bs-primary);
}

/* ==========================================================================
   Preview Frame
   ========================================================================== */

.preview-frame {
  width: 100%;
  height: 400px;
  border: none;
  background: white;
}

.preview-frame-sm {
  width: 100%;
  height: 300px;
  border: none;
}

/* ==========================================================================
   Quill WYSIWYG Editor Customization
   ========================================================================== */

.ql-container.ql-snow {
  border: 1px solid var(--bs-border-color);
  border-top: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}

.ql-toolbar.ql-snow {
  border: 1px solid var(--bs-border-color);
  background: var(--bs-light);
  border-radius: 0.5rem 0.5rem 0 0;
}

.ql-container.ql-snow {
  border-radius: 0 0 0.5rem 0.5rem;
}

.ql-editor {
  min-height: 350px;
  line-height: 1.7;
  padding: 1.25rem;
}

.ql-editor p {
  margin-bottom: 0.75em;
}

.ql-snow .ql-picker {
  color: var(--bs-body-color);
}

.ql-snow .ql-stroke {
  stroke: var(--bs-body-color);
}

.ql-snow .ql-fill {
  fill: var(--bs-body-color);
}

.ql-snow button:hover .ql-stroke,
.ql-snow .ql-picker-label:hover .ql-stroke {
  stroke: var(--bs-primary);
}

.ql-snow button:hover .ql-fill,
.ql-snow .ql-picker-label:hover .ql-fill {
  fill: var(--bs-primary);
}

.ql-snow button.ql-active .ql-stroke {
  stroke: var(--bs-primary);
}

.ql-snow button.ql-active .ql-fill {
  fill: var(--bs-primary);
}

/* Placeholder insert button styling */
.placeholder-btn {
  transition: all 0.15s ease;
}

.placeholder-btn:hover {
  transform: scale(1.02);
}

/* ==========================================================================
   Misc Utilities
   ========================================================================== */

.scroll-container {
  max-height: 300px;
  overflow-y: auto;
}

.text-truncate-200 {
  max-width: 200px;
}

.sticky-card {
  top: 1rem;
}

.cursor-not-allowed {
  cursor: not-allowed;
}

.col-icon {
  width: 50px;
}

.d-inline-form {
  display: inline;
}

.reason-text {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* User profile avatar (manage user page) */
.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bs-primary) 0%, #e74c3c 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.5rem;
}

/* App logo wrapper */
.app-logo-wrapper {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bs-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.app-logo-wrapper img {
  max-width: 32px;
  max-height: 32px;
  object-fit: contain;
}

/* Info card with left border */
.info-card {
  border: none;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), 0.05) 0%, rgba(var(--bs-primary-rgb), 0.02) 100%);
  border-left: 4px solid var(--bs-primary);
}

/* Action button with consistent sizing */
.action-btn {
  min-width: 120px;
  border-radius: 2rem;
}

/* Requester info layout */
.requester-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* User profile layout */
.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* App table styling */
.app-table {
  border-radius: 1rem;
  overflow: hidden;
}

.app-table th {
  background: var(--bs-light);
  font-weight: 600;
  border: none;
}

.app-table td {
  vertical-align: middle;
}

.app-logo-cell {
  width: 50px;
}
