html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.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;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Activity Feed Styles - Metronic Style */
.activity-timeline {
  position: relative;
  padding-top: 4px;
}

.activity-item {
  position: relative;
  margin-bottom: 20px;
}

.activity-item:last-child {
  margin-bottom: 0;
}

.activity-marker {
  display: none;
}

.activity-content {
  background: #fff;
  border: 1px solid #e4e6ef;
  border-radius: 12px;
  padding: 18px 20px;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.activity-content:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: #d1d3d9;
}

.activity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 0;
}

.activity-type-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.activity-time {
  color: #a1a5b7;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

.activity-body {
  flex: 1;
}

.activity-description {
  color: #181c32;
  font-size: 0.875rem;
  line-height: 1.75;
  margin: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.activity-card-link {
  color: #009ef7;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
  display: inline;
}

.activity-card-link:hover {
  color: #0095e8;
  text-decoration: underline;
}

.activity-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #f5f8fa;
}

.activity-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #f5f8fa;
  flex-shrink: 0;
}

.activity-user-avatar-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f5f8fa;
  border: 2px solid #e4e6ef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #a1a5b7;
  flex-shrink: 0;
}

.activity-user-email {
  color: #5e6278;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.activity-attachments {
  margin-top: 16px;
}

.activity-attachment-image {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 1px solid #e4e6ef;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.activity-attachment-image:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border-color: #009ef7;
}

.activity-attachment-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-placeholder {
  width: 100%;
  height: 100%;
  background: #f5f8fa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a1a5b7;
  font-size: 0.75rem;
}

.activity-attachment-file {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  background: #f5f8fa;
  border: 1px solid #e4e6ef;
  border-radius: 8px;
  color: #5e6278;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.activity-attachment-file:hover {
  background: #e9ecef;
  border-color: #009ef7;
  color: #009ef7;
}

/* Image Preview Styles */
.image-preview-card {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  overflow: hidden;
}

.image-preview-header {
  background: #f8f9fa;
  padding: 10px 15px;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.image-preview-body {
  padding: 15px;
  text-align: center;
}

/* Global Badge Styling - Ensure proper contrast and visibility */
.badge-light-primary {
  background-color: #0d6efd !important;
  color: white !important;
}

.badge-light-secondary {
  background-color: #6c757d !important;
  color: white !important;
}

.badge-light-info {
  background-color: #0dcaf0 !important;
  color: white !important;
}

.badge-light-success {
  background-color: #198754 !important;
  color: white !important;
}

.badge-light-warning {
  background-color: #ffc107 !important;
  color: #000 !important;
}

.badge-light-danger {
  background-color: #dc3545 !important;
  color: white !important;
}

/* Ensure all bg-* badges have proper contrast with white text */
.badge.bg-primary,
.badge.bg-success,
.badge.bg-info,
.badge.bg-danger {
  color: white !important;
}

/* Warning badges use dark text on yellow background for better contrast */
.badge.bg-warning {
  color: #000 !important;
  background-color: #ffc107 !important;
}

/* Secondary badges use white text on gray background */
.badge.bg-secondary {
  color: white !important;
}

/* Ensure all badges have proper contrast */
.badge {
  font-weight: 600;
}

/* Flagged for Review Alert - Custom styling to match site theme */
.alert-flagged {
  background-color: #fee2e2;
  color: #991b1b;
  border-left: 4px solid #dc3545;
}

.alert-flagged .alert-heading {
  color: #991b1b;
  font-weight: 600;
}

.alert-flagged i {
  color: #dc3545;
}

/* Remove Image Button Styles - Always red */
.btn-remove-image {
  background-color: #dc3545 !important;
  border-color: #dc3545 !important;
  color: white !important;
}

.btn-remove-image:hover {
  background-color: #bb2d3b !important;
  border-color: #b02a37 !important;
  color: white !important;
}

.btn-remove-image:focus,
.btn-remove-image:active {
  background-color: #bb2d3b !important;
  border-color: #b02a37 !important;
  color: white !important;
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.5) !important;
}

/* Image Action Buttons - Transparent like PSA */
.image-action-btn {
  background-color: transparent !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  color: #6c757d !important;
  padding: 0.5rem !important;
  width: 36px;
  height: 36px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s ease;
}

.image-action-btn:hover:not(:disabled) {
  background-color: rgba(0, 0, 0, 0.05) !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
  color: #495057 !important;
}

.image-action-btn:focus:not(:disabled),
.image-action-btn:active:not(:disabled) {
  background-color: rgba(0, 0, 0, 0.1) !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
  color: #495057 !important;
  box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.1) !important;
}

.image-action-btn:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

.image-action-btn i {
  margin: 0 !important;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Image Flip Animation */
.image-preview-body {
  perspective: 1000px;
  position: relative;
  overflow: hidden;
  background: transparent !important;
  padding: 0 !important;
}

.image-preview-body img {
  background: transparent;
}

.image-preview-body #frontImageContainer,
.image-preview-body #backImageContainer {
  background: transparent;
}

#frontImageContainer,
#backImageContainer {
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-origin: center center;
  will-change: transform;
}

/* Page Subtitle Badge Styles - Larger with more padding */
.page-subtitle .badge {
  font-size: 0.875rem !important;
  padding: 0.5rem 0.75rem !important;
  font-weight: 600 !important;
}

.page-subtitle .badge i {
    font-size: 0.875rem !important;
}

/* Collection Transfer Link on Edit Page */
a[data-bs-target="#transferCollectionModal"] {
    transition: all 0.2s ease;
}

a[data-bs-target="#transferCollectionModal"]:hover {
    text-decoration: underline !important;
    color: #0056b3 !important;
}

a[data-bs-target="#transferCollectionModal"]:hover i {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

/* PSA Data Selection Modal Styles */
#psaDataSelectionModal .modal-header {
    border-bottom: 1px solid var(--border-color, #e4e6ef);
    padding: 1.25rem 1.5rem;
    background: #fff;
}

#psaDataSelectionModal .modal-title {
    color: var(--text-dark, #181c32);
    font-weight: 600;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
}

#psaDataSelectionModal .modal-title i {
    color: var(--info-color, #7239ea);
}

#psaDataSelectionModal .modal-body {
    padding: 1.5rem;
}

#psaModalForm p {
    color: var(--text-color, #5e6278);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.psa-field-option {
    padding: 0.875rem 0;
    border-bottom: 1px solid #f5f8fa;
}

.psa-field-option:last-child {
    border-bottom: none;
}

.psa-field-option .form-check {
    margin: 0;
}

.psa-field-option .form-check-input {
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.125rem;
    border-color: var(--border-color, #e4e6ef);
    cursor: pointer;
}

.psa-field-option .form-check-input:checked {
    background-color: var(--info-color, #7239ea);
    border-color: var(--info-color, #7239ea);
}

.psa-field-option .form-check-input:focus {
    border-color: var(--info-color, #7239ea);
    box-shadow: 0 0 0 0.25rem rgba(114, 57, 234, 0.25);
}

.psa-field-option .form-check-label {
    color: var(--text-dark, #181c32);
    font-size: 0.9375rem;
    cursor: pointer;
    margin-left: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.psa-field-option .form-check-label strong {
    font-weight: 600;
    color: var(--text-dark, #181c32);
}

.psa-field-hint {
    color: var(--text-color, #5e6278);
    font-weight: 400;
    font-size: 0.875rem;
}

#psaDataSelectionModal .modal-footer {
    border-top: 1px solid var(--border-color, #e4e6ef);
    padding: 1rem 1.5rem;
    background: #fff;
}

#psaDataSelectionModal .btn-primary {
    background-color: var(--info-color, #7239ea);
    border-color: var(--info-color, #7239ea);
    color: #fff;
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
}

#psaDataSelectionModal .btn-primary:hover {
    background-color: #6228d9;
    border-color: #6228d9;
}

#psaDataSelectionModal .btn-secondary {
    color: var(--text-color, #5e6278);
    border-color: var(--border-color, #e4e6ef);
    background-color: #fff;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
}

#psaDataSelectionModal .btn-secondary:hover {
    background-color: #f5f8fa;
    border-color: var(--border-color, #e4e6ef);
    color: var(--text-dark, #181c32);
}

/* Card Actions Dropdown Styles */
#cardActionsDropdown {
    min-width: 130px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

#cardActionsDropdown:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

#cardActionsDropdown:active {
    transform: translateY(0);
}

.dropdown-menu {
    border: 1px solid var(--border-color, #e4e6ef);
    border-radius: 8px;
    padding: 0.5rem 0;
    min-width: 220px;
    margin-top: 0.25rem !important;
    pointer-events: auto;
}

/* Ensure dropdown stays open when moving from button to menu */
.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown:hover .dropdown-toggle::after {
    transform: rotate(180deg);
}

.dropdown-item {
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.dropdown-item:hover {
    background-color: #f5f8fa;
    color: var(--text-dark, #181c32);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    font-size: 0.875rem;
}

.dropdown-item.text-danger {
    color: var(--danger-color, #f1416c) !important;
}

.dropdown-item.text-danger:hover {
    background-color: #fee2e2;
    color: #991b1b !important;
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-color: var(--border-color, #e4e6ef);
}

/* Mobile-friendly touch targets */
@media (max-width: 768px) {
    #cardActionsDropdown {
        min-width: 110px;
        padding: 0.625rem 1rem;
    }
    
    .dropdown-menu {
        min-width: 200px;
    }
    
    .dropdown-item {
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }
}