/* =========================================
   UI/UX Enhancements
   Improved animations, transitions, and interactions
   ========================================= */

/* ===== Button Enhancements ===== */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(11, 58, 106, 0.3);
}

.btn:active {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #0B3A6A 0%, #1e4a7a 100%);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1e4a7a 0%, #2a5890 100%);
}

/* ===== Form Enhancements ===== */
.form-control {
  transition: all 0.3s ease;
  border: 2px solid #e5e7eb;
  background: white;
  position: relative;
}

.form-control:focus {
  border-color: #0B3A6A;
  box-shadow: 0 0 0 3px rgba(11, 58, 106, 0.1), 0 4px 12px rgba(11, 58, 106, 0.15);
  transform: translateY(-2px);
}

.form-control::placeholder {
  color: #9ca3af;
  transition: color 0.3s ease;
}

.form-control:focus::placeholder {
  color: #cbd5e1;
}

/* Form validation states */
.form-control.is-valid {
  border-color: #10b981;
}

.form-control.is-valid:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-control.is-invalid {
  border-color: #ef4444;
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ===== Card Enhancements ===== */
.card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 12px;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

/* Gradient text on hover */
.card h3 {
  transition: color 0.3s ease;
}

.card:hover h3 {
  color: #0B3A6A;
}

/* ===== Link Enhancements ===== */
a {
  transition: color 0.3s ease;
}

a:hover {
  text-decoration: none;
}

/* Underline animation */
.link-underline {
  position: relative;
  color: #0B3A6A;
  text-decoration: none;
}

.link-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #0B3A6A, #339AF0);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-underline:hover::after {
  width: 100%;
}

/* ===== Input Placeholders ===== */
input::placeholder,
textarea::placeholder,
select::placeholder {
  color: #cbd5e1;
  font-size: 14px;
}

/* ===== Checkbox & Radio Enhancements ===== */
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
  transition: all 0.2s ease;
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
  transform: scale(1.1);
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  accent-color: #0B3A6A;
}

/* ===== Select Dropdown Enhancements ===== */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%230B3A6A' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* ===== Text Animation ===== */
.animate-fade-in {
  animation: fadeIn 0.6s ease-in-out;
}

.animate-slide-up {
  animation: slideUp 0.6s ease-out;
}

.animate-slide-down {
  animation: slideDown 0.6s ease-out;
}

.animate-slide-left {
  animation: slideLeft 0.6s ease-out;
}

.animate-slide-right {
  animation: slideRight 0.6s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== Alert Enhancements ===== */
.alert {
  border-radius: 8px;
  padding: 14px 16px;
  animation: slideDown 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-success {
  background: linear-gradient(135deg, #d1fae5 0%, #c6f6d5 100%);
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.alert-error {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-warning {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1px solid #fcd34d;
}

.alert-info {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #0c2d6b;
  border: 1px solid #93c5fd;
}

.alert::before {
  content: '';
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== Loading States ===== */
.loading {
  pointer-events: none;
  opacity: 0.6;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(11, 58, 106, 0.2);
  border-top-color: #0B3A6A;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Badge Enhancements ===== */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: slideUp 0.3s ease-out;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-info {
  background: #dbeafe;
  color: #0c2d6b;
}

/* ===== Tooltip Enhancements ===== */
.tooltip-trigger {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted #0B3A6A;
}

.tooltip-content {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  margin-bottom: 8px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.tooltip-trigger:hover .tooltip-content {
  opacity: 1;
  visibility: visible;
}

/* ===== Focus Indicators ===== */
:focus-visible {
  outline: 2px solid #0B3A6A;
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px dashed #0B3A6A;
  outline-offset: 4px;
}

/* ===== Accessible Skip Link ===== */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: #0B3A6A;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}

.skip-to-content:focus {
  top: 0;
}

/* ===== Responsive Enhancements ===== */
@media (max-width: 768px) {
  .btn {
    padding: 12px 16px;
    font-size: 14px;
  }

  .form-control {
    padding: 12px 14px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .card {
    margin-bottom: 16px;
  }

  select.form-control {
    background-position: right 8px center;
    padding-right: 28px;
  }
}

/* ===== Dark Mode Support ===== */
@media (prefers-color-scheme: dark) {
  .form-control {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
  }

  .form-control:focus {
    border-color: #3b82f6;
  }

  .form-control::placeholder {
    color: #64748b;
  }

  .alert {
    filter: brightness(0.9);
  }
}

/* ===== Print Styles ===== */
@media print {
  .btn,
  button,
  .nav-button {
    display: none;
  }

  .card {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #e5e7eb;
  }
}
