/* Tailwind Custom Styles - CDN Compatible */

/* Base Styles */
* {
  border-color: #e2e8f0;
}

body {
  background: linear-gradient(to bottom right, #f8fafc, rgba(239, 246, 255, 0.3), #f1f5f9);
  background-attachment: fixed;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: #0f172a;
}

/* Glassmorphism Card */
.glass-card {
  backdrop-filter: blur(16px);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.glass-card-hover {
  transition: all 0.3s;
}

/* Glassmorphism Sidebar */
.glass-sidebar {
  backdrop-filter: blur(24px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
  border-right: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.05);
}

/* Glassmorphism Top Bar */
.glass-topbar {
  backdrop-filter: blur(16px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.6));
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

/* Gradient Button */
.btn-gradient {
  position: relative;
  overflow: hidden;
  background: linear-gradient(to right, #3b82f6, #2563eb, #1d4ed8);
  color: white;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
  transition: all 0.3s;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, #60a5fa, #3b82f6, #2563eb);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-gradient:hover::before {
  opacity: 1;
}

.btn-gradient:hover {
  box-shadow: 0 20px 60px rgba(59, 130, 246, 0.4);
  transform: scale(1.05);
}

.btn-gradient:active {
  transform: scale(1);
}

/* Ghost Button */
.btn-ghost {
  position: relative;
  overflow: hidden;
  background: transparent;
  border: 2px solid #3b82f6;
  color: #2563eb;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  transition: all 0.3s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #3b82f6;
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-ghost:hover::before {
  opacity: 0.1;
}

.btn-ghost:hover {
  border-color: #2563eb;
  color: #1d4ed8;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  border: 2px solid #cbd5e1;
  color: #334155;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  transition: all 0.3s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-outline:hover {
  border-color: #3b82f6;
  color: #2563eb;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

/* Floating Input */
.input-floating {
  position: relative;
  width: 100%;
  margin-bottom: 1.5rem;
}

.input-floating:last-child {
  margin-bottom: 0;
}

.input-floating input,
.input-floating textarea,
.input-floating select {
  width: 100%;
  padding: 1.5rem 1rem 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #e2e8f0;
  border-radius: 0.75rem;
  color: #0f172a;
  transition: all 0.3s;
  font-family: inherit;
  font-size: 1rem;
}

.input-floating input::placeholder,
.input-floating textarea::placeholder {
  color: transparent;
}

.input-floating input:focus,
.input-floating textarea:focus,
.input-floating select:focus {
  outline: none;
  border-color: #3b82f6;
  background: white;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.input-floating label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  transition: all 0.3s;
  font-size: 1rem;
  background: transparent;
}

.input-floating input:focus + label,
.input-floating input:not(:placeholder-shown) + label,
.input-floating input:not([value=""]) + label,
.input-floating label.floating,
.input-floating textarea:focus + label,
.input-floating textarea:not(:placeholder-shown) + label,
.input-floating textarea + label.floating,
.input-floating select:focus + label,
.input-floating select + label.floating {
  top: 0.5rem;
  font-size: 0.75rem;
  color: #2563eb;
  font-weight: 500;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.95));
  padding: 0 0.5rem;
  border-radius: 0.25rem;
  left: 0.75rem;
}

.input-floating textarea {
  padding-top: 1.5rem;
  min-height: 100px;
  resize: vertical;
}

.input-floating textarea + label {
  top: 1rem;
}

.input-floating textarea:focus + label,
.input-floating textarea:not(:placeholder-shown) + label {
  top: 0.5rem;
}

/* Input Error State */
.input-floating.error input,
.input-floating.error textarea,
.input-floating.error select {
  border-color: #ef4444;
  background: rgba(254, 242, 242, 0.5);
}

.input-floating.error input:focus,
.input-floating.error textarea:focus,
.input-floating.error select:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.input-floating.error label {
  color: #dc2626;
}

.input-floating.error input:focus + label,
.input-floating.error textarea:focus + label,
.input-floating.error select:focus + label {
  color: #dc2626;
}

.input-floating .error-message {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #dc2626;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-floating .error-message::before {
  content: '⚠';
  font-size: 1rem;
}

/* Input Success State */
.input-floating.success input,
.input-floating.success textarea,
.input-floating.success select {
  border-color: #10b981;
}

.input-floating.success input:focus,
.input-floating.success textarea:focus,
.input-floating.success select:focus {
  border-color: #059669;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.input-floating.success label {
  color: #059669;
}

.input-floating.success input:focus + label,
.input-floating.success textarea:focus + label,
.input-floating.success select:focus + label {
  color: #059669;
}

/* Input Helper Text */
.input-floating .helper-text {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
}

/* Select2 Customization for Tailwind */
.select2-container--default .select2-selection--single {
  height: auto;
  border: 2px solid #e2e8f0;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  padding: 1.5rem 1rem 0.5rem;
  transition: all 0.3s;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 1.5;
  padding: 0;
  color: #0f172a;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

/* Safe Card */
.safe-card {
  backdrop-filter: blur(16px);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
  cursor: pointer;
}

.safe-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom right, rgba(59, 130, 246, 0.1), transparent, rgba(147, 197, 253, 0.1));
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

/* Navigation Item */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  color: #374151;
  font-weight: 500;
  transition: all 0.3s;
  text-decoration: none;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 0;
  background: #3b82f6;
  border-radius: 0 4px 4px 0;
  transition: all 0.3s;
}

.nav-item:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.nav-item:hover::before {
  height: 2rem;
}

.nav-item.active {
  background: linear-gradient(to right, rgba(59, 130, 246, 0.1), rgba(147, 197, 253, 0.1));
  color: #1d4ed8;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.nav-item.active::before {
  height: 2.5rem;
}

/* Modal Backdrop */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.3s ease-out;
  overflow-y: auto;
}

.modal-backdrop.hidden {
  display: none !important;
}

.modal-content {
  backdrop-filter: blur(20px);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 1.25rem;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
  max-width: 32rem;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  animation: fadeInScale 0.3s ease-out;
  position: relative;
  z-index: 10000;
  display: flex;
  flex-direction: column;
}

.modal-content.max-w-3xl {
  max-width: 48rem;
}

.modal-content.max-w-2xl {
  max-width: 42rem;
}

/* Modal Header */
.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), transparent);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-header .close-btn {
  background: transparent;
  border: none;
  font-size: 1.75rem;
  color: #64748b;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  transition: all 0.2s;
  line-height: 1;
  padding: 0;
}

.modal-header .close-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  transform: scale(1.1);
}

.modal-header .close-btn:active {
  transform: scale(0.95);
}

/* Modal Body */
.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

/* Modal Footer */
.modal-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  background: linear-gradient(to top, rgba(248, 250, 252, 0.5), transparent);
}

.modal-footer button {
  min-width: 6rem;
}

/* Table */
.table-modern {
  width: 100%;
}

.table-modern thead {
  background: linear-gradient(to right, #f8fafc, rgba(241, 245, 249, 0.5));
}

.table-modern th {
  padding: 1rem 1.5rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table-modern tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: all 0.2s;
}

.table-modern tbody tr:hover {
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.table-modern tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.3);
}

.table-modern td {
  padding: 1rem 1.5rem;
  font-size: 0.875rem;
  color: #374151;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-primary {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-info {
  background: rgba(6, 182, 212, 0.15);
  color: #0891b2;
  border: 1px solid rgba(6, 182, 212, 0.2);
}

/* Date Group Styling */
.date-group {
  transition: all 0.3s ease;
}

.date-group:hover {
  transform: translateY(-2px);
}

.date-group .date-header {
  border-left: 4px solid #2563eb;
}

/* Text Gradient */
.text-gradient {
  background: linear-gradient(to right, #2563eb, #1e40af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.5s ease-out;
}

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

.animate-fade-in-scale {
  animation: fadeInScale 0.4s ease-out;
}

.animate-pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
  }
  50% {
    opacity: 0.8;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.8);
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Radio Button Card */
.radio-card {
  position: relative;
  display: inline-block;
  width: 100%;
}

.radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-card label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid #e2e8f0;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
  color: #475569;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.radio-card label::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 197, 253, 0.1));
  opacity: 0;
  transition: opacity 0.3s;
}

.radio-card label:hover {
  border-color: #3b82f6;
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.radio-card label:hover::before {
  opacity: 1;
}

.radio-card input[type="radio"]:checked + label {
  border-color: #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(147, 197, 253, 0.1));
  color: #1d4ed8;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(59, 130, 246, 0.3);
  transform: scale(1.02);
}

.radio-card input[type="radio"]:checked + label::before {
  opacity: 1;
}

.radio-card input[type="radio"]:checked + label::after {
  content: '✓';
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  background: #3b82f6;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: bold;
}

.radio-card.error label {
  border-color: #ef4444;
  background: rgba(254, 242, 242, 0.5);
}

.radio-card.error input[type="radio"]:checked + label {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.radio-card-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.radio-card-group.error {
  margin-bottom: 0.5rem;
}

.radio-card-group .error-message {
  grid-column: 1 / -1;
  display: block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #dc2626;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.radio-card-group .error-message::before {
  content: '⚠';
  font-size: 1rem;
}

/* Accordion */
.accordion {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.4);
}

.accordion-header {
  padding: 0.75rem 1rem;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
  user-select: none;
}

.accordion-header:hover {
  background: rgba(248, 250, 252, 0.5);
}

.accordion-header .accordion-title {
  font-weight: 500;
  font-size: 0.875rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.accordion-header .accordion-title i {
  font-size: 0.875rem;
  opacity: 0.7;
}

.accordion-header .accordion-icon {
  transition: transform 0.2s;
  color: #94a3b8;
  font-size: 0.875rem;
}

.accordion.active .accordion-header .accordion-icon {
  transform: rotate(180deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease-out, padding 0.2s ease-out;
  padding: 0 1rem;
}

.accordion.active .accordion-body {
  max-height: 1000px;
  padding: 0.75rem 1rem;
  border-top: 1px solid #f1f5f9;
}

.accordion-content {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Filters Toggle Animation */
#filtersContent {
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

#toggleFiltersIcon {
  transition: transform 0.3s ease;
}

/* Selection */
::selection {
  background: #bfdbfe;
  color: #1e3a8a;
}
