/* ============================================
   Non-Critical CSS - Deferred Loading
   Styles that can be loaded after initial render
   ============================================ */

/* Glassmorphism Effects */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease forwards;
}

.animate-fade-up {
  animation: fadeUp 0.6s ease forwards;
}

.animate-bounce-in {
  animation: bounceIn 0.5s ease forwards;
}

.animate-slide-right {
  animation: slideInRight 0.5s ease forwards;
}

.animate-slide-left {
  animation: slideInLeft 0.5s ease forwards;
}

/* Card Styles */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  transition: all var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Badge Styles */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: rgba(95, 141, 126, 0.12);
  color: var(--primary);
}

.badge-secondary {
  background: var(--surface-alt);
  color: var(--text-secondary);
}

.badge-success {
  background: rgba(82, 183, 136, 0.12);
  color: var(--success);
}

.badge-warning {
  background: rgba(255, 209, 102, 0.12);
  color: #d4a017;
}

.badge-danger {
  background: rgba(231, 111, 81, 0.12);
  color: var(--danger);
}

/* Chip Styles */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  color: var(--text-secondary);
  gap: 6px;
}

.chip .color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Color Legend for Categories */
.color-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.legend-item .color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Category Actions */
.category-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
  .color-legend {
    gap: 8px;
  }
  .legend-item {
    padding: 4px 10px;
    font-size: 11px;
  }
  .category-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .category-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Tooltip Styles */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--text-primary);
  color: var(--background);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 100;
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}

/* Icon Button Styles */
.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--surface-alt);
  color: var(--text-primary);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* Alert Styles */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border-left: 4px solid;
}

.alert-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.alert-info {
  background: rgba(95, 141, 126, 0.08);
  border-color: var(--primary);
  color: var(--primary);
}

.alert-success {
  background: rgba(82, 183, 136, 0.08);
  border-color: var(--success);
  color: var(--success);
}

.alert-warning {
  background: rgba(255, 209, 102, 0.08);
  border-color: var(--warning);
  color: #d4a017;
}

.alert-danger {
  background: rgba(231, 111, 81, 0.08);
  border-color: var(--danger);
  color: var(--danger);
}

/* Table Styles */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--surface-alt);
}

.table tbody tr:hover {
  background: var(--surface-alt);
}

.table-empty {
  text-align: center;
  padding: 40px 20px;
}

.table-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.table-empty-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* Admin Table Container - Mobile Friendly */
.admin-table-container {
  padding: 0;
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}

@media (max-width: 768px) {
  .admin-table-container {
    padding: 16px;
  }
  
  .table-wrapper {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
  }
  
  .table {
    min-width: 600px;
  }
  
  .table th,
  .table td {
    padding: 10px 12px;
    font-size: 12px;
  }
  
  .table th {
    font-size: 11px;
  }
}

/* Profile Section - Mobile Friendly */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  font-size: 28px;
}

.profile-info h3 {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 3px;
}

.profile-info p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.profile-info small {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  display: block;
}

@media (max-width: 768px) {
  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    padding: 16px;
  }
  
  .profile-avatar {
    width: 64px;
    height: 64px;
    font-size: 24px;
  }
  
  .profile-info h3 {
    font-size: 16px;
  }
  
  .profile-info p {
    font-size: 12px;
  }
  
  .profile-info small {
    font-size: 11px;
  }
  
  #profileForm {
    max-width: 100% !important;
  }
  
  .form-group {
    margin-bottom: 12px;
  }
  
  .form-label {
    font-size: 12px;
  }
  
  .form-control {
    font-size: 16px !important;
    padding: 12px 14px !important;
    min-height: 48px !important;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Danger Zone - Mobile Friendly */
.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.danger-info h4 {
  font-weight: 600;
  margin-bottom: 3px;
}

.danger-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

@media (max-width: 768px) {
  .danger-zone {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .danger-zone .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Progress Bar Styles */
.progress,
.progress-container {
  width: 100%;
  height: 8px;
  background: var(--surface-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.progress-bar.success {
  background: var(--success);
}

.progress-bar.warning {
  background: var(--warning);
}

.progress-bar.danger {
  background: var(--danger);
}

/* Input Group Styles */
.input-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(95, 141, 126, 0.1);
}

.input-group-text {
  padding: 10px 12px;
  background: var(--surface-alt);
  border-right: 1px solid var(--border);
  color: var(--text-muted);
}

.input-group .form-control {
  border: none;
  border-radius: 0;
}

.input-group .form-control:focus {
  box-shadow: none;
}

/* Checkbox & Radio Styles */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check-input {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.form-check-label {
  font-size: 14px;
  color: var(--text-primary);
}

/* Link Styles */
.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: inherit;
  font-weight: 500;
  padding: 0;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.btn-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Separator Styles */
.separator {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.separator-vertical {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 12px;
}

/* Action Button Styles */
.action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background: var(--surface-alt);
  color: var(--text-primary);
}

.action-btn.delete:hover {
  background: rgba(231, 111, 81, 0.12);
  color: var(--danger);
}

.action-btn.edit:hover {
  background: rgba(95, 141, 126, 0.12);
  color: var(--primary);
}

/* Toggle Button Styles */
.toggle-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-btn:hover {
  background: var(--border);
}

.toggle-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Spacer Styles */
.spacer {
  flex: 1;
}

/* Additional Utility Classes */
.text-muted {
  color: var(--text-muted);
}

.text-primary {
  color: var(--primary);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.font-medium {
  font-weight: 500;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.overflow-hidden {
  overflow: hidden;
}

.overflow-auto {
  overflow: auto;
}

.cursor-pointer {
  cursor: pointer;
}

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

.pointer-events-none {
  pointer-events: none;
}

/* Responsive Utilities */
@media (max-width: 768px) {
  .hide-mobile {
    display: none;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none;
  }
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  .print-only {
    display: block !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}