/*
 * Component Styles - Reusable UI components and elements
 * This file contains styles for buttons, forms, cards, and other
 * reusable UI components used throughout the website.
 */

/* Login Button - Prominent call-to-action button for login forms */
.btn-login {
  display: block;
  width: 100%;
  padding: 16px;
  background-color: #0056b3;
  color: #fff;
  border: none;
  border-radius: 30px;
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 86, 179, 0.3);
}

.btn-login:hover {
  background-color: #003d82;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 86, 179, 0.4);
}

/* CTA Buttons container - Centered container for call-to-action buttons */
.cta-buttons {
  display: flex;
  justify-content: center;
  gap: 25px;
  margin-top: 40px;
}

/* Base styles for primary and secondary buttons */
.btn-primary,
.btn-secondary {
  padding: 14px 32px;
  border: none;
  border-radius: 30px;
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  text-align: center;
  min-width: 180px;
}

/* Primary button styling - White background with blue text */
.btn-primary {
  background-color: #fff;
  color: #0056b3;
  font-weight: 600;
}

/* Primary button hover effect - Light blue background and lift effect */
.btn-primary:hover {
  background-color: #f0f5ff;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Secondary button styling - Transparent background with white border and text */
.btn-secondary {
  background-color: transparent;
  color: #fff;
  border: 2px solid #fff;
}

/* Secondary button hover effect - Semi-transparent white background and lift effect */
.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Responsive adjustments for call-to-action buttons */
@media (max-width: 768px) {
  .cta-buttons {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    max-width: 300px;
  }
}

/* Form elements - Input fields, labels, and form containers */
.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #222;
}

.form-control {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid #ddd;
  border-radius: 30px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background-color: #fff;
}

.form-control:focus {
  border-color: #0056b3;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

/* Form Error Styles - Reusable validation error messages and states */

/* Form-level error - Error message shown at the top of a form */
.form-error {
  background: #fee2e2;
  border: 2px solid #fca5a5;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #b91c1c;
  font-weight: 500;
  animation: shake 0.4s ease-in-out;
}

.form-error i {
  font-size: 18px;
  flex-shrink: 0;
}

/* Field-level error - Error message shown below individual form fields */
.field-error {
  color: #b91c1c;
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 6px;
  padding-left: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: shake 0.4s ease-in-out;
}

.field-error i {
  font-size: 14px;
  flex-shrink: 0;
}

/* Input error state - Visual indicator for invalid input fields */
.input-error,
.form-control.input-error {
  border-color: #fca5a5 !important;
  background-color: #fef2f2;
}

.input-error:focus,
.form-control.input-error:focus {
  border-color: #f87171 !important;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2);
}

/* Shake animation - Visual feedback for error states */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-5px);
  }
  40%,
  80% {
    transform: translateX(5px);
  }
}

/* Input with icon - Form field with decorative icon
 * NOTE: Main styling is in styles.css which positions icons OUTSIDE the input box (left: -30px)
 * This file only adds padding for inputs that use the .form-control class
 * Do NOT add .input-with-icon i positioning here as it conflicts with styles.css
 */
.input-with-icon .form-control {
  padding-left: 50px;
}

/* Organization cards - Client/organization display cards */
.organization-card {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  padding: 30px;
  border: 1px solid rgba(0, 86, 179, 0.08);
  transition: all 0.3s ease;
}

.organization-card:hover {
  box-shadow: 0 12px 35px rgba(0, 86, 179, 0.12);
  transform: translateY(-5px);
}

/* Header section of organization cards - Contains name and type */
.org-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.org-header h4 {
  margin: 0;
  font-size: 1.3rem;
  color: #222;
  font-weight: 600;
}

.org-type {
  background-color: #0056b3;
  color: white;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.8rem;
  font-weight: 500;
}

.org-stats {
  margin-bottom: 25px;
}

.org-stats p {
  margin: 12px 0;
  display: flex;
  align-items: center;
  color: #555;
  font-size: 0.95rem;
}

.org-stats i {
  width: 25px;
  color: #0056b3;
}

/* Action buttons container - Holds the View and Manage buttons */
.org-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

/* Individual action buttons - View Details and Manage */
.org-actions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  font-size: 0.85rem;
  min-width: 100px;
}

/* Fallback for browsers that don't support gap */
.org-actions button > * {
  margin: 0 3px;
}

/* Ensure Font Awesome icons are displayed correctly */
.org-actions button i {
  display: inline-block;
  width: 1em;
  text-align: center;
}

/* Fix for secondary buttons inside organization cards - ensure text is visible */
.organization-card .btn-secondary {
  color: #0056b3;
  border-color: #0056b3;
}

.organization-card .btn-secondary:hover {
  background-color: rgba(0, 86, 179, 0.15);
  color: #003d82;
  border-color: #003d82;
}

/* Modal Styles - Popup dialogs for detailed views */

/* Modal overlay - Semi-transparent background that covers the entire screen */
.modal {
  display: block;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
}

/* Modal content container - White box that appears in the center of the screen */
.modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 0;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 600px;
  animation: slideIn 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

/* Modal header - Contains title and close button */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px 30px;
  border-bottom: 1px solid #eee;
  background-color: #f8f9fa;
  border-radius: 12px 12px 0 0;
}

.modal-header h3 {
  margin: 0;
  color: #222;
  font-size: 1.4rem;
}

.close-modal {
  font-size: 1.8rem;
  font-weight: bold;
  cursor: pointer;
  color: #999;
  transition: color 0.3s ease;
}

.close-modal:hover {
  color: #333;
}

/* Modal body - Contains the main content */
.modal-body {
  padding: 30px;
}

/* Modal footer - Contains action buttons */
.modal-footer {
  padding: 20px 30px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  background-color: #f8f9fa;
  border-radius: 0 0 12px 12px;
}

/* Fix for buttons inside modals - ensure text is visible */
.modal .btn-primary,
.modal .btn-secondary {
  color: #0056b3;
  border-color: #0056b3;
}

.modal .btn-primary:hover,
.modal .btn-secondary:hover {
  background-color: rgba(0, 86, 179, 0.15);
  color: #003d82;
  border-color: #003d82;
}

/* Animations - Smooth transitions and effects */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Status badges - Visual indicators for different statuses */
.status-active {
  background-color: #28a745;
  color: white;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-pending {
  background-color: #ffc107;
  color: #212529;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-expired {
  background-color: #dc3545;
  color: white;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Lookup Progress Bar - Animated progress indicator for API lookups */
.lookup-progress {
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.lookup-progress-text {
  font-weight: 600;
  color: var(--primary-blue);
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.lookup-progress-bar-wrapper {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.lookup-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-blue) 0%, #0090ff 50%, var(--primary-blue) 100%);
  background-size: 200% 100%;
  border-radius: 4px;
  transition: width 0.1s linear;
  animation: progressShimmer 1.5s linear infinite;
}

@keyframes progressShimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.lookup-progress-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 10px;
}

.lookup-countdown {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-blue);
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
}

/* Password Strength Indicator - Real-time feedback for password security level */
.password-strength {
  margin-top: 12px;
  padding: 12px 16px;
  background-color: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Progress bar container */
.password-strength-bar-wrapper {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

/* Progress bar fill with smooth transitions */
.password-strength-bar {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition:
    width 0.3s ease,
    background-color 0.3s ease;
}

/* Strength level colors */
.password-strength-bar.strength-weak {
  background-color: #dc3545;
}

.password-strength-bar.strength-fair {
  background-color: #ff8800;
}

.password-strength-bar.strength-good {
  background-color: #ffc107;
}

.password-strength-bar.strength-strong {
  background-color: #28a745;
}

/* Strength label text */
.password-strength-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 500;
}

.password-strength-label-text {
  color: var(--text-secondary);
}

.password-strength-level {
  font-weight: 600;
  text-transform: capitalize;
}

/* Strength level label colors */
.password-strength-level.level-weak {
  color: #dc3545;
}

.password-strength-level.level-fair {
  color: #ff8800;
}

.password-strength-level.level-good {
  color: #b8860b;
}

.password-strength-level.level-strong {
  color: #28a745;
}

/* Tips list for password improvement suggestions */
.password-strength-tips {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.password-strength-tips-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.password-strength-tips ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.password-strength-tips li {
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 3px 0 3px 18px;
  position: relative;
}

.password-strength-tips li::before {
  content: '\2022';
  color: var(--primary-blue);
  font-weight: bold;
  position: absolute;
  left: 0;
}

/* Hide tips when password is strong */
.password-strength-tips.no-tips {
  display: none;
}

/* ==========================================================================
   ICON BUTTONS
   Compact icon-only buttons used in action columns and toolbars
   ========================================================================== */

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  background-color: #fff;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background-color: var(--bg-hover, #f3f4f6);
  color: var(--text-primary, #111827);
  border-color: var(--border-hover, #d1d5db);
}

.btn-icon:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.btn-icon:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Danger variant for delete/destructive actions */
.btn-icon.btn-icon-danger:hover {
  background-color: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

/* Success variant for confirm/approve actions */
.btn-icon.btn-icon-success:hover {
  background-color: #f0fdf4;
  color: #16a34a;
  border-color: #bbf7d0;
}

/* Primary variant for main actions */
.btn-icon.btn-icon-primary:hover {
  background-color: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

/* Small variant */
.btn-icon-sm {
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
}

/* Large variant */
.btn-icon-lg {
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
}

/* ==========================================================================
   ACTION STACKS
   Layout for table row actions with main button and icon buttons
   ========================================================================== */

.action-stack {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-main {
  flex: 0 0 auto;
}

.action-icons {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Vertical action stack for narrow columns */
.action-stack-vertical {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.action-stack-vertical .action-icons {
  justify-content: center;
}

/* ==========================================================================
   EXTENDED STATUS BADGES
   Status indicators for payment, instruction, and other entity statuses
   ========================================================================== */

/* Base badge styles */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

/* Payment statuses */
.status-unpaid,
.status-badge-unpaid {
  background-color: #fef3c7;
  color: #92400e;
}

.status-paid,
.status-badge-paid {
  background-color: #d1fae5;
  color: #065f46;
}

.status-partial,
.status-badge-partial {
  background-color: #dbeafe;
  color: #1e40af;
}

.status-overpaid,
.status-badge-overpaid {
  background-color: #fce7f3;
  color: #9d174d;
}

.status-refunded,
.status-badge-refunded {
  background-color: #f3e8ff;
  color: #7c3aed;
}

/* Instruction statuses */
.status-instructed,
.status-badge-instructed {
  background-color: #dbeafe;
  color: #1e40af;
}

.status-processing,
.status-badge-processing {
  background-color: #e0e7ff;
  color: #4338ca;
}

.status-submitted,
.status-badge-submitted {
  background-color: #cffafe;
  color: #0e7490;
}

.status-completed,
.status-badge-completed {
  background-color: #d1fae5;
  color: #065f46;
}

.status-cancelled,
.status-badge-cancelled {
  background-color: #f3f4f6;
  color: #6b7280;
}

.status-failed,
.status-badge-failed {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Priority badges */
.priority-urgent,
.priority-badge-urgent {
  background-color: #fee2e2;
  color: #991b1b;
}

.priority-high,
.priority-badge-high {
  background-color: #ffedd5;
  color: #9a3412;
}

.priority-normal,
.priority-badge-normal {
  background-color: #dbeafe;
  color: #1e40af;
}

.priority-low,
.priority-badge-low {
  background-color: #f3f4f6;
  color: #6b7280;
}

/* ==========================================================================
   TOOLTIPS
   Hover tooltips for additional context
   ========================================================================== */

.tooltip-wrapper {
  position: relative;
  display: inline-block;
}

.tooltip-wrapper .tooltip-text {
  visibility: hidden;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background-color: #1f2937;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.tooltip-wrapper .tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #1f2937 transparent transparent transparent;
}

.tooltip-wrapper:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Tooltip positions */
.tooltip-wrapper .tooltip-text.tooltip-bottom {
  bottom: auto;
  top: 125%;
}

.tooltip-wrapper .tooltip-text.tooltip-bottom::after {
  top: auto;
  bottom: 100%;
  border-color: transparent transparent #1f2937 transparent;
}

.tooltip-wrapper .tooltip-text.tooltip-left {
  bottom: auto;
  top: 50%;
  left: auto;
  right: 125%;
  transform: translateY(-50%);
}

.tooltip-wrapper .tooltip-text.tooltip-left::after {
  top: 50%;
  left: 100%;
  margin-left: 0;
  margin-top: -5px;
  border-color: transparent transparent transparent #1f2937;
}

.tooltip-wrapper .tooltip-text.tooltip-right {
  bottom: auto;
  top: 50%;
  left: 125%;
  transform: translateY(-50%);
}

.tooltip-wrapper .tooltip-text.tooltip-right::after {
  top: 50%;
  right: 100%;
  left: auto;
  margin-top: -5px;
  border-color: transparent #1f2937 transparent transparent;
}

/* ==========================================================================
   BADGE / TAG COMPONENTS
   Small labels for counts, tags, and indicators
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 9999px;
  background-color: #e5e7eb;
  color: #374151;
}

.badge-primary {
  background-color: #dbeafe;
  color: #1e40af;
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Dot indicator badge */
.badge-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  min-width: 8px;
  padding: 0;
  border-radius: 50%;
}

.badge-dot-success {
  background-color: #22c55e;
}

.badge-dot-warning {
  background-color: #f59e0b;
}

.badge-dot-danger {
  background-color: #ef4444;
}

.badge-dot-info {
  background-color: #3b82f6;
}

/* ==========================================================================
   TABLE ACTION BUTTONS
   Subtle buttons designed for use within table cells
   ========================================================================== */

.btn-table-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--primary-blue, #0056b3);
  background-color: transparent;
  border: 1px solid var(--primary-blue, #0056b3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-table-action:hover {
  background-color: var(--primary-blue, #0056b3);
  color: #fff;
}

.btn-table-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-table-action-sm {
  padding: 4px 8px;
  font-size: 0.75rem;
}

/* Danger variant */
.btn-table-action-danger {
  color: #dc2626;
  border-color: #dc2626;
}

.btn-table-action-danger:hover {
  background-color: #dc2626;
  color: #fff;
}

/* Success variant */
.btn-table-action-success {
  color: #16a34a;
  border-color: #16a34a;
}

.btn-table-action-success:hover {
  background-color: #16a34a;
  color: #fff;
}

/* ==========================================================================
   LOADING STATES
   Spinners and skeleton loaders
   ========================================================================== */

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border, #e5e7eb);
  border-top-color: var(--primary-blue, #0056b3);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

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

.skeleton-text-sm {
  height: 0.75em;
}

.skeleton-circle {
  border-radius: 50%;
}

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

/* ==========================================================================
   EMPTY STATE
   Placeholder for when no data is available
   ========================================================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-secondary, #6b7280);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary, #111827);
  margin-bottom: 8px;
}

.empty-state-description {
  font-size: 0.9rem;
  max-width: 300px;
  margin-bottom: 16px;
}

.empty-state-action {
  margin-top: 8px;
}
