/* ==========================================
   WORKFLOW MANAGEMENT
   ========================================== */

.workflows-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.workflows-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.workflows-header .header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.workflow-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.workflow-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid #e5e7eb;
}

.workflows-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.workflow-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.2s;
}

.workflow-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.workflow-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.workflow-card-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 0.25rem 0;
}

.workflow-description {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

.workflow-card-meta {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.workflow-card-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
}

/* ==========================================
   WORKFLOW BUILDER MODAL
   ========================================== */

.workflow-builder-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.workflow-builder-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.workflow-builder-content {
  position: relative;
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 1000px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: builderSlideIn 0.3s ease-out;
}

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

.builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #e5e7eb;
}

.builder-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.builder-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.builder-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e5e7eb;
}

.builder-section:last-child {
  border-bottom: none;
}

.builder-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 1.5rem 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-header h3 {
  margin: 0;
}

.form-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.form-select:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Workflow Steps Container */
.workflow-steps-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.empty-steps {
  text-align: center;
  padding: 3rem 1rem;
  background: #f9fafb;
  border-radius: 8px;
  color: #6b7280;
}

.empty-steps i {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  color: #9ca3af;
}

.workflow-step-card {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  transition: all 0.2s;
}

.workflow-step-card:hover {
  border-color: #8b5cf6;
  background: white;
}

.step-number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.step-content {
  flex: 1;
}

.step-name-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.step-name-input:focus {
  outline: none;
  border-color: #8b5cf6;
}

.step-approvers label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.approver-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.approver-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
}

.remove-approver {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #6b7280;
  display: flex;
  align-items: center;
}

.remove-approver:hover {
  color: #ef4444;
}

.remove-approver i {
  width: 14px;
  height: 14px;
}

/* Template Buttons */
.template-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.btn-outline {
  padding: 1rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.btn-outline:hover {
  border-color: #8b5cf6;
  background: #f5f3ff;
  color: #8b5cf6;
}

.builder-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-top: 1px solid #e5e7eb;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.813rem;
}

/* Badge Variants */
.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.badge-secondary {
  background: #f3f4f6;
  color: #4b5563;
}

/* Responsive */
@media (max-width: 768px) {
  .workflows-container {
    padding: 1rem;
  }

  .workflows-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .workflow-stats-grid {
    grid-template-columns: 1fr;
  }

  .workflow-card-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .workflow-card-actions {
    flex-wrap: wrap;
  }

  .workflow-builder-content {
    width: 95%;
    max-height: 95vh;
  }

  .builder-body {
    padding: 1rem;
  }

  .template-buttons {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   MY APPROVALS DASHBOARD
   ========================================== */

.approvals-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.approvals-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.approvals-header .header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.approval-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.approval-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid #e5e7eb;
}

.approvals-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Approval Cards */
.approval-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.2s;
}

.approval-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.approval-card.approval-pending {
  border-left: 4px solid #fbbf24;
}

.approval-card-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.approval-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.approval-icon i {
  width: 24px;
  height: 24px;
  color: white;
}

.approval-info {
  flex: 1;
}

.approval-info h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 0.25rem 0;
}

.approval-entity {
  font-size: 0.875rem;
  color: #4b5563;
  margin: 0 0 0.125rem 0;
}

.approval-workflow {
  font-size: 0.75rem;
  color: #9ca3af;
  margin: 0;
}

.approval-urgency {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.813rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.approval-urgency i {
  width: 16px;
  height: 16px;
}

.urgency-normal {
  background: #f3f4f6;
  color: #6b7280;
}

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

.urgency-critical {
  background: #fed7aa;
  color: #9a3412;
}

.urgency-overdue {
  background: #fee2e2;
  color: #991b1b;
}

.approval-comments {
  padding: 1rem;
  background: #f9fafb;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #4b5563;
  margin-bottom: 1rem;
}

.approval-comments strong {
  color: #1f2937;
}

.approval-meta {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 1rem;
}

.approval-card-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

/* Button Variants */
.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Approval Details Modal */
.approval-details-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.approval-details-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.approval-details-content {
  position: relative;
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: detailsSlideIn 0.3s ease-out;
}

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

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #e5e7eb;
}

.details-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.details-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.detail-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e5e7eb;
}

.detail-section:last-child {
  border-bottom: none;
}

.detail-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 1rem 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-item label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-item value {
  font-size: 0.875rem;
  color: #1f2937;
}

.entity-content {
  padding: 1.5rem;
  background: #f9fafb;
  border-radius: 8px;
}

.entity-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 0.5rem 0;
}

.entity-content p {
  font-size: 0.875rem;
  color: #4b5563;
  margin: 0.25rem 0;
}

.policy-content-preview {
  margin-top: 1rem;
  padding: 1rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.813rem;
  color: #4b5563;
  max-height: 200px;
  overflow-y: auto;
}

.details-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-top: 1px solid #e5e7eb;
}

/* Responsive */
@media (max-width: 768px) {
  .approvals-container {
    padding: 1rem;
  }

  .approvals-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .approval-stats-grid {
    grid-template-columns: 1fr;
  }

  .approval-card-header {
    flex-direction: column;
  }

  .approval-card-actions {
    justify-content: flex-start;
  }

  .approval-details-content {
    width: 95%;
    max-height: 95vh;
  }

  .details-body {
    padding: 1rem;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}
